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?
@kelvinadungosi15794 ай бұрын
Hi, great tutorial! How would you implement a chat fuctionality? where you can ask follow up questions??
@rabbitmetrics4 ай бұрын
Thanks! I would use ChatMessageHistory to manage the conversation and catch the traceback - this is needed for more advanced queries.
@TheBestgoku4 ай бұрын
THIS is function-calling but instead of a "json" u get a "sql query". Am i missing something?
@rabbitmetrics4 ай бұрын
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-bb9ql4 ай бұрын
Hi, question, how do you configure it to use gemini-pro and not gpt-4?
@rabbitmetrics4 ай бұрын
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-bb9ql4 ай бұрын
@@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:
@rabbitmetrics4 ай бұрын
@@AndresAlarcon-bb9ql you might be passing a string instead of a function in the RunnablePassthrough?
@SR-zi1pw5 ай бұрын
What happens if he drops the table when hallucinating
@MaxwellHay5 ай бұрын
Read only role
@rabbitmetrics4 ай бұрын
As mentioned, make sure to restrict access scope and permission.
@lionhuang92095 ай бұрын
Where can we download the code file?
@rabbitmetrics5 ай бұрын
There's a link below the video to the Colab notebook with code and written tutorial including how to generate the ecom tables