The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
improve agent templates (#12528)
Harrison Chasef35a65124ae6
diff --git a/templates/docs/INDEX.md b/templates/docs/INDEX.mdindex c19cd7eb03..aeded807a6 100644--- a/templates/docs/INDEX.md+++ b/templates/docs/INDEX.md@@ -56,8 +56,8 @@ These templates use OSS models.Extract data in a structured format- [Extraction Using OpenAI Functions](../extraction-openai-functions): Extract information from text using OpenAI Function Calling.- [Extraction Using Anthropic Functions](../extraction-anthropic-functions): Extract information from text using a LangChain wrapper around the Anthropic endpoints intended to simulate function calling.-- [Extract BioTech Plate Data](../plate-chain): Extract plate data from messy Excel spreadsheets into a more normalized format.+- [Extract BioTech Plate Data](../plate-chain): Extract microplate data from messy Excel spreadsheets into a more normalized format.## 🤖 Agents- [OpenAI Functions Agent](../openai-functions-agent): Build a chatbot that can take actions. Uses OpenAI function calling and Tavily.-- [XML Agent](../xml-agent): Build a chatbot that can take actions. Uses Anthropic and You.com.\ No newline at end of file+- [XML Agent](../xml-agent): Build a chatbot that can take actions. Uses Anthropic and You.com.diff --git a/templates/openai-functions-agent/openai_functions_agent/agent.py b/templates/openai-functions-agent/openai_functions_agent/agent.pyindex 1c06be2d94..98eb445c69 100644--- a/templates/openai-functions-agent/openai_functions_agent/agent.py+++ b/templates/openai-functions-agent/openai_functions_agent/agent.py@@ -11,19 +11,24 @@ from langchain.tools.render import format_tool_to_openai_functionfrom langchain.tools.tavily_search import TavilySearchResultsfrom langchain.utilities.tavily_search import TavilySearchAPIWrapper-# Fake Tool+# Create the toolsearch = TavilySearchAPIWrapper()-tavily_tool = TavilySearchResults(api_wrapper=search)+description = """"A search engine optimized for comprehensive, accurate, \+and trusted results. Useful for when you need to answer questions \+about current events or about recent information. \+Input should be a search query. \+If the user is asking about something that you don't know about, \+you should probably use this tool to see if that can provide any information."""+tavily_tool = TavilySearchResults(api_wrapper=search, description=description)tools = [tavily_tool]llm = ChatOpenAI(temperature=0)+assistant_system_message = """You are a helpful assistant. \+Use tools (only if necessary) to best answer the users questions."""prompt = ChatPromptTemplate.from_messages([- (- "system",- "You are very powerful assistant, but bad at calculating lengths of words.",- ),+ ("system", assistant_system_message),MessagesPlaceholder(variable_name="chat_history"),("user", "{input}"),MessagesPlaceholder(variable_name="agent_scratchpad"),diff --git a/templates/xml-agent/xml_agent/agent.py b/templates/xml-agent/xml_agent/agent.pyindex 0c52d3ffc3..a7eb97d3fd 100644--- a/templates/xml-agent/xml_agent/agent.py+++ b/templates/xml-agent/xml_agent/agent.py@@ -21,7 +21,6 @@ def _format_chat_history(chat_history: List[Tuple[str, str]]):model = ChatAnthropic(model="claude-2")-tools = [DuckDuckGoSearchRun()]prompt = conversational_prompt.partial(