0

I am using LangChain to perform text-to-SQL procedures like so:

db = SQLDatabase.from_uri(xx)

db_chain = SQLDatabaseChain(llm=llm, database=db, verbose=True)

It's working quite well, but I'm wondering if there is a way to incorporate data from ChatGPT's general knowledge base into the results. For instance if I asked "Which states have the fastest sales growth?," could I attach data about the population of each state (not in my database) from the general ChatGPT knowledge base?

I've tried tuning the prompt with things like "use ChatGPT's general knowledge to attach population data," but it just looks for a non-existent table called "state_population" in my database.

Ben Wilson
  • 2,271
  • 3
  • 26
  • 35
  • 1
    You can set up an agent with db_chain as one tool. You can make another tool with web search, or just a generic LLM chain. If you write good descriptions for the tools, the agent should be able to figure out when to hit your db vs when to go for general knowledge – andrew_reece May 11 '23 at 23:39

0 Answers0