Back

SSE or similar using Appwrite

  • 0
  • Self Hosted
  • Functions
  • Realtime
g92206887
20 Sep, 2023, 19:59

My application makes use of OpenAI and I have to write a function that acts as a proxy, it would be great if there was a way to send realtime data over functions similar to how OpenAI uses SSE, I know there is realtime api however that would require writing to collection many, many times and it is really not efficient, it would also be abuse of ratelimit. Is there any other way of doing this? Or is Appwrite not suitable for this?

TL;DR
The user is asking if they can create/update a document at regular intervals in order to simulate a streaming effect with Appwrite. Another user suggests using a single document and updating it multiple times using Real-time feature to catch the updates. This would avoid rate limits. The user confirms that they are in a function and the response mentions that API keys in functions don't have to worry about rate limits. There is no specific solution mentioned in the thread.
Torsten Dittmann
20 Sep, 2023, 23:21

So you are looking for sort of streaming from a function right?

For this you can have a single document, which you can then update many times and use Real-time to catch those updates.

Considering you are in a function using an API key you don’t have to care about rate limits 👍🏻

g92206887
21 Sep, 2023, 05:43

Yes, I thought about it but wouldn't it be expensive performance wise?

g92206887
21 Sep, 2023, 05:44

When you consider openai streams new token every 0.3~ second it would write a lot.

Drake
21 Sep, 2023, 18:05

maybe you can create/update document after n seconds

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more