mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 15:19:33 +00:00
docs[patch]: In conceptual docs explain constraints on ToolMessage (#26792)
Minor clarification
This commit is contained in:
parent
3a1b9259a7
commit
27c12146c8
@ -116,14 +116,14 @@ These also have corresponding async methods that should be used with [asyncio](h
|
|||||||
|
|
||||||
The **input type** and **output type** varies by component:
|
The **input type** and **output type** varies by component:
|
||||||
|
|
||||||
| Component | Input Type | Output Type |
|
| Component | Input Type | Output Type |
|
||||||
| --- | --- | --- |
|
|--------------|-------------------------------------------------------|-----------------------|
|
||||||
| Prompt | Dictionary | PromptValue |
|
| Prompt | Dictionary | PromptValue |
|
||||||
| ChatModel | Single string, list of chat messages or a PromptValue | ChatMessage |
|
| ChatModel | Single string, list of chat messages or a PromptValue | ChatMessage |
|
||||||
| LLM | Single string, list of chat messages or a PromptValue | String |
|
| LLM | Single string, list of chat messages or a PromptValue | String |
|
||||||
| OutputParser | The output of an LLM or ChatModel | Depends on the parser |
|
| OutputParser | The output of an LLM or ChatModel | Depends on the parser |
|
||||||
| Retriever | Single string | List of Documents |
|
| Retriever | Single string | List of Documents |
|
||||||
| Tool | Single string or dictionary, depending on the tool | Depends on the tool |
|
| Tool | Single string or dictionary, depending on the tool | Depends on the tool |
|
||||||
|
|
||||||
|
|
||||||
All runnables expose input and output **schemas** to inspect the inputs and outputs:
|
All runnables expose input and output **schemas** to inspect the inputs and outputs:
|
||||||
@ -236,7 +236,7 @@ This is where information like log-probs and token usage may be stored.
|
|||||||
|
|
||||||
**`tool_calls`**
|
**`tool_calls`**
|
||||||
|
|
||||||
These represent a decision from an language model to call a tool. They are included as part of an `AIMessage` output.
|
These represent a decision from a language model to call a tool. They are included as part of an `AIMessage` output.
|
||||||
They can be accessed from there with the `.tool_calls` property.
|
They can be accessed from there with the `.tool_calls` property.
|
||||||
|
|
||||||
This property returns a list of `ToolCall`s. A `ToolCall` is a dictionary with the following arguments:
|
This property returns a list of `ToolCall`s. A `ToolCall` is a dictionary with the following arguments:
|
||||||
@ -256,6 +256,8 @@ This represents a message with role "tool", which contains the result of calling
|
|||||||
- a `tool_call_id` field which conveys the id of the call to the tool that was called to produce this result.
|
- a `tool_call_id` field which conveys the id of the call to the tool that was called to produce this result.
|
||||||
- an `artifact` field which can be used to pass along arbitrary artifacts of the tool execution which are useful to track but which should not be sent to the model.
|
- an `artifact` field which can be used to pass along arbitrary artifacts of the tool execution which are useful to track but which should not be sent to the model.
|
||||||
|
|
||||||
|
With most chat models, a `ToolMessage` can only appear in the chat history after an `AIMessage` that has a populated `tool_calls` field.
|
||||||
|
|
||||||
#### (Legacy) FunctionMessage
|
#### (Legacy) FunctionMessage
|
||||||
|
|
||||||
This is a legacy message type, corresponding to OpenAI's legacy function-calling API. `ToolMessage` should be used instead to correspond to the updated tool-calling API.
|
This is a legacy message type, corresponding to OpenAI's legacy function-calling API. `ToolMessage` should be used instead to correspond to the updated tool-calling API.
|
||||||
|
Loading…
Reference in New Issue
Block a user