Skip to content

Conversation

@gr2m
Copy link
Collaborator

@gr2m gr2m commented Aug 21, 2025

Background

We are currently not exporting a type for providerOptions

Summary

We have to take into account that provider options can be different depending on what is used:

  • language model
  • image model
  • embedding

So instead of MistralProviderOptions we settled on MistralLanguageModelOptions. We considered MistralLanguageModelProviderOptions but rejected it due to its length.

Manual Verification

examples/ai-core/src/generate-text/mistral-provider-options.ts

Tasks

  • Tests have been added / updated (for bug fixes / features) we don't currently do test of module exports, we use examples instead
  • 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)
  • Formatting issues have been fixed (run pnpm prettier-fix in the project root)

Future Work

Export provider options type for other providers and model types

Draft for a batch issue to implement `providerOptions` types across all providers and their model types

Follow up to this comment by @maltesa

I think the index.ts should export the provider options:

export type { MistralProviderOptions } from './mistral-chat-options';

In order to allow this:

import type { MistralProviderOptions } from '@ai-sdk/mistral'

generateObject({
  // ...
  providerOptions: {
    mistral: {
      structuredOutputs: true,
      strictJsonSchema: true,
    } satisfies MistralProviderOptions,
  },
}),

We now implemented MistralLanguageModelOptions for the mistral provider: #8202. We want to do the same for every model type from every provider that supports providerOptions - pull requests welcome! If you are interested, just comment which one you want to work on, and follow the instructions below

Language Model Provider Options

High Priority (Already have providerOptions schemas)

  • @ai-sdk/openai - Export OpenAILanguageModelOptions (from openaiProviderOptions schema) - feat(provider/openai): OpenAILanguageModelOptions type #8212
  • @ai-sdk/openai - Export OpenAIResponsesLanguageModelOptions (from openaiResponsesProviderOptionsSchema schema)
  • @ai-sdk/google - Export GoogleLanguageModelOptions (from googleGenerativeAIProviderOptions schema)
  • @ai-sdk/anthropic - Export AnthropicLanguageModelOptions (from anthropicProviderOptions schema)
  • @ai-sdk/openai-compatible - Export OpenAICompatibleLanguageModelOptions (provider options schema exists)
  • @ai-sdk/amazon-bedrock - Export BedrockLanguageModelOptions (provider options schema exists)
  • @ai-sdk/groq - Export GroqLanguageModelOptions (provider options schema exists)
  • @ai-sdk/xai - Export XaiLanguageModelOptions (provider options schema exists)

Medium Priority (Need investigation for language model support)

  • @ai-sdk/cohere - Export CohereLanguageModelOptions (investigate if language models support providerOptions)
  • @ai-sdk/perplexity - Export PerplexityLanguageModelOptions
  • @ai-sdk/fireworks - Export FireworksLanguageModelOptions
  • @ai-sdk/deepinfra - Export DeepInfraLanguageModelOptions
  • @ai-sdk/togetherai - Export TogetherAILanguageModelOptions
  • @ai-sdk/cerebras - Export CerebrasLanguageModelOptions
  • @ai-sdk/deepseek - Export DeepSeekLanguageModelOptions
  • @ai-sdk/google-vertex - Export GoogleVertexLanguageModelOptions
  • @ai-sdk/replicate - Export ReplicateLanguageModelOptions
  • @ai-sdk/azure - Export AzureLanguageModelOptions
  • @ai-sdk/luma - Export LumaLanguageModelOptions

Embedding Model Provider Options

High Priority (Already have providerOptions schemas)

  • @ai-sdk/openai - Export OpenAIEmbeddingModelOptions (has dimensions, user options)
  • @ai-sdk/amazon-bedrock - Export BedrockEmbeddingModelOptions (has dimensions, normalize options)
  • @ai-sdk/google - Export GoogleEmbeddingModelOptions (investigate embedding model providerOptions)
  • @ai-sdk/google-vertex - Export GoogleVertexEmbeddingModelOptions

Medium Priority (Need investigation)

  • @ai-sdk/cohere - Export CohereEmbeddingModelOptions
  • @ai-sdk/mistral - Export MistralEmbeddingModelOptions
  • @ai-sdk/openai-compatible - Export OpenAICompatibleEmbeddingModelOptions
  • @ai-sdk/togetherai - Export TogetherAIEmbeddingModelOptions
  • @ai-sdk/deepinfra - Export DeepInfraEmbeddingModelOptions

Speech Model Provider Options

