-
Notifications
You must be signed in to change notification settings - Fork 498
feat: add media-library-auto-alt-text function example #11337
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
🧪 E2E Preview environment🔑 Environment Variables for Local TestingThis is the preview URL for the E2E tests: https://e2e-studio-7tfvw5ddb.sanity.dev To run the E2E tests locally, you can use the following environment variables, then run 💬 Remember to build the project first with |
📊 Playwright Test ReportThis report contains test results, including videos of failing tests. |
⚡️ Editor Performance ReportUpdated Fri, 28 Nov 2025 15:35:27 GMT
Detailed information🏠 Reference resultThe performance result of
🧪 Experiment resultThe performance result of this branch
📚 Glossary
|
… correct formatting
Description
This PR introduces an example function for the Media Library. Its purpose is to demonstrate Media Library functions, how to properly access image assets via the asset container, and how to generate localized alt-text.
The example intentionally focuses on clarity and guidance rather than prescribing a rigid pattern. It uses
agent.action.promptand enforces JSON-shaped output, but because AI models may not always return strict JSON, this should be viewed as a working example rather than a guaranteed contract. Everyone may also choose to add in their own functions that enforce JSON, the function is designed flexibly enough for that.It also avoids using
agent.action.translatebecause that action currently expects a full document and is not yet compatible with Media Library use cases. Once Media Library and agent actions evolve, we can update this example accordingly. Until then, this version provides valuable early guidance and unblocks everyone who need a functional starting point.The PR also introduces an internationalized array structure for alt text (mirroring the Studio’s internationalized array plugin), so the frontend can query language-tagged items in a familiar format. This format is approved internally by the Media Library team.
At the end is a video demonstration that visually shows how the alt-text appears after upload.
What to review
agent.action.promptis appropriate given its current behavior and limitations.Testing
Automated tests were not added.
The function was manually tested in a Media Library environment and works end-to-end:
This manual testing approach is sufficient for an inspirational example that everyone can adapt.
Notes for release
This adds an inspirational, fully working example function for the Media Library to help everyone understand:
agent.action.promptLimitations:
agent.action.promptis instructed to produce JSON, but AI responses may still varyagent.action.translatecannot be used yet because it requires a full document inputVideo:
Screen.Recording.2025-11-28.at.14.46.14.mov