Skip to content

feat(ai): refresh customProvider and createProviderRegistry to support file and skill upload abstractions#14284

Open
felixarntz wants to merge 7 commits intomainfrom
fa/refresh-provider-registry-and-custom-provider
Open

feat(ai): refresh customProvider and createProviderRegistry to support file and skill upload abstractions#14284
felixarntz wants to merge 7 commits intomainfrom
fa/refresh-provider-registry-and-custom-provider

Conversation

@felixarntz
Copy link
Copy Markdown
Collaborator

Background

customProvider and createProviderRegistry had gaps in provider capability coverage: customProvider had no way to attach a provider's files or skills interfaces, createProviderRegistry was missing videoModel support entirely, and neither exposed files/skills access through the registry abstraction. This made it impossible to use file and skill upload APIs consistently through these provider management utilities.

Summary

  • customProvider: Added files and skills options.
  • createProviderRegistry: Added videoModel(providerId:modelId), files(providerId), and skills(providerId) methods.
  • Updated provider management docs with examples for all new APIs.
  • Added 6 new ai-functions examples.
  • Simplified the ai-e2e-next upload-file route to use createProviderRegistry instead of a hand-rolled provider map.

Fully backward compatible.

Manual Verification

Run the new examples.

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Future Work

N/A

Related Issues

N/A

@tigent tigent bot added ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. documentation Improvements or additions to documentation feature New feature or request labels Apr 9, 2026
languageModels: {
'gpt-4o-mini': openai.responses('gpt-4o-mini'),
},
files: openai.files(),
Copy link
Copy Markdown
Collaborator

@lgrammel lgrammel Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idea for future work: what if we had a files composite that can upload to several providers at once?

};
...(resolvedFiles != null ? { files: () => resolvedFiles } : {}),
...(resolvedSkills != null ? { skills: () => resolvedSkills } : {}),
} as any; // necessary workaround to satisfy the complex return type while maintaining type safety
Copy link
Copy Markdown
Collaborator

@lgrammel lgrammel Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should avoid this - it is possible to do this without any (see other implementations)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lgrammel I know, and I don't like this, but it was the only way I found to make this work:

Also custom provider implements provider so is there the issue of files/skills being optional on the custom provider instance (when using it)?

The code here is directly related to this point: It ensures that an unconditional call to files() or skills() on the custom provider doesn't cause a TypeScript error if one of the included providers have the respective method. This creates better DX, the same way that e.g. when you use the AnthropicProvider you can unconditionally call the two methods because AnthropicProvider has them, even though ProviderV4 only maybe has them.

You can test this behavior with e.g. examples/ai-functions/src/registry/upload-skill-custom-provider.ts: Change anthropic.skills() to e.g. google.skills(), and you'll immediately get a type error because Google doesn't support skills, so you can't just call the method unconditionally.

Copy link
Copy Markdown
Collaborator

@lgrammel lgrammel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good except for the any.

Also custom provider implements provider so is there the issue of files/skills being optional on the custom provider instance (when using it)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. documentation Improvements or additions to documentation feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants