I have a simple SQLagent which queries a database with id and email address on a table. I want to check if there is a matching email and reply with id. if no match reply with none.
If there is a match, it works fine, but if there is no match, but there is a closer matching email, it returns the random value from the ID column. For example if there is a match for [email protected] it works, but if I pass in myFirstName.LastnamA@mydomain.com it will return a random ID. Any idea on how to fix this?
``*dburi = "sqlite:///data/users.db"
db = SQLDatabase.from_uri(dburi)
toolkit = SQLDatabaseToolkit(db=db, llm=OpenAI(temperature=0))
agent_executor = create_sql_agent(
llm=OpenAI(temperature=0),
toolkit=toolkit,
verbose=True,
agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
)
agent_executor.run("What is the id for email is exactly [email protected]. I want 100% match ignoring the case. If you can not find it reply with NONE")*`
`
If there is a match, it works fine, but if there is no match, but there is a closer matching email, it returns the random value from the ID column. For example if there is a match for [email protected] it works, but if I pass in myFirstName.LastnamA@mydomain.com it will return a random ID.
I managed to change the query and sort this out. My new query is: