使用 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 程式碼

後續步驟