@ai-sdk/fireworks
Version:
The **[Fireworks provider](https://ai-sdk.dev/providers/ai-sdk-providers/fireworks)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model and image model support for the [Fireworks](https://fireworks.ai) platform.
88 lines (81 loc) • 4.33 kB
TypeScript
import { ProviderV1, LanguageModelV1, EmbeddingModelV1, ImageModelV1 } from '@ai-sdk/provider';
import { FetchFunction } from '@ai-sdk/provider-utils';
import { z } from 'zod';
import { OpenAICompatibleChatSettings, OpenAICompatibleCompletionSettings, OpenAICompatibleEmbeddingSettings } from '@ai-sdk/openai-compatible';
type FireworksChatModelId = 'accounts/fireworks/models/deepseek-v3' | 'accounts/fireworks/models/llama-v3p3-70b-instruct' | 'accounts/fireworks/models/llama-v3p2-3b-instruct' | 'accounts/fireworks/models/llama-v3p1-405b-instruct' | 'accounts/fireworks/models/llama-v3p1-8b-instruct' | 'accounts/fireworks/models/mixtral-8x7b-instruct' | 'accounts/fireworks/models/mixtral-8x22b-instruct' | 'accounts/fireworks/models/mixtral-8x7b-instruct-hf' | 'accounts/fireworks/models/qwen2p5-coder-32b-instruct' | 'accounts/fireworks/models/qwen2p5-72b-instruct' | 'accounts/fireworks/models/qwen-qwq-32b-preview' | 'accounts/fireworks/models/qwen2-vl-72b-instruct' | 'accounts/fireworks/models/llama-v3p2-11b-vision-instruct' | 'accounts/fireworks/models/qwq-32b' | 'accounts/fireworks/models/yi-large' | (string & {});
interface FireworksChatSettings extends OpenAICompatibleChatSettings {
}
type FireworksCompletionModelId = 'accounts/fireworks/models/llama-v3-8b-instruct' | 'accounts/fireworks/models/llama-v2-34b-code' | (string & {});
interface FireworksCompletionSettings extends OpenAICompatibleCompletionSettings {
}
type FireworksEmbeddingModelId = 'nomic-ai/nomic-embed-text-v1.5' | (string & {});
interface FireworksEmbeddingSettings extends OpenAICompatibleEmbeddingSettings {
}
type FireworksImageModelId = 'accounts/fireworks/models/flux-1-dev-fp8' | 'accounts/fireworks/models/flux-1-schnell-fp8' | 'accounts/fireworks/models/playground-v2-5-1024px-aesthetic' | 'accounts/fireworks/models/japanese-stable-diffusion-xl' | 'accounts/fireworks/models/playground-v2-1024px-aesthetic' | 'accounts/fireworks/models/SSD-1B' | 'accounts/fireworks/models/stable-diffusion-xl-1024-v1-0' | (string & {});
interface FireworksImageSettings {
/**
Override the maximum number of images per call (default 1)
*/
maxImagesPerCall?: number;
}
type FireworksErrorData = z.infer<typeof fireworksErrorSchema>;
declare const fireworksErrorSchema: z.ZodObject<{
error: z.ZodString;
}, "strip", z.ZodTypeAny, {
error: string;
}, {
error: string;
}>;
interface FireworksProviderSettings {
/**
Fireworks API key. Default value is taken from the `FIREWORKS_API_KEY`
environment variable.
*/
apiKey?: string;
/**
Base URL for the API calls.
*/
baseURL?: 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;
}
interface FireworksProvider extends ProviderV1 {
/**
Creates a model for text generation.
*/
(modelId: FireworksChatModelId, settings?: FireworksChatSettings): LanguageModelV1;
/**
Creates a chat model for text generation.
*/
chatModel(modelId: FireworksChatModelId, settings?: FireworksChatSettings): LanguageModelV1;
/**
Creates a completion model for text generation.
*/
completionModel(modelId: FireworksCompletionModelId, settings?: FireworksCompletionSettings): LanguageModelV1;
/**
Creates a chat model for text generation.
*/
languageModel(modelId: FireworksChatModelId, settings?: FireworksChatSettings): LanguageModelV1;
/**
Creates a text embedding model for text generation.
*/
textEmbeddingModel(modelId: FireworksEmbeddingModelId, settings?: FireworksEmbeddingSettings): EmbeddingModelV1<string>;
/**
Creates a model for image generation.
*/
image(modelId: FireworksImageModelId, settings?: FireworksImageSettings): ImageModelV1;
/**
Creates a model for image generation.
*/
imageModel(modelId: FireworksImageModelId, settings?: FireworksImageSettings): ImageModelV1;
}
declare function createFireworks(options?: FireworksProviderSettings): FireworksProvider;
declare const fireworks: FireworksProvider;
export { type FireworksErrorData, type FireworksProvider, type FireworksProviderSettings, createFireworks, fireworks };