Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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/

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!



Maybe use embeddings from a BERT instead? This in particular: https://www.sbert.net/docs/sentence_transformer/pretrained_m...


The API call is the same price per token regardless of how you run it!


if you switch model to GPT-4.5-preview you can spend a lot of money very quickly




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: