Build AI sql assistant with LLM. LanghChain tutorial. Streamlit Tutorial. LLM Tutorial . ChatGPT.

  Рет қаралды 20,024

TechLycan

TechLycan

8 ай бұрын

This video showcases how to build your personal AI sql assistant which takes user input in natural language and internally prepares sql for it and returns the final results post execution in database. #ai #llm #sql #database #datascience #artificialintelligence #largelanguagemodels #langchain #streamlit #python #pythonprogramming #llmapplication #robot #robotics #entrepreneur #enterprisesolutions #innovation #innovative #promptengineer #promptengineering

Пікірлер: 42
@techlycan
@techlycan 5 ай бұрын
Here is the github link . update the app_secrets.py file. github.com/pawanrawat0926/ai_sql_assistant
@asdasdaa7063
@asdasdaa7063 5 ай бұрын
pin this bro
@deeplearning7097
@deeplearning7097 8 ай бұрын
Great work, looking forward to more videos from you.
@Manjubhati2807
@Manjubhati2807 8 ай бұрын
Thanks for making such knowledgeable videos👍
@saiveeramalla5507
@saiveeramalla5507 4 ай бұрын
Also can you make seperate tab in which the results you got can be plotted may be like piechart or graph dynamically based on user prompt
@user-qu3vl2zg5q
@user-qu3vl2zg5q 3 ай бұрын
Hello thanks for sharing the video. I am currently working with MongoDB databases. Could you please create a similar video on MongoDB? Unfortunately, I haven't found a MongoDB agent in the Lang chain, so I was wondering if you could help me with that.
@AliAlias
@AliAlias 4 ай бұрын
Thanks very nice 🌹, How to use open source LLM from hugging face locally using ctransformer or lamacpp library with Pandas Ai in offline mode? for example codellama or pandalytic gguf type
@polly28-9
@polly28-9 3 күн бұрын
How about huge database? We send the huge schema of the huge database with the initial prompt, which costs a lot? What will be the solution for huge database?
@leedsshri
@leedsshri 3 ай бұрын
Hello, is it possible to connect to Teradata database from Langchain ? If yes, could you pls show that ?
@sachinprakash2525
@sachinprakash2525 2 ай бұрын
Please share the link for prompt creation and load process video
@channelShutter005
@channelShutter005 4 ай бұрын
Hey, Thanks for this video. Could you please tell me how you got the Analytics database in this video?
@techlycan
@techlycan 4 ай бұрын
You can simply create database and schemas using create statements
@kauserperwez1556
@kauserperwez1556 3 ай бұрын
In one of the column in database, if I have personal information that I want to mask and show in results, can someone please explain how do I do that
@manaskalra1570
@manaskalra1570 5 ай бұрын
Hi Great project Can you explain me how can I change the prompt? like what if I want it to generate queries for a different db?
@manaskalra1570
@manaskalra1570 5 ай бұрын
also how do we import execute_sf_query? is that a predefined function? somewhere in the project?
@the_student_chef
@the_student_chef 5 ай бұрын
Can you please add the conversational memory to the sql generator using ConversationBufferMemory and post the video or code (in the git repo). Also, if for any reason there are error(s) in the generated SQL Queries, can you get OpenAI to regenerate the query and solve the errors by providing some additional context if necessary ?
@techlycan
@techlycan 5 ай бұрын
when used with streamlit the Langchain's conversation memory is not directly usable as the it get refreshed with every run. The work around is to use streamlit's session object for the same purpose. Please checkout my video below to see it in implementation. kzbin.info/www/bejne/pJKcfZeAfLFqeJo the only way to avoid wrong sql generation i think is to take the llm version which is fine tuned over sql. In this app you can add features to add prompt, output and label to generate training data for your specific schema and use it later.
@the_student_chef
@the_student_chef 5 ай бұрын
hi @@techlycan thanks for the help .. this has worked .. can you help me with how to implement a new chat session using session state.. it,s like the old session will be in place and user can use a new session by clicking on a button called "New Chat" also with reference to your reply above, can you suggest me the best llm model which is fine tuned in SQL query generation ?
@the_student_chef
@the_student_chef 5 ай бұрын
how have you created the database in snowflake ? is there any video for the snowflake analytics db creation ?
@techlycan
@techlycan 5 ай бұрын
Its simple to create . Use snowsight UI to create DB and Schema.
@GeriFitrah
@GeriFitrah 3 ай бұрын
i have question, if user want ask something outside the database for ex user ask USD rate in january 2020, can it handle with same prompt ? or we need to make another prompt to handle question outside the database ? thx for the tutorial
@techlycan
@techlycan 3 ай бұрын
@newg1203 This prompt has a limited scope. If you increase the scope then prompt needs to be modified accordingly. Moreover you may need to pass on further information to LLM to help writing queries. well defined catalogue or RAG could be used to enhance the functionality.
@anagai
@anagai Ай бұрын
How do you get it to display result in nice table format like that. I have json output and just displays the json
@techlycan
@techlycan Ай бұрын
Convert the query output in Data frame and then simply display it. Note that my DB here is RDBMS.
@kamilpatel3195
@kamilpatel3195 2 ай бұрын
This is gonna working with smaller database smoothly and very effeciently but when we talk about the bigger database or the enterprise level database then this code is break in to Execute the simple query. I have tried this method earlier and it was not work well with the bigger database.
@techlycan
@techlycan 2 ай бұрын
Yes but I think you are missing the use case here.... Tech PPL do not need this as they are proficient in SQL already....it's usually the business PPL who face challenges when they need to interact with tables....and for reporting the tables are usually summarized tables limited in count
@renaudgg
@renaudgg 4 ай бұрын
when you wrote this line: llm = OpenAI(temperature=0.9) what is the default model it uses? if instead I write: llm = OpenAI(model="gpt-4", temperature=0.9) im getting error: Error: Error code: 404 - {'error': {'message': 'This is a chat model and not supported in the v1/completions endpoint. Did you mean to use v1/chat/completions?', 'type': 'invalid_request_error', 'param': 'model', 'code': None}} how can we make it so that its gpt4?
@techlycan
@techlycan 4 ай бұрын
Your API key defines the model which you would have generated in openai portal... This section only define the properties and not model.
@renaudgg
@renaudgg 4 ай бұрын
@@techlycan ok I see, but when I create a new key in my portal, it just ask my for a name, i dont even have a chocie of a model? i dont get it....
@techlycan
@techlycan 4 ай бұрын
@@renaudgg I have not tried gpt4 key as of yet but I think the portal provides documentation to generate it....it's not free so may be you need to subscribe first and then you may get the option to create it.
@waseem1162
@waseem1162 6 ай бұрын
is that prompts.yml file necessary? what if I have to query on my SQLite.db? how i will write that all stuff in that yml file.?
@techlycan
@techlycan 6 ай бұрын
Prompt is mandatory storing in a seperate file promotes modular approach. You can store at the same place like I have in other videos . To make call to SQL lite you just have to change the connection to SQL lite instead of snowflake.
@waseem1162
@waseem1162 6 ай бұрын
@@techlycan yes, i got you. but my point is how I will write yml file content for my sqlite database? i am just confused about that. . where from will i grab that yml file data to write and feed to LLM to help for generation of better results.?.
@techlycan
@techlycan 6 ай бұрын
@@waseem1162 prompts.yml file gives the context to LLM to convert natural language into sql. You can use the same yml for any database just update the table structures as in your db and sql functions in prompt's sample queries if required. Connecting to database and execute query is done via sql_execution.py . That file you need to update with configuration to connect to your database of choice.
@waseem1162
@waseem1162 6 ай бұрын
@@techlycan got it, brother. thanks you
@waseem1162
@waseem1162 5 ай бұрын
@@techlycan brother, look what if i have Microsoft SQL database, then how i can chat with that? means my question: What are the total number of employees in the company? ChatGPT+LLM: should convert this to SQL query, send to DB and answer me that response. Please how i can achieve that?
@adarshkumarsingh4869
@adarshkumarsingh4869 5 ай бұрын
Github for codes?
@techlycan
@techlycan 5 ай бұрын
Pinned comment
@MAVAJAVA369
@MAVAJAVA369 6 ай бұрын
Github repo please??😢
@techlycan
@techlycan 5 ай бұрын
added in comments
@yusufkemaldemir9393
@yusufkemaldemir9393 6 ай бұрын
i also did not see github connection
@techlycan
@techlycan 5 ай бұрын
added the github link
Teenagers Show Kindness by Repairing Grandmother's Old Fence #shorts
00:37
Fabiosa Best Lifehacks
Рет қаралды 39 МЛН
Let's all try it too‼︎#magic#tenge
00:26
Nonomen ノノメン
Рет қаралды 52 МЛН
Balloon Pop Racing Is INTENSE!!!
01:00
A4
Рет қаралды 16 МЛН
Understanding the Scientific Method
10:00
Exploring Behavioral Science
Рет қаралды 4
Chat with SQL and Tabular Databases using LLM Agents (DON'T USE RAG!)
58:54
I Analyzed My Finance With Local LLMs
17:51
Thu Vu data analytics
Рет қаралды 375 М.
End to End Data Analytics Project (Python + SQL)
46:52
Ankit Bansal
Рет қаралды 50 М.
SQL-PaLM Explained!
33:25
Weaviate • Vector Database
Рет қаралды 4,7 М.
ADVANCED Python AI Agent Tutorial - Using RAG
40:59
Tech With Tim
Рет қаралды 110 М.
GPT-4o Deep Dive & Hidden Abilities you should know about
28:11
Teenagers Show Kindness by Repairing Grandmother's Old Fence #shorts
00:37
Fabiosa Best Lifehacks
Рет қаралды 39 МЛН