Robust Text-to-SQL With LangChain: Claude 3 vs GPT-4

  Рет қаралды 3,505

Rabbitmetrics

Rabbitmetrics

Күн бұрын

Generate advanced SQL with LLMs in seconds by building custom LangChain chains.
The code used in the video can be found here:
www.rabbitmetrics.com/chattin...
▬▬▬▬▬▬ V I D E O C H A P T E R S & T I M E S T A M P S ▬▬▬▬▬▬
0:00 The state of Chat-to-SQL
1:22 Connecting to a database (BigQuery) with LangChain
4:10 Using out-of-the-box SQL chains
6:42 Using out-of-the-box SQL agents
10:10 Managing Chat-to-SQL risk
13:02 Creating your own custom SQL chains

Пікірлер: 14
@kelvinadungosi1579
@kelvinadungosi1579 3 ай бұрын
Hi, great tutorial! How would you implement a chat fuctionality? where you can ask follow up questions??
@rabbitmetrics
@rabbitmetrics 3 ай бұрын
Thanks! I would use ChatMessageHistory to manage the conversation and catch the traceback - this is needed for more advanced queries.
@Shai_Di
@Shai_Di Ай бұрын
This is really interesting but I have some concerns about this method, I'd love to hear what you think about them: 1. We are always sending the entire schema as context. If we want to have a large dataset connected to this "application", we will waste a ton of tokens on that. The agent that LangChain built slowly decides which tables might be relevant, thus reducing the amount of tokens used as context. How would you approach something like this? 2. Sometimes, tables and column names might not be super intuitive to the LLM, and without sampling the data, it can assume properties, values or anything else. So this requires the user to review the query and make sure it makes sense, which is what we are kind of trying to prevent when we start using AI for queries. What do you think about adding a semi step that will somehow sample the relevant data?
@AndresAlarcon-bb9ql
@AndresAlarcon-bb9ql 3 ай бұрын
Hi, question, how do you configure it to use gemini-pro and not gpt-4?
@rabbitmetrics
@rabbitmetrics 3 ай бұрын
Hi, you install the LangChain integrations for Gemini pypi.org/project/langchain-google-genai/ then you import ChatGoogleGenerativeAI and define llm = ChatGoogleGenerativeAI(model="gemini-pro")
@AndresAlarcon-bb9ql
@AndresAlarcon-bb9ql 3 ай бұрын
@@rabbitmetrics I did it, but it doesn't work, it has this error: TypeError: Expected a Runnable, callable or dict. Instead got an unsupported type:
@rabbitmetrics
@rabbitmetrics 3 ай бұрын
@@AndresAlarcon-bb9ql you might be passing a string instead of a function in the RunnablePassthrough?
@TheBestgoku
@TheBestgoku 3 ай бұрын
THIS is function-calling but instead of a "json" u get a "sql query". Am i missing something?
@rabbitmetrics
@rabbitmetrics 3 ай бұрын
That is one way to think of it. But in this case LangChain is handling the parsing of the LLM output (note the "model.bind(stop=[" SQLResult:"])" in the chain). When you generate SQL or any other code you'll find that the code is often returned in quotes or with some text explaining the code. The trick is to minimize this by parsing the output in a suitable way.
@lionhuang9209
@lionhuang9209 3 ай бұрын
Where can we download the code file?
@rabbitmetrics
@rabbitmetrics 3 ай бұрын
There's a link below the video to the Colab notebook with code and written tutorial including how to generate the ecom tables
@SR-zi1pw
@SR-zi1pw 3 ай бұрын
What happens if he drops the table when hallucinating
@MaxwellHay
@MaxwellHay 3 ай бұрын
Read only role
@rabbitmetrics
@rabbitmetrics 3 ай бұрын
As mentioned, make sure to restrict access scope and permission.
Learn LangChain in 7 Easy Steps - Full Interactive Beginner Tutorial
41:37
LLMs will Transform Data Science - Here's How
25:04
Rabbitmetrics
Рет қаралды 4,9 М.
ОСКАР vs БАДАБУМЧИК БОЙ!  УВЕЗЛИ на СКОРОЙ!
13:45
Бадабумчик
Рет қаралды 6 МЛН
Why & When You Should Use Claude 3 Over ChatGPT
17:00
The AI Advantage
Рет қаралды 93 М.
Build an SQL Agent with Llama 3 | Langchain | Ollama
20:28
TheAILearner
Рет қаралды 4,9 М.
SQLite: How it works, by Richard Hipp
1:39:27
Prof. Dr. Jens Dittrich, Big Data Analytics
Рет қаралды 3,6 М.
High Performance (Realtime) RAG Chains: From Basic to Advanced
10:01
LangChain Agents: Simply Explained!
9:35
Rabbitmetrics
Рет қаралды 65 М.
MySQL database with PandasAI & Ollama & Streamlit
16:03
Tirendaz AI
Рет қаралды 6 М.
LangChain In Action: Real-World Use Case With Step-by-Step Tutorial
12:17
World’s Fastest Talking AI: Deepgram + Groq
11:45
Greg Kamradt (Data Indy)
Рет қаралды 40 М.
Building an Agent to Query a SQL Database and Analyze Data
26:21
iPhone 15 Pro в реальной жизни
24:07
HUDAKOV
Рет қаралды 422 М.
Худшие кожаные чехлы для iPhone
1:00
Rozetked
Рет қаралды 902 М.
Battery  low 🔋 🪫
0:10
dednahype
Рет қаралды 12 МЛН