-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add context.callApi #37
Conversation
I do not have any concerns about your technical implementation, but I genuinely do not understand this API. Having both This is one API I've always been unhappy with in workflow, unrelated to this (very valid) PR. This is how I imagine this to look in a dx-friendly way:
benefits:
This following part is redundant, when a user chooses OpenAI as a provider, we already know it is an LLM.
|
I liked the explicit api idea more. On qstash sdk, api would be a bit complicated if we'd add a new api for each integration, because then we had to add a method for each publish, enqueue, batch etc. But for the workflow, integrations are more useful and significant, and its only function is to make an async call to an external endpoint with specific parameters. So having a child property for each integration and calling Now I'm thinking would it be better if we put all integrations under a namespace, instead of the root of the workflow context. For example So That way integration APIs will be separate from the main workflow functions; like |
wdyt about this?
if it is too much work then the following is ok:
|
I think await workflow.api.openai.call({
token: process.env.OPENAI_API_TOKEN,
operation: 'chat.completions.create',
body: {
model: 'gpt-4',
messages: [
{ role: 'system', content: 'whale is foo!' },
{ role: 'user', content: 'what is a whale!' }
]
}
}) |
ok let's do it.
|
Adds context.callApi method to call an endpoint with providers defined in QStash.
Currently awaiting upstash/qstash-js#219