Unlocking ChatGPT's Potential: LangChain Tutorial with DuckDB
HTML-код
- Опубликовано: 4 июл 2024
- 📖 My Spatial SQL book is out now! ➡️ spatial-sql.com/ ⬅️
🖥️ Start your 7-day Setapp trial here to access 240+ Mac apps using one subscript setapp.sjv.io/c/3493413/34332...
To say LLMs have been dominating the AI space is a bit of an understatement, and DuckDB is fast becoming a popular choice for analytics use cases. But can we combine these two technologies to ask questions of our database and get results back? Let's find out using NBA Shot Tracker Data and NYC 311 calls, as well as testing out @motherduckdb and their new embedded AI tools!
0:00 Intro
2:55 LangChain overview
5:08 Notebook setup
7:17 DuckDB
10:50 Set up LangChain agent
11:58 Prompt engineering
13:59 NBA Shot Tracker Data
16:49 Spatial data in DuckDB
20:50 Spatial queries using NYC 311 calls
23:38 Embedded AI in MotherDuck
31:04 Embedded AI in MotherDuck
Here are the datasets we used in the video:
NYC 311: portal.311.nyc.gov/article/?k...
NBA Shot Tracker on Kaggle: www.kaggle.com/datasets/techb...
Thanks for watching! You can support this channel in a few different ways:
📰 I run a weekly newsletter on modern GIS on Substack! Check it out and subscribe here: mattforrest.substack.com/
Check out some other posts and resources here:
Learn Spatial SQL: forrest.nyc/learn-spatial-sql/
40+ Resources for Spatial SQL: forrest.nyc/40-spatial-sql-re...
75+ Geospatial Python and Spatial Data Science Resources and Guides: forrest.nyc/75-geospatial-pyt...
Other courses to get started with GIS, spatial data science, and data science (affiliate links):
Geographic Information Systems (GIS) Specialization from UC Davis: imp.i384100.net/n1Kyxo
Spatial Data Science and Applications from Yonsei University: imp.i384100.net/9W6E6W
Python for Everybody from University of Michigan: imp.i384100.net/BX3P31
Remote Sensing Image Acquisition, Analysis and Applications: imp.i384100.net/Xxe4Ay
#llm #duckdb #langchain
➕ Follow me on LinkedIn: / mbforr
🎙️Check out the Modern GIS episode on the MapScaping Podcast: mapscaping.com/podcast/what-i...
🌐 My personal website: forrest.nyc
🚀 My top links and resources: forrest.nyc/links-and-guides-... Наука
Cool demo, thanks a lot for sharing.
Thanks!
Thanks nice demos!
Thanks!
Great demo. While following along, I noticed the issue with your initial question about the NBA data was an issue with capitalization. Typing 'Lebron' was causing no results to be returned. The season info in the prompt looked like it was actually doing the right thing. For anyone following along, these additions to the prompt seemed to help:
"If you are asked about something having to do with a year, treat years as starting in October and ending in June."
"Look up player names in a case insensitive manner."
Also, in that initial question, the query was summing distance because there is no concept of points in the database. Adding a points column helped with this:
connection.query('alter table nba_short add column points int');
connection.query('''
UPDATE nba_short
SET points = CASE
WHEN made = true AND shot_type = '2-pointer' THEN 2
WHEN made = true AND shot_type = '3-pointer' THEN 3
ELSE 0
END;
''')
And to the prompt:
"The column name points with the data type INTEGER contains the following information: The number of points the shot was worth"
Yes good call I want to do more on this topic and still figuring out the best way to structure the prompts.
Thank you very much, impressive
Thanks!
Can you please share the Jupyter notebook?
Link should be there I believe
How you learn GIS can any way of learning tools... Is it worth it??
Depends on your career goals but there are tons of great free resources to get started. I have other videos on that topic.