LangChain - Dynamic Routing - Retrieve data from different databases

In this video I will show you how to perform dynamic routing with langchain. Not all data should be stored into a vectorstore. Tabular data is preferably stored in a simple SQL Table. How can we work with data from multiple sources? This is what you will learn in this video
Code: github.com/Coding-Crashkurse/...
Timestamps:
0:00 Introduction
1:02 RAG-Chain
4:25 SQL-Chain
7:12 Router-Chain

Пікірлер: 13

  • @chregano
    @chregano3 ай бұрын

    Thanks for this! How would you recommend handling a non-trivial schema with 50/60 tables with relations between them?

  • @codingcrashcourses8533

    @codingcrashcourses8533

    3 ай бұрын

    Just dont. Llms can not handle These kind of complexity (yet)

  • @yazanrisheh5127
    @yazanrisheh51273 ай бұрын

    Thanks for the video! I have 3 questions: 1)Can you explain the def route(info) function? I'm a bit confused. 2)Also, what if my file that I wanna talk to in natural language consists pdfs and tables? Should I store that in vectorstore? For example a research paper 3) Instead of having several templates where 1 executers sql query and then the other converts it to natural language, couldn't you have used the python agent which executes the SQL commands directly and displays the answer? I thought of it in terms if you had 1000+ users and it would cost time/money if you are passing through multiple templates. What do you think?

  • @yashthakkar2629

    @yashthakkar2629

    Ай бұрын

    Did you find the solution if so please let me know. I am working on something similar to this

  • @yazanrisheh5127

    @yazanrisheh5127

    Ай бұрын

    @@yashthakkar2629 On which exactly

  • @khushipitroda385
    @khushipitroda3853 ай бұрын

    Hello, I have query related Chromadb, langchain and python, I want to extract all data from chromadb and put it in qdrant, for that ive to use get method, but the problem is my data is very large, i cant extract in a variable it'll crash a memory, is there any way we can fetch the data (embeddings as well as metadata) from chroamadb? Thanks :) result = vector_db.get(include=["embeddings","metadatas", "documents"])

  • @RobertoFabrizi
    @RobertoFabrizi3 ай бұрын

    Thank you for the video. I have one question, because in my example it didn't work out of the box like it did for you. In your example, you ask for the most expensive "dessert", yet in the query you got back category = 'Dessert'. Why did it automatically uppercase the D for you? Dessert is not in the schema, only the category column is, so how did it figure it out? In general though, since you can't rely on how people write things, this seems to require a much more complex prompt that normalizes the input somehow (for example something like always uppercase every value passed in where conditions)

  • @codingcrashcourses8533

    @codingcrashcourses8533

    3 ай бұрын

    I recommend to always use .lower() to prevent being casesenstive. Would be better :)

  • @elleryleungnews
    @elleryleungnews3 ай бұрын

    Thanks for this example. But I have a question: Let's say I want to build a Business analyst AI, and use database as data source. Now the SQL response is large (e.g. over 1 mil record), it would not be possible to put it in the prompt like that, correct? Then how to solve this problem if I don't vectorise the data and put it in vector store in advance? Thank you.

  • @codingcrashcourses8533

    @codingcrashcourses8533

    3 ай бұрын

    You need some aggregations functions or whatever, but you can´t just put this into the context window of an AI.

  • @JoEl-jx7dm
    @JoEl-jx7dm3 ай бұрын

    Let me get this straight sorry, the queryies inputed by the user will be embeded into vectors and be stored in the vextordb along with it, It rags through your original db for retrieving the answer to the inputed query?

  • @codingcrashcourses8533

    @codingcrashcourses8533

    3 ай бұрын

    No - the user queries are not stored. The queries are just executed as they are. Plain SQL against Postgres

  • @JoEl-jx7dm

    @JoEl-jx7dm

    3 ай бұрын

    just give me a simple walkthrough for this, suppose my store got a DB, I would like to retrieve basic existing general information from the db using natural language and i would also like to understand insights from my db to increase sales for my store , so basically I would need a live running db for my store along with a rag system to continuous query about insights from my db also an agent to retrieve some web information that could actually help me increase my sales Theme - Tshirt store Eg: Human: Hey db, what brand tshirts do we sell App: we sell x,y,z tshirts Human: what's the most sold tshirt this month? And what's the profit we generated? App: x tshirt and y profit Human: If I want to increase my sales by x %, what specific brand tshirts should i stock up for this month more than usual? ..... Also retrieve some trending print tshirt I could use to sell to attract more people? How would I achieve something like this, I just need a basic idea