High Priority (Already have providerOptions schemas)

  • @ai-sdk/elevenlabs - Export ElevenLabsSpeechModelOptions (from ElevenLabsProviderOptionsSchema)
  • @ai-sdk/openai - Export OpenAISpeechModelOptions (has instructions, response_format options)
  • @ai-sdk/fal - Export FalSpeechModelOptions (from falSpeechProviderOptionsSchema)
  • @ai-sdk/lmnt - Export LMNTSpeechModelOptions (from lmntSpeechCallOptionsSchema)
  • @ai-sdk/hume - Export HumeSpeechModelOptions

Transcription Model Provider Options

High Priority (Already have providerOptions schemas)

  • @ai-sdk/openai - Export OpenAITranscriptionModelOptions (has language, temperature, include options)
  • @ai-sdk/groq - Export GroqTranscriptionModelOptions (from provider options schema)
  • @ai-sdk/fal - Export FalTranscriptionModelOptions (from falProviderOptionsSchema)
  • @ai-sdk/revai - Export RevaiTranscriptionModelOptions (from revaiProviderOptionsSchema)
  • @ai-sdk/assemblyai - Export AssemblyAITranscriptionModelOptions (from assemblyaiProviderOptionsSchema)
  • @ai-sdk/elevenlabs - Export ElevenLabsTranscriptionModelOptions

Medium Priority (Need investigation)

  • @ai-sdk/deepgram - Export DeepgramTranscriptionModelOptions
  • @ai-sdk/gladia - Export GladiaTranscriptionModelOptions
  • @ai-sdk/azure - Export AzureTranscriptionModelOptions

Image Model Provider Options

High Priority (Already have providerOptions schemas)

  • @ai-sdk/google - Export GoogleImageModelOptions (from googleImageProviderOptionsSchema)
  • @ai-sdk/google-vertex - Export GoogleVertexImageModelOptions

Medium Priority (Need investigation)

  • @ai-sdk/openai - Export OpenAIImageModelOptions
  • @ai-sdk/deepinfra - Export DeepInfraImageModelOptions (mentioned in docs)
  • @ai-sdk/replicate - Export ReplicateImageModelOptions
  • @ai-sdk/fal - Export FalImageModelOptions
  • @ai-sdk/togetherai - Export TogetherAIImageModelOptions
  • @ai-sdk/xai - Export XaiImageModelOptions

Instructions

  1. rename the internal schema for providerOptions following this naming convention:
    {Provider}{ModelType}ModelOptions (example: d1a9f43)
  2. export the new type from the main index.ts file of the provider package (example: c83e6c1)
  3. create a new example with all supported provider options. Make sure the example works. (example: 2c49aa9)
  4. Update the provider documentation (example: 3c9451c)
  5. Create a changeset using pnpm changeset (example: 1af03dc)

Related Issues

Addresses #8130 (comment)

gr2m added 2 commits August 21, 2025 09:16
In preparation for better naming to account for different provider options based on language model / embedding / image model / etc within the same provider
@gr2m gr2m force-pushed the gr2m/export-mistral-language-model-options branch from 9b7edde to a380bdc Compare August 21, 2025 22:39
@gr2m gr2m merged commit 3429644 into main Aug 22, 2025
9 checks passed
@gr2m gr2m deleted the gr2m/export-mistral-language-model-options branch August 22, 2025 06:01
gr2m added a commit that referenced this pull request Sep 24, 2025
## Background

We are currently not exporting a type for `providerOptions.openai`

## Summary

Export `OpenAILanguageModelOptions` to type `providerOptions.openai` as
needed

## Manual Verification


[examples/ai-core/src/generate-text/openai-provider-options.ts](https://github.com/vercel/ai/blob/gr2m/export-mistral-language-model-options/examples/ai-core/src/generate-text/openai-provider-options.ts#L9-L28)

## Tasks

- [ ] ~~Tests have been added / updated (for bug fixes / features)~~ we
don't currently do test of module exports, we use examples instead
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] Formatting issues have been fixed (run `pnpm prettier-fix` in the
project root)

## Related Issues

- #8202
vercel-ai-sdk bot pushed a commit that referenced this pull request Sep 24, 2025
## Background

We are currently not exporting a type for `providerOptions.openai`

## Summary

Export `OpenAILanguageModelOptions` to type `providerOptions.openai` as
needed

## Manual Verification


[examples/ai-core/src/generate-text/openai-provider-options.ts](https://github.com/vercel/ai/blob/gr2m/export-mistral-language-model-options/examples/ai-core/src/generate-text/openai-provider-options.ts#L9-L28)

## Tasks

- [ ] ~~Tests have been added / updated (for bug fixes / features)~~ we
don't currently do test of module exports, we use examples instead
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] Formatting issues have been fixed (run `pnpm prettier-fix` in the
project root)

## Related Issues

- #8202
@gr2m gr2m added ai/provider provider/mistral Issues related to the @ai-sdk/mistral provider labels Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider provider/mistral Issues related to the @ai-sdk/mistral provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants