mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-31 16:39:20 +00:00
docs: agent prompt docs (#16105)
This commit is contained in:
parent
84bf5787a7
commit
2454fefc53
@ -19,10 +19,7 @@ def create_json_chat_agent(
|
||||
Args:
|
||||
llm: LLM to use as the agent.
|
||||
tools: Tools this agent has access to.
|
||||
prompt: The prompt to use, must have input keys:
|
||||
`tools`: contains descriptions and arguments for each tool.
|
||||
`tool_names`: contains all tool names.
|
||||
`agent_scratchpad`: contains previous agent actions and tool outputs.
|
||||
prompt: The prompt to use. See Prompt section below for more.
|
||||
|
||||
Returns:
|
||||
A Runnable sequence representing an agent. It takes as input all the same input
|
||||
@ -58,7 +55,14 @@ def create_json_chat_agent(
|
||||
}
|
||||
)
|
||||
|
||||
Creating prompt example:
|
||||
Prompt:
|
||||
|
||||
The prompt must have input keys:
|
||||
* `tools`: contains descriptions and arguments for each tool.
|
||||
* `tool_names`: contains all tool names.
|
||||
* `agent_scratchpad`: must be a MessagesPlaceholder. Contains previous agent actions and tool outputs as messages.
|
||||
|
||||
Here's an example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -239,8 +239,7 @@ def create_openai_functions_agent(
|
||||
so either be an OpenAI model that supports that or a wrapper of
|
||||
a different model that adds in equivalent support.
|
||||
tools: Tools this agent has access to.
|
||||
prompt: The prompt to use, must have input key `agent_scratchpad`, which will
|
||||
contain agent action and tool output messages.
|
||||
prompt: The prompt to use. See Prompt section below for more.
|
||||
|
||||
Returns:
|
||||
A Runnable sequence representing an agent. It takes as input all the same input
|
||||
@ -278,7 +277,13 @@ def create_openai_functions_agent(
|
||||
}
|
||||
)
|
||||
|
||||
Creating prompt example:
|
||||
Prompt:
|
||||
|
||||
The agent prompt must have an `agent_scratchpad` key that is a
|
||||
``MessagesPlaceholder``. Intermediate agent actions and tool output
|
||||
messages will be passed in here.
|
||||
|
||||
Here's an example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -20,8 +20,8 @@ def create_openai_tools_agent(
|
||||
Args:
|
||||
llm: LLM to use as the agent.
|
||||
tools: Tools this agent has access to.
|
||||
prompt: The prompt to use, must have input key `agent_scratchpad`, which will
|
||||
contain agent action and tool output messages.
|
||||
prompt: The prompt to use. See Prompt section below for more on the expected
|
||||
input variables.
|
||||
|
||||
Returns:
|
||||
A Runnable sequence representing an agent. It takes as input all the same input
|
||||
@ -57,7 +57,13 @@ def create_openai_tools_agent(
|
||||
}
|
||||
)
|
||||
|
||||
Creating prompt example:
|
||||
Prompt:
|
||||
|
||||
The agent prompt must have an `agent_scratchpad` key that is a
|
||||
``MessagesPlaceholder``. Intermediate agent actions and tool output
|
||||
messages will be passed in here.
|
||||
|
||||
Here's an example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -20,11 +20,7 @@ def create_react_agent(
|
||||
Args:
|
||||
llm: LLM to use as the agent.
|
||||
tools: Tools this agent has access to.
|
||||
prompt: The prompt to use, must have input keys:
|
||||
`tools`: contains descriptions and arguments for each tool.
|
||||
`tool_names`: contains all tool names.
|
||||
`agent_scratchpad`: contains previous agent actions and tool outputs.
|
||||
|
||||
prompt: The prompt to use. See Prompt section below for more.
|
||||
|
||||
Returns:
|
||||
A Runnable sequence representing an agent. It takes as input all the same input
|
||||
@ -59,7 +55,14 @@ def create_react_agent(
|
||||
}
|
||||
)
|
||||
|
||||
Creating prompt example:
|
||||
Prompt:
|
||||
|
||||
The prompt must have input keys:
|
||||
* `tools`: contains descriptions and arguments for each tool.
|
||||
* `tool_names`: contains all tool names.
|
||||
* `agent_scratchpad`: contains previous agent actions and tool outputs as a string.
|
||||
|
||||
Here's an example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -121,7 +121,12 @@ def create_self_ask_with_search_agent(
|
||||
|
||||
agent_executor.invoke({"input": "hi"})
|
||||
|
||||
Create prompt example:
|
||||
Prompt:
|
||||
|
||||
The prompt must have input key `agent_scratchpad` which will
|
||||
contain agent actions and tool outputs as a string.
|
||||
|
||||
Here's an example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -158,10 +158,7 @@ def create_structured_chat_agent(
|
||||
Args:
|
||||
llm: LLM to use as the agent.
|
||||
tools: Tools this agent has access to.
|
||||
prompt: The prompt to use, must have input keys
|
||||
`tools`: contains descriptions and arguments for each tool.
|
||||
`tool_names`: contains all tool names.
|
||||
`agent_scratchpad`: contains previous agent actions and tool outputs.
|
||||
prompt: The prompt to use. See Prompt section below for more.
|
||||
|
||||
Returns:
|
||||
A Runnable sequence representing an agent. It takes as input all the same input
|
||||
@ -197,7 +194,14 @@ def create_structured_chat_agent(
|
||||
}
|
||||
)
|
||||
|
||||
Creating prompt example:
|
||||
Prompt:
|
||||
|
||||
The prompt must have input keys:
|
||||
* `tools`: contains descriptions and arguments for each tool.
|
||||
* `tool_names`: contains all tool names.
|
||||
* `agent_scratchpad`: contains previous agent actions and tool outputs as a string.
|
||||
|
||||
Here's an example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -152,7 +152,13 @@ def create_xml_agent(
|
||||
}
|
||||
)
|
||||
|
||||
Creating prompt example:
|
||||
Prompt:
|
||||
|
||||
The prompt must have input keys:
|
||||
* `tools`: contains descriptions for each tool.
|
||||
* `agent_scratchpad`: contains previous agent actions and tool outputs as an XML string.
|
||||
|
||||
Here's an example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user