使用 LlamaIndex 查詢管道代理程式

除了使用代理程式的一般操作說明外,本頁面也會說明 LlamaIndexQueryPipelineAgent 的專屬功能。

事前準備

本教學課程假設您已詳閱並按照下列教學課程的指示操作:

支援的作業

LlamaIndexQueryPipelineAgent 支援下列作業:

  • query:用於同步取得查詢的回覆。

query 方法支援下列引數類型:

  • input:要傳送給代理人的訊息。

查詢代理程式

指令:

agent.query(input="What is Paul Graham's life in college?")

等同於下列項目 (完整形式):

agent.query(input={"input": "What is Paul Graham's life in college?"})

如要自訂輸入字典,請參閱「自訂提示範本」。

您也可以將其他關鍵字引數傳遞至 query(),進一步自訂代理程式的行為 (不只是 input)。

response = agent.query(
    input={
      "input" = [
        "What is Paul Graham's life in college?",
        "How did Paul Graham's college experience shape his career?",
        "How did Paul Graham's college experience shape his entrepreneurial mindset?",
      ],
    },
    batch=True  # run the pipeline in batch mode and pass a list of inputs.
)
print(response)

如需可用參數的完整清單,請參閱 QueryPipeline.run 程式碼

後續步驟