LangChain SQL Database agent with OpenAI to query PostgreSQL

preview_player
Показать описание
In this video we discover how to set up the LangChain SQL Database Agent with PostgreSQL and OpenAI using LangChain.

"allowing you to automate essential database operations, streamline workflows, and boost productivity. Learn the best practices for configuring and customizing the agent, empowering you to tailor its behaviour according to your specific requirements."

Tip:
------
SQLDatabaseToolkit(db=db,llm=llm)

Code on GitHub:
--------------------------

Help fund my side project:
--------------------------------------------

🍺 If you want a fast VPS server with Python installed check out :

🦜 LangChain Playlist 🦜

Into web scraping?
-------------------------------
◼️ Coupon Code: DRPI10

-------------------------------------------------------------------------

Thumbs up yeah? (cos Algos..)

#OpenAI #SQLDatabaseAgent #langchain
Рекомендации по теме
Комментарии
Автор

I get the sense that we are a long, long way from this being usable with schemas you'd find in the real world.

gridplan
Автор

Since there are many things that are done and work very well in colab but when you take them to VSC they don't. Please can you implement in VSC. Thanks. By the way, excellent the way you develop the themes inside the video!!!

cristiancornacchiola
Автор

Good queston.Maybe try regex ? eg matches = re.findall(Action) from the response, - maybe if anyone else reads this they can suggest another way?

python
Автор

Hi there- thanks for this video!
Is it possible to use retrievers and condensers with the sql connector? I know it the pdf document loaders you’re able to find only the relevant text using a retriever, condense it to reduce token count and send that as context to the LLM. Perhaps that would save on cost?

Also, I’m guessing that using memory to store indexes of your data in something like pinecone is useless with a database because data is always changing- is that correct?

Gugmi
Автор

Thank you for this video. One question though, does this mean the data is being sent to openai for it to process, I mean from privacy perspective this is really concerning

RadhouaneANIBA
Автор

Can you please tell me how to resolve the prompt length issue

sumeetracharla
Автор

The database was hosted on your device and you ran the code on Colab or something like that? It’d be great if it connects with no issue to a local database.

usoppgostoso
Автор

Like to ask why some logic is in python file and some in Jupyter notebook?

MrNiceseb
Автор

the default schema is the public, if i want to connect to my custom schema like 'my_schema', what should i do ? thanks a lot!

zzz-qews
Автор

will this work for large amount of data as well? How will it take in account such a big context?

pradyumnjain
Автор

Great video!
I have a couple of questions, if that's OK.
1. What are the versions of langchain and openai that you are using? I am trying to run the SQL Agent on a SQLite database and I keep running into this error,
AuthenticationError: <empty message>

2. At the beginning of the video you mentioned that the SQL Agent uses up a lot OpenAI credits. Do you have an approximate value for how many credits it uses up? Is it definitely more than one request per run?

minurapunchihewa
Автор

I got this error ValueError: Invalid header value b'Bearer API

darlynludena
Автор

How use open-source LLM s like private gpt gpt4all vicuna

SMCGPRA
Автор

How can I get only the SQL query and not the summarized response that it provides?

capeandcode
Автор

Can it generate the visualizations as well?

nishantkumar-lwce