KonradK
Convex Community3y ago
5 replies
Konrad

Using Actions, Mutations, and Helpers in Convex for OpenAI Integration

I'm working on an app with Convex and have a quick question about structuring API calls and data handling. I'm integrating OpenAI to generate content and need some advice on the right approach using Convex's capabilities.

My current plan is to:

Use an action to call the OpenAI API.
Save the API response using a mutation.
Trigger the next step with a helper function.
I'm wondering if this is a sound approach, particularly regarding the use of actions to handle external API calls and then using mutations for database updates. Does anyone have experience with a similar setup or suggestions on whether this is the optimal way to handle such workflows in Convex? I made a diagram to illustrate what I mean

Any insights or tips would be greatly appreciated!
Screenshot_2023-12-07_at_1.10.29_PM.png
Was this page helpful?