Skip to content

使用langchain和chatgpt结合本地数据库做sql生成和sql查询,使用chain一步步得到结果

Notifications You must be signed in to change notification settings

doudou-itachi/GPT2SQL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

使用langchain 和OPENAI ChatGPT实现了一个连接本地数据库做sql生成的demo

前提

确保你能访问chatgpt并且有可用的openai_api_key

使用

cd GPT2SQL
pip install -r requirements.txt
python main.py --api_keys
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
sk-UzT0rlqUgFqvSgmVdGskT3BlbkFcJaSPigmqXeNGPAaxvcqE
--database_name
xxxx
--password
xxxx
--ipaddr
xxx.xxx.x.x
参数说明
api_keys:必填 允许多个
model_name:调用openai的模型名称,默认使用gpt-3.5-turbo-16k
temperature:温度 默认为0
database_name:必填 连接的数据库名称
database_type:数据库类型(PostgreSQL mysql SQLite....)默认 mysql
name:连接数据库的用户名 默认root
password:连接数据库的密码 默认123456
ipaddr:连接数据的地址 默认127.0.0.1
http_proxy:配置代理 默认 127.0.0.1:7890
https_proxy:配置代理 默认 127.0.0.1:7890

test_result

About

使用langchain和chatgpt结合本地数据库做sql生成和sql查询,使用chain一步步得到结果

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages