Relative Content

Tag Archive for pythonartificial-intelligencelangchainlarge-language-model

Fake LLM in Langchain

from langchain.agents import initialize_agent from langchain.llms.fake import FakeListLLM from langchain.agents import AgentType from langchain_experimental.tools import PythonAstREPLTool res = [“Action: Python REPLnAction Input: print(2.2 + 2.22)”, “Final Answer: 4.42”] llm = FakeListLLM(responses=res) agent = initialize_agent(tools=[PythonAstREPLTool()], llm=llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True ) agent.run(“what is 2.2 + 2.22?”) What wrong in this code ? i am getting an error enter […]

How to tune agent _executor for better understanding of the database

I have a database in which I have connected an agent too. However, I have noticed that it sometimes gets confused between whether or not it should return a column ID or persons first name when asked “which person sold the most….?” Is there a way to tune/adjust the create_sql_agent from langchain.agents at which I can tell the agent to not return column ID but return first and last name based on questions structured like that?