import os

os.environ["LANGCHAIN_TRACING"] = "true"

from langchain import OpenAI
from langchain.agents import initialize_agent, AgentType
from langchain.llms import OpenAI
from langchain.agents import initialize_agent, Tool
from langchain.agents import AgentType

def multiplier(a, b):
    return a / b


def parsing_multiplier(string):
    a, b = string.split(",")
    return multiplier(int(a), int(b))

llm = OpenAI(temperature=0)
tools = [
    Tool(
        name="Multiplier",
        func=parsing_multiplier,
        description="useful for when you need to multiply two numbers together. The input to this tool should be a comma separated list of numbers of length two, representing the two numbers you want to multiply together. For example, `1,2` would be the input if you wanted to multiply 1 by 2.",
    )
]
agent = initialize_agent(
    tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True
)

agent.run("3 times four?")

langchain.agents.initialize_agent langchain.llms.OpenAI langchain.agents.Tool
[((412, 433), 'langchain.llms.OpenAI', 'OpenAI', ([], {'temperature': '(0)'}), '(temperature=0)\n', (418, 433), False, 'from langchain.llms import OpenAI\n'), ((826, 917), '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', (842, 917), False, 'from langchain.agents import initialize_agent, Tool\n'), ((448, 794), 'langchain.agents.Tool', 'Tool', ([], {'name': '"""Multiplier"""', 'func': 'parsing_multiplier', 'description': '"""useful for when you need to multiply two numbers together. The input to this tool should be a comma separated list of numbers of length two, representing the two numbers you want to multiply together. For example, `1,2` would be the input if you wanted to multiply 1 by 2."""'}), "(name='Multiplier', func=parsing_multiplier, description=\n    'useful for when you need to multiply two numbers together. The input to this tool should be a comma separated list of numbers of length two, representing the two numbers you want to multiply together. For example, `1,2` would be the input if you wanted to multiply 1 by 2.'\n    )\n", (452, 794), False, 'from langchain.agents import initialize_agent, Tool\n')]