Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the batch API #5

Open
Keyrxng opened this issue Sep 2, 2024 · 2 comments
Open

Use the batch API #5

Keyrxng opened this issue Sep 2, 2024 · 2 comments

Comments

@Keyrxng
Copy link
Contributor

Keyrxng commented Sep 2, 2024

We could use the batch API and reap the benefits it provides since right now we do not need the real-time embeddings that we currently have, which is awesome but more expensive than what it needs to be.

So we'd simply store each comment as they come in as is what happens now, then send all comments in the database without an embedding every n hours.

We could have a cron job perform this function for us but it would need to be able to handle the async nature of requests to this endpoint. Alternatively build a time check into the worker itself using the updated_at of the most recent embedding filled entry.

  • 50% cheaper
  • separate rate limit
  • 24hr turn around (which makes it very clean if we do it every 24hrs)

https://platform.openai.com/docs/guides/batch/overview

@0x4007
Copy link
Member

0x4007 commented Sep 3, 2024

Generally I am against the use of cron for load balancing and scaling reasons, but if this is a centralized system that can handle it for all partners with one batching script then this might be acceptable.

If we want to try and reframe the problem as having the system remember "important" conversations, then we could create batches based on some key events of the task pipeline.

  • issue filed
  • Price label set
  • issue closed as complete

But perhaps cron might be superior in this context.

@shiv810
Copy link
Collaborator

shiv810 commented Sep 3, 2024

We could create entry in the db with null vector. And then write a postgres function that would update the entries with null vector entries with the actual embeddings. This is way we can use pg_cron to update embeddings.

Supabase pg_cron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants