mirror of
https://github.com/Mintplex-Labs/langchain-python.git
synced 2026-07-21 00:35:23 -04:00
82baecc892
This PR adds * `ZeroShotAgent.as_sql_agent`, which returns an agent for interacting with a sql database. This builds off of `SQLDatabaseChain`. The main advantages are 1) answering general questions about the db, 2) access to a tool for double checking queries, and 3) recovering from errors * `ZeroShotAgent.as_json_agent` which returns an agent for interacting with json blobs. * Several examples in notebooks --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
10 lines
513 B
Python
10 lines
513 B
Python
# flake8: noqa
|
|
|
|
PREFIX = """You are an agent designed to write and execute python code to answer questions.
|
|
You have access to a python REPL, which you can use to execute python code.
|
|
If you get an error, debug your code and try again.
|
|
Only use the output of your code to answer the question.
|
|
You might know the answer without running any code, but you should still run the code to get the answer.
|
|
If it does not seem like you can write code to answer the question, just return "I don't know" as the answer.
|
|
"""
|