This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
agent_chain = initialize_agent(tools, | |
llm, | |
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, | |
verbose=True, | |
agent_kwargs={"format_instructions": "Use the following format: \n\n" | |
"Question: the input question you must answer \n" | |
"Thought: you should always think about what to do \n" | |
"Action: the action to take, should be one of [{tool_names}] " | |
"Action Input: the input to the action \n" | |
"Observation: the result of the action\n... " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
agent.run("Play the song Adieu of the Album Zeit from the band Rammstein!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from langchain.agents import AgentType, initialize_agent | |
from langchain.llms import OpenAI | |
llm = OpenAI(temperature=0) | |
agent = initialize_agent(tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from langchain.agents import Tool | |
tools = [ | |
Tool( | |
name="play_action", | |
func=play_a_song, | |
description="Useful when you want to play one song via the spotify api. " | |
"Try to find a single song that fits best to the prompt of the user! " | |
"This song should be the input to this tool in form of a comma " |