LangChain
Bundles 包含支援特定第三方整 合的自訂Components,與 AgentBuilder 搭配使用。
此頁面描述 LangChain bundle 中可用的Components。
CSV Agent
此Components基於 Agent 核心Components。
此Components從 CSV 檔案和 LLM 建立 CSV agent。 如需詳細資訊,請參閱 LangChain CSV agent 文件。
CSV Agent 參數
| Name | Type | Description |
|---|---|---|
| llm | LanguageModel | 輸入參數。要用於 agent 的語言模型。 |
| path | File | 輸入參數。CSV 檔案的路徑。 |
| agent_type | String | 輸入參數。要建立的 agent 類型。 |
| agent | AgentExecutor | 輸出參數。CSV agent 實例。 |
OpenAI Tools Agent
此Components基於 Agent 核心Components。
此Components建立 OpenAI Tools Agent。 如需詳細資訊,請參閱 LangChain OpenAI agent 文件。
OpenAI Tools Agent 參數
| Name | Type | Description |
|---|---|---|
| llm | LanguageModel | 輸入參數。要使用的語言模型。 |
| tools | List of Tools | 輸入參數。要提供給 agent 存取的工具。 |
| system_prompt | String | 輸入參數。要提供給 agent 作為上下文的系統提示。 |
| input_value | String | 輸入參數。使用者對 agent 的輸入。 |
| memory | Memory | 輸入參數。Agent 用於上下文持久性的記憶體。 |
| max_iterations | Integer | 輸入參數。允許 agent 執行的最大迭代次數。 |
| verbose | Boolean | 輸入參數。這決定是否列印 agent 的中間步驟。 |
| handle_parsing_errors | Boolean | 輸入參數。這決定是否處理 agent 中的解析錯誤。 |
| agent | AgentExecutor | 輸出參數。OpenAI Tools agent 實例。 |
| output | String | 輸出參數。對輸入執行 agent 的輸出。 |
OpenAPI Agent
此Components基於 Agent 核心Components。
此Components建立用於與 OpenAPI 服務互動的 agent。 如需詳細資訊,請參閱 LangChain OpenAPI toolkit 文件。
OpenAPI Agent 參數
| Name | Type | Description |
|---|---|---|
| llm | LanguageModel | 輸入參數。要使用的語言模型。 |
| openapi_spec | String | 輸入參數。服務的 OpenAPI 規範。 |
| base_url | String | 輸入參數。API 的基礎 URL。 |
| headers | Dict | 輸入參數。API 請求的可選標頭。 |
| agent_executor_kwargs | Dict | 輸入參數。Agent executor 的可選參數。 |
| agent | AgentExecutor | 輸出參數。OpenAPI agent 實例。 |
Prompt Hub
此Components從 LangChain Hub 擷取提示。
與 Prompt Template 核心Components 類似,會為提示中的每個變數在Components中新增額外欄位。
例如,預設提示 efriis/my-first-prompt 會為 profession 和 question 新增欄位。
Prompt Hub 參數
| Name | Display Name | Description |
|---|---|---|
| langchain_api_key | Your LangChain API Key | 輸入 參數。要使用的 LangChain API 金鑰。 |
| langchain_hub_prompt | LangChain Hub Prompt | 輸入參數。要使用的 LangChain Hub 提示。 |
| prompt | Build Prompt | 輸出參數。build_prompt 方法返回的建置提示訊息。 |
SQL Agent
此Components基於 Agent 核心Components。
此Components建立用於與 SQL 資料庫互動的 agent。 如需詳細資訊,請參閱 LangChain SQL agent 文件。
SQL Agent 參數
| Name | Type | Description |
|---|---|---|
| llm | LanguageModel | 輸入參數。要使用的語言模型。 |
| database | Database | 輸入參數。SQL 資料庫連線。 |
| top_k | Integer | 輸入參數。從 SELECT 查詢返回的結果數量。 |
| use_tools | Boolean | 輸入參數。這決定是否使用工具進行查詢執行。 |
| return_intermediate_steps | Boolean | 輸入參數。這決定是否返回 agent 的中間步驟。 |
| max_iterations | Integer | 輸入參數。執行 agent 的最大迭代次數。 |
| max_execution_time | Integer | 輸入參數。最大執行時間(秒)。 |
| early_stopping_method | String | 輸入參數。用於提前停止的方法。 |
| verbose | Boolean | 輸入參數。這決定是否列印 agent 的想法。 |
| agent | AgentExecutor | 輸出參數。SQL agent 實例。 |
SQL Database
LangChain SQL Database Components建立與 SQL 資料庫的連線。
此Components與 SQL Database 核心Components 不同,後者對 SQLAlchemy 相容資料庫執行 SQL 查詢。
Text Splitters
LangChain bundle 包含以下文字分割器Components:
- Character Text Splitter
- Language Recursive Text Splitter
- Natural Language Text Splitter
- Recursive Character Text Splitter
- Semantic Text Splitter
Tool Calling Agent
此Components基於 Agent 核心Components。
此Components建立用於各種語言模型的結構化工具呼叫 agent。 如需詳細資訊,請參閱 LangChain tool calling 文件。
Tool Calling Agent 參數
| Name | Type | Description |
|---|---|---|
| llm | LanguageModel | 輸入參數。要使用的語言模型。 |
| tools | List[Tool] | 輸入參數。Agent 可用的工具清單。 |
| system_message | String | 輸入參數。要用於 agent 的系統訊息。 |
| return_intermediate_steps | Boolean | 輸入參數。這決定是否返回 agent 的中間步驟。 |
| max_iterations | Integer | 輸入參數。執行 agent 的最大迭代次數。 |
| max_execution_time | Integer | 輸入參數。最大執行時間(秒)。 |
| early_stopping_method | String | 輸入參數。用於提前停止的方法。 |
| verbose | Boolean | 輸入參數。這決定是否列印 agent 的想法。 |
| agent | AgentExecutor | 輸出參數。工具呼叫 agent 實例。 |
XML Agent
此Components基於 Agent 核心Components。
此Components使用 LangChain 建立 XML Agent。 Agent 使用 XML 格式為 LLM 提供工具指示。 如需詳細資訊,請參閱 LangChain XML Agent 文件。
XML Agent 參數
| Name | Type | Description |
|---|---|---|
| llm | LanguageModel | 輸入參數。要用於 agent 的語言模型。 |
| user_prompt | String | 輸入參數。具有 XML 格式指示的 agent 自訂提示範本。 |
| tools | List[Tool] | 輸入參數。Agent 可用的工具清單。 |
| agent | AgentExecutor | 輸出參數。XML Agent 實例。 |
其他 LangChain Components
LangChain bundle 中的其他Components包括以下:
- Fake Embeddings
- HTML Link Extractor
- Runnable Executor
- Spider Web Crawler & Scraper
舊版 LangChain Components
舊版Components不再受支援,並且可能在未來版本中被移除。 您可以繼續在現有 Flow 中使用它們,但建議您盡快將它們替換為受支援的Components。 建議的替換方案包含在 Flow 中Components上的 Legacy 橫幅中。 它們也會在發行說明和 AgentBuilder 文件中盡可能提供。
如果您不確定如何替換舊版Components,請按提供者、服務或Components名稱 Search Components。 Components可能已被棄用,取而代之的是完全新的Components、類似的Components,或同一類別中同一Components的較新版本。
如果沒有明顯的替換方案,請考慮另一個Components是否可以適應您的使用案例。 例如,許多 Core components 提供通用功能,可以支援多個提供者和使用案例,例如 API Request Components。
如果這些選項都不可行,您可以使用舊版Components的程式碼建立自己的自訂Components,或在 GitHub 上開始討論 關於舊版Components。
為了阻止在新 Flow 中使用舊版Components,這些Components預設為隱藏。 在視覺編輯器中,您可以點擊 Component settings 來切換 Legacy 篩選器。
以下 LangChain Components處於舊版狀態:
- Conversation Chain
- LLM Checker Chain
- LLM Math Chain
- Natural Language to SQL
- Retrieval QA
- Self Query Retriever
- JSON Agent
- Vector Store Info/Agent
- VectorStoreRouterAgent
要替換這些Components,請考慮 LangChain bundle 中的其他Components或一般 AgentBuilder Components,例如 Agent Components 或 SQL Database Components。