UNPKG

sambanova-ai-provider

Version:

Vercel AI Provider for running LLMs locally using SambaNova models

83 lines (77 loc) 3.05 kB
import { ProviderV1, LanguageModelV1, EmbeddingModelV1 } from '@ai-sdk/provider'; import { FetchFunction } from '@ai-sdk/provider-utils'; type SambaNovaChatModelId = 'DeepSeek-R1' | 'DeepSeek-R1-Distill-Llama-70B' | 'DeepSeek-V3-0324' | 'Llama-4-Maverick-17B-128E-Instruct' | 'Llama-4-Scout-17B-16E-Instruct' | 'Meta-Llama-3.3-70B-Instruct' | 'Meta-Llama-3.2-3B-Instruct' | 'Meta-Llama-3.2-1B-Instruct' | 'Meta-Llama-3.1-405B-Instruct' | 'Meta-Llama-3.1-8B-Instruct' | 'QwQ-32B' | (string & {}); interface SambaNovaChatSettings { /** Whether to enable parallel function calling during tool use. Default to true. */ parallelToolCalls?: boolean; /** A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more. */ user?: string; /** Automatically download images and pass the image as data to the model. SambaNova supports image URLs for public models, so this is only needed for private models or when the images are not publicly accessible. Defaults to `false`. */ downloadImages?: boolean; } type SambaNovaEmbeddingModelId = 'E5-Mistral-7B-Instruct' | (string & {}); interface SambaNovaEmbeddingSettings { maxEmbeddingsPerCall?: number; truncate?: boolean; } interface SambaNovaProvider extends ProviderV1 { (modelId: SambaNovaChatModelId, settings?: SambaNovaChatSettings): LanguageModelV1; /** Create a chat model for text generation. * @param modelId The model ID. * @param settings The settings for the model. * @returns The chat model. */ chatModel(modelId: SambaNovaChatModelId, settings?: SambaNovaChatSettings): LanguageModelV1; /** Create a language model for text generation. * @param modelId The model ID. * @param settings The settings for the model. * @returns The language model. */ languageModel(modelId: SambaNovaChatModelId, settings?: SambaNovaChatSettings): LanguageModelV1; /** Create a text embedding model. * @param modelId The model ID. * @returns The text embedding model. */ textEmbeddingModel(modelId: SambaNovaEmbeddingModelId, settings?: SambaNovaEmbeddingSettings): EmbeddingModelV1<string>; } interface SambaNovaProviderSettings { /** Base URL for the SambaNova API calls. */ baseURL?: string; /** API key for authenticating requests. */ 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 an SambaNova provider instance. */ declare function createSambaNova(options?: SambaNovaProviderSettings): SambaNovaProvider; /** Default SambaNova provider instance. */ declare const sambanova: SambaNovaProvider; export { type SambaNovaProvider, type SambaNovaProviderSettings, createSambaNova, sambanova };