-
Notifications
You must be signed in to change notification settings - Fork 433
feat(sdk): add body param support for variant_slug and variant_version #3329
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
Conversation
- Add body.get('variant_slug') to variant reference parsing
- Add body.get('variant_version') to variant version parsing
- Convert variant_version to string since JSON integers need conversion
- This makes variant params consistent with how environment params work
Previously, variant_slug only worked via query params or the legacy 'config'
body param. Now 'variant_slug' and 'variant_version' work directly in the
request body, matching the pattern used for 'environment'.
Variant Use API drawer: - Add 'Invoke LLM' code snippets to VariantUseApiContent, matching the deployment drawer functionality - Use variant_slug and variant_version in request body params - Reuse LanguageCodeBlock component for consistent UI Code snippet fixes: - Fix fetch_variant snippets to use dynamic URL instead of hardcoded cloud.agenta.ai - Fix Authorization header from 'Bearer' to 'ApiKey' for consistency - Remove inline comments from all snippets (curl, python, typescript) that were breaking copy-paste functionality - Ensure all generated snippets are directly pastable into terminal/editor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In new workflows, there will be a proper place to send references.
In legacy applications, I'd discourage from sending agenta-related information via the body other than ag_config. But since this interface is not meant to live for long, I don't mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we use the same interface for the environment, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is how it looks like for environment
# Add your API key to the Authorization header
curl -X POST "https://cloud.agenta.ai/services/completion/run" \
-H "Content-Type: application/json" \
-H "Authorization: ApiKey V7CDlfpn.4a28e99bf7ef0cc9ebb4692ba9039de74d71ce67138ec411f70cc2651d5bbaf9" \
-d '{
"environment": "development",
"app": "prompt"
}'
feat(web): add Invoke LLM snippets for variants & fix code snippets
Summary
Add support for
variant_slugandvariant_versionin the request body for the config middleware.Changes
body.get('variant_slug')to variant reference parsingbody.get('variant_version')to variant version parsingvariant_versionto string since JSON integers need conversion to match the Reference modelWhy
Previously,
variant_slugonly worked via query params or the legacyconfigbody param. This was inconsistent with howenvironmentparams work (which support body params).Now
variant_slugandvariant_versionwork directly in the request body:{ "app": "my-app", "variant_slug": "my-variant", "variant_version": 2, "inputs": {...} }