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

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

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
@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?
@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.
@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.
@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?
@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.
Advanced SQL Generation with LangChain & Redis
11:19
Rabbitmetrics
Рет қаралды 2,5 М.
Personalizing LLMs: Step-by-Step with LangChain
20:04
Rabbitmetrics
Рет қаралды 4 М.
Mom's Unique Approach to Teaching Kids Hygiene #shorts
00:16
Fabiosa Stories
Рет қаралды 16 МЛН
Эффект Карбонаро и нестандартная коробка
01:00
История одного вокалиста
Рет қаралды 9 МЛН
Now THIS is entertainment! 🤣
00:59
America's Got Talent
Рет қаралды 38 МЛН
Learn LangChain in 7 Easy Steps - Full Interactive Beginner Tutorial
41:37
How I Made AI Assistants Do My Work For Me: CrewAI
19:21
Maya Akim
Рет қаралды 762 М.
Build an SQL Agent with Llama 3 | Langchain | Ollama
20:28
TheAILearner
Рет қаралды 4,8 М.
Why & When You Should Use Claude 3 Over ChatGPT
17:00
The AI Advantage
Рет қаралды 93 М.
LangChain In Action: Real-World Use Case With Step-by-Step Tutorial
12:17
LLMs will Transform Data Science - Here's How
25:04
Rabbitmetrics
Рет қаралды 4,9 М.
How to Build a Dashboard in Minutes with LLMs
10:40
Rabbitmetrics
Рет қаралды 11 М.
High Performance (Realtime) RAG Chains: From Basic to Advanced
10:01
Todos os modelos de smartphone
0:20
Spider Slack
Рет қаралды 58 МЛН
Как правильно выключать звук на телефоне?
0:17
Люди.Идеи, общественная организация
Рет қаралды 1,8 МЛН
Какой ноутбук взять для учёбы? #msi #rtx4090 #laptop #юмор #игровой #apple #shorts
0:18
iPhone socket cleaning #Fixit
0:30
Tamar DB (mt)
Рет қаралды 15 МЛН