3 ms·
I tried that a couple of years ago with a CLI tool that uses Python functions called from SQLite - it worked with GPT-3.5: https://simonwillison.net/2023/Apr/29
by simonw 2y ago
I tried that a couple of years ago with a CLI tool that uses Python functions called from SQLite - it worked with GPT-3.5: https://simonwillison.net/2023/Apr/29/enriching-data/ https://simonwillison.net/2023/Apr/29/enriching-data/
Example usage:
openai-to-sqlite query database.db "
update messages set sentiment = chatgpt(
'Sentiment analysis for this message: ' || message ||
' - ONLY return a lowercase string from: positive, negative, neutral, unknown'
)
where sentiment not in ('positive', 'negative', 'neutral', 'unknown')
or sentiment is null
"
I haven't revisited the idea for fear of the amount it could cost if you ran it against a large database, but given the crashing prices of Gemini Flash, GPT-4o mini etc maybe it's worth another look!
- arthurcolle 2y agoif you switch model to GPT-4.5-preview you can spend a lot of money very quickly
- datadrivenangel 2y agoThe API call is the same price per token regardless of how you run it!
- Xmd5a 2y agoMaybe use embeddings from a BERT instead? This in particular: https://www.sbert.net/docs/sentence_transformer/pretrained_models.html#instructor-models https://www.sbert.net/docs/sentence_transformer/pretrained_m...
- jt_b 2y agoPerfect use case for https://github.com/urchade/GLiNER https://github.com/urchade/GLiNER