mixedbread-ai-provider
Version:
Mixedbread AI Provider for running Mixedbread AI models with Vercel AI SDK
57 lines (53 loc) • 2.14 kB
text/typescript
import { ProviderV2, EmbeddingModelV2 } from '@ai-sdk/provider';
import { FetchFunction } from '@ai-sdk/provider-utils';
import { z } from 'zod/v4';
type MixedbreadEmbeddingModelId = 'mixedbread-ai/deepset-mxbai-embed-de-large-v1' | 'mixedbread-ai/mxbai-embed-large-v1' | 'mixedbread-ai/mxbai-embed-2d-large-v1' | (string & NonNullable<unknown>);
declare const mixedbreadEmbeddingOptions: z.ZodObject<{
prompt: z.ZodOptional<z.ZodString>;
normalized: z.ZodOptional<z.ZodBoolean>;
dimensions: z.ZodOptional<z.ZodNumber>;
encodingFormat: z.ZodOptional<z.ZodEnum<{
float: "float";
float16: "float16";
binary: "binary";
ubinary: "ubinary";
int8: "int8";
uint8: "uint8";
base64: "base64";
}>>;
}, z.core.$strip>;
type MixedbreadEmbeddingOptions = z.infer<typeof mixedbreadEmbeddingOptions>;
interface MixedbreadProvider extends ProviderV2 {
(modelId: MixedbreadEmbeddingModelId): EmbeddingModelV2<string>;
textEmbeddingModel: (modelId: MixedbreadEmbeddingModelId) => EmbeddingModelV2<string>;
}
interface MixedbreadProviderSettings {
/**
Use a different URL prefix for API calls, e.g. to use proxy servers.
The default prefix is `https://api.mixedbread.com/v1`.
*/
baseURL?: string;
/**
API key that is being send using the `Authorization` header.
It defaults to the `MIXEDBREAD_API_KEY` environment variable.
*/
apiKey?: string;
/**
Custom headers to include in the requests.
*/
headers?: Record<string, string>;
/**
Custom fetch implementation. You can use it as a middleware to intercept requests,
or to provide a custom fetch implementation for e.g. testing.
*/
fetch?: FetchFunction;
}
/**
Create a Mixedbread AI provider instance.
*/
declare function createMixedbread(options?: MixedbreadProviderSettings): MixedbreadProvider;
/**
Default Mixedbread provider instance.
*/
declare const mixedbread: MixedbreadProvider;
export { type MixedbreadEmbeddingOptions, type MixedbreadProvider, type MixedbreadProviderSettings, createMixedbread, mixedbread };