from langchain.agents import load_tools
from langchain.agents import initialize_agent
from langchain.agents import AgentType

from langchain_app.models.vicuna_request_llm import VicunaLLM

# First, let's load the language model we're going to use to control the agent.
llm = VicunaLLM()

# Next, let's load some tools to use. Note that the `llm-math` tool uses an LLM, so we need to pass that in.
tools = load_tools(["python_repl"], llm=llm)

# Finally, let's initialize an agent with the tools, the language model, and the type of agent we want to use.
agent = initialize_agent(
    tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True
)

# Now let's test it out!
agent.run("""Write a Python script that prints 'Hello, world!""")

langchain_app.models.vicuna_request_llm.VicunaLLM langchain.agents.initialize_agent langchain.agents.load_tools
[((275, 286), 'langchain_app.models.vicuna_request_llm.VicunaLLM', 'VicunaLLM', ([], {}), '()\n', (284, 286), False, 'from langchain_app.models.vicuna_request_llm import VicunaLLM\n'), ((405, 441), 'langchain.agents.load_tools', 'load_tools', (["['python_repl']"], {'llm': 'llm'}), "(['python_repl'], llm=llm)\n", (415, 441), False, 'from langchain.agents import load_tools\n'), ((562, 653), 'langchain.agents.initialize_agent', 'initialize_agent', (['tools', 'llm'], {'agent': 'AgentType.ZERO_SHOT_REACT_DESCRIPTION', 'verbose': '(True)'}), '(tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,\n    verbose=True)\n', (578, 653), False, 'from langchain.agents import initialize_agent\n')]