You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
512 B
14 lines
512 B
from langchain.agents.agent_toolkits import create_python_agent
|
|
from langchain.tools.python.tool import PythonREPLTool
|
|
from langchain.python import PythonREPL
|
|
from langchain.llms.openai import OpenAI
|
|
|
|
OPENAI_API = "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"
|
|
|
|
agent_executor = create_python_agent(
|
|
llm=OpenAI(temperature=0, max_tokens=1000, openai_api_key=OPENAI_API),
|
|
tool=PythonREPLTool(),
|
|
verbose=True
|
|
)
|
|
agent_executor.run("Find the roots (zeros) if the quadratic function 3 * x**2 + 2*x - 1")
|