Fixup some syntax issues in docstrings (#483)

This commit is contained in:
William FH
2024-05-16 10:17:10 -07:00
committed by GitHub
parent 9da2c7fecc
commit 347e546c84
3 changed files with 9 additions and 5 deletions
+1 -1
View File
@@ -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?")]}
+6 -2
View File
@@ -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__(
+2 -2
View File
@@ -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?")])