Skip to main content

LangChain

Bundles 包含支援特定第三方整合的自訂Components,與 AgentBuilder 搭配使用。

此頁面描述 LangChain bundle 中可用的Components。

CSV Agent​

此Components基於 Agent 核心Components。

此Components從 CSV 檔案和 LLM 建立 CSV agent。 如需詳細資訊,請參閱 LangChain CSV agent 文件。

CSV Agent 參數​

NameTypeDescription
llmLanguageModel輸入參數。要用於 agent 的語言模型。
pathFile輸入參數。CSV 檔案的路徑。
agent_typeString輸入參數。要建立的 agent 類型。
agentAgentExecutor輸出參數。CSV agent 實例。

OpenAI Tools Agent​

此Components基於 Agent 核心Components。

此Components建立 OpenAI Tools Agent。 如需詳細資訊,請參閱 LangChain OpenAI agent 文件。

OpenAI Tools Agent 參數​

NameTypeDescription
llmLanguageModel輸入參數。要使用的語言模型。
toolsList of Tools輸入參數。要提供給 agent 存取的工具。
system_promptString輸入參數。要提供給 agent 作為上下文的系統提示。
input_valueString輸入參數。使用者對 agent 的輸入。
memoryMemory輸入參數。Agent 用於上下文持久性的記憶體。
max_iterationsInteger輸入參數。允許 agent 執行的最大迭代次數。
verboseBoolean輸入參數。這決定是否列印 agent 的中間步驟。
handle_parsing_errorsBoolean輸入參數。這決定是否處理 agent 中的解析錯誤。
agentAgentExecutor輸出參數。OpenAI Tools agent 實例。
outputString輸出參數。對輸入執行 agent 的輸出。

OpenAPI Agent​

此Components基於 Agent 核心Components。

此Components建立用於與 OpenAPI 服務互動的 agent。 如需詳細資訊,請參閱 LangChain OpenAPI toolkit 文件。

OpenAPI Agent 參數​

NameTypeDescription
llmLanguageModel輸入參數。要使用的語言模型。
openapi_specString輸入參數。服務的 OpenAPI 規範。
base_urlString輸入參數。API 的基礎 URL。
headersDict輸入參數。API 請求的可選標頭。
agent_executor_kwargsDict輸入參數。Agent executor 的可選參數。
agentAgentExecutor輸出參數。OpenAPI agent 實例。

Prompt Hub​

此Components從 LangChain Hub 擷取提示。

與 Prompt Template 核心Components 類似,會為提示中的每個變數在Components中新增額外欄位。 例如,預設提示 efriis/my-first-prompt 會為 profession 和 question 新增欄位。

Prompt Hub 參數​

NameDisplay NameDescription
langchain_api_keyYour LangChain API Key輸入參數。要使用的 LangChain API 金鑰。
langchain_hub_promptLangChain Hub Prompt輸入參數。要使用的 LangChain Hub 提示。
promptBuild Prompt輸出參數。build_prompt 方法返回的建置提示訊息。

SQL Agent​

此Components基於 Agent 核心Components。

此Components建立用於與 SQL 資料庫互動的 agent。 如需詳細資訊,請參閱 LangChain SQL agent 文件。

SQL Agent 參數​

NameTypeDescription
llmLanguageModel輸入參數。要使用的語言模型。
databaseDatabase輸入參數。SQL 資料庫連線。
top_kInteger輸入參數。從 SELECT 查詢返回的結果數量。
use_toolsBoolean輸入參數。這決定是否使用工具進行查詢執行。
return_intermediate_stepsBoolean輸入參數。這決定是否返回 agent 的中間步驟。
max_iterationsInteger輸入參數。執行 agent 的最大迭代次數。
max_execution_timeInteger輸入參數。最大執行時間(秒)。
early_stopping_methodString輸入參數。用於提前停止的方法。
verboseBoolean輸入參數。這決定是否列印 agent 的想法。
agentAgentExecutor輸出參數。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 參數​

NameTypeDescription
llmLanguageModel輸入參數。要使用的語言模型。
toolsList[Tool]輸入參數。Agent 可用的工具清單。
system_messageString輸入參數。要用於 agent 的系統訊息。
return_intermediate_stepsBoolean輸入參數。這決定是否返回 agent 的中間步驟。
max_iterationsInteger輸入參數。執行 agent 的最大迭代次數。
max_execution_timeInteger輸入參數。最大執行時間(秒)。
early_stopping_methodString輸入參數。用於提前停止的方法。
verboseBoolean輸入參數。這決定是否列印 agent 的想法。
agentAgentExecutor輸出參數。工具呼叫 agent 實例。

XML Agent​

此Components基於 Agent 核心Components。

此Components使用 LangChain 建立 XML Agent。 Agent 使用 XML 格式為 LLM 提供工具指示。 如需詳細資訊,請參閱 LangChain XML Agent 文件。

XML Agent 參數​

NameTypeDescription
llmLanguageModel輸入參數。要用於 agent 的語言模型。
user_promptString輸入參數。具有 XML 格式指示的 agent 自訂提示範本。
toolsList[Tool]輸入參數。Agent 可用的工具清單。
agentAgentExecutor輸出參數。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。

Search