SQLiteGPT
1.0.0
SQL function for SQLite to directly query OpenAI's ChatGPT.
npm install --global sqlitegpt
export OPENAI_API_KEY="sk-XXX"
sqlitegpt example.sqlite "SELECT gpt('Name of tallest mountain')"
import { sqliteGpt } from "sqlitegpt"
sqliteGpt(
":memory:",
"SELECT gpt('Name of tallest mountain') as tallest_mountain"
)
sqliteGpt(
"example.sqlite",
`
SELECT
country,
gpt('capital of ' || country || ', no explanation') as capital
FROM users
`
)
sync-request
which forces HTTP requests to be synchronous.
You should not use this in production!
However, it's currently the only way to make it work with better-sqlite3
.If you like SQLiteGPT, please star the project and I will re-implement it as a proper loadable extension in Rust with sqlite-loadable-rs.