mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-02 14:28:46 +02:00
Fixup some syntax issues in docstrings (#483)
This commit is contained in:
@@ -274,7 +274,7 @@ def create_react_agent(
|
||||
... ])
|
||||
>>> def modify_messages(messages: list):
|
||||
... # You can do more complex modifications here
|
||||
... return prompt.invoke(messages=messages)
|
||||
... return prompt.invoke({"messages": messages})
|
||||
>>>
|
||||
>>> app = create_react_agent(model, tools, messages_modifier=modify_messages)
|
||||
>>> inputs = {"messages": [("user", "What's your name? And what's the weather in SF?")]}
|
||||
|
||||
@@ -55,6 +55,7 @@ class ToolExecutor(RunnableCallable):
|
||||
|
||||
Examples:
|
||||
|
||||
```pycon
|
||||
>>> from langchain_core.tools import tool
|
||||
>>> from langgraph.prebuilt.tool_executor import ToolExecutor, ToolInvocation
|
||||
...
|
||||
@@ -71,14 +72,17 @@ class ToolExecutor(RunnableCallable):
|
||||
>>> invocation = ToolInvocation(tool="search", tool_input="What is the capital of France?")
|
||||
>>> result = executor.invoke(invocation)
|
||||
>>> print(result)
|
||||
Output: "Searching for: What is the capital of France?"
|
||||
"Searching for: What is the capital of France?"
|
||||
```
|
||||
|
||||
```pycon
|
||||
>>> invocation = ToolInvocation(
|
||||
... tool="nonexistent", tool_input="What is the capital of France?"
|
||||
... )
|
||||
>>> result = executor.invoke(invocation)
|
||||
>>> print(result)
|
||||
Output: "nonexistent is not a valid tool, try one of [search]."
|
||||
"nonexistent is not a valid tool, try one of [search]."
|
||||
```
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
||||
@@ -139,8 +139,8 @@ def tools_condition(
|
||||
>>> graph_builder.add_node("chatbot", llm.bind_tools(tools))
|
||||
>>> graph_builder.add_edge("tools", "chatbot")
|
||||
>>> graph_builder.add_conditional_edges(
|
||||
>>> "chatbot", tools_condition
|
||||
>>> )
|
||||
... "chatbot", tools_condition
|
||||
... )
|
||||
>>> graph_builder.set_entry_point("chatbot")
|
||||
>>> graph = graph_builder.compile()
|
||||
>>> graph.invoke([("user", "What's 329993 divided by 13662?")])
|
||||
|
||||
Reference in New Issue
Block a user