UNPKG

@squidcloud/client

Version:

A typescript implementation of the Squid client

249 lines (248 loc) 9.22 kB
import { UserAiChatModelName } from './backend.public-types'; /** * @category AI */ export declare const RERANK_PROVIDERS: readonly ["cohere", "none"]; /** * @category AI */ export type AiRerankProvider = (typeof RERANK_PROVIDERS)[number]; /** List of available AI provider types. See AiProviderType. */ export declare const AI_PROVIDER_TYPES: readonly ["anthropic", "bedrock", "claude-code", "codex", "cohere", "flux", "gemini", "openai", "grok", "stability", "voyage", "mistral", "textract", "vertex", "external"]; /** * Type of the AI provider. * References a single AI service, regardless of the model or other AI function it provides (like * chat/search/transcribe etc...). */ export type AiProviderType = (typeof AI_PROVIDER_TYPES)[number]; /** * Type of AI provider that supports file upload operations. * Only a subset of AI providers support file management features. */ export type AiFileProviderType = Extract<AiProviderType, 'openai' | 'gemini' | 'anthropic' | 'grok'>; /** * Public OpenAI chat model names (active models only). * @category AI */ export declare const OPENAI_CHAT_MODEL_NAMES: readonly ["gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.5", "gpt-5.5-pro"]; /** * Public Gemini chat model names (active models only). * @category AI */ export declare const GEMINI_CHAT_MODEL_NAMES: readonly ["gemini-3.1-pro", "gemini-3.5-flash", "gemini-3.1-flash-lite"]; /** * Public Grok chat model names (active models only). * @category AI */ export declare const GROK_CHAT_MODEL_NAMES: readonly ["grok-4.3", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"]; /** * Public Anthropic chat model names (active models only). * @category AI */ export declare const ANTHROPIC_CHAT_MODEL_NAMES: readonly ["claude-haiku-4-5-20251001", "claude-opus-4-8", "claude-sonnet-5"]; /** * The supported AI model names. * @category AI */ export declare const VENDOR_AI_CHAT_MODEL_NAMES: readonly ["gpt-5.4-mini", "gpt-5.4-nano", "gpt-5.5", "gpt-5.5-pro", "claude-haiku-4-5-20251001", "claude-opus-4-8", "claude-sonnet-5", "gemini-3.1-pro", "gemini-3.5-flash", "gemini-3.1-flash-lite", "grok-4.3", "grok-4-1-fast-reasoning", "grok-4-1-fast-non-reasoning"]; /** Checks if the given model name is a global AI chat model name. */ export declare function isVendorAiChatModelName(modelName: unknown): modelName is VendorAiChatModelName; /** * @category AI */ export declare const OPENAI_EMBEDDINGS_MODEL_NAMES: readonly ["text-embedding-3-small"]; /** * @category AI */ export declare const VOYAGE_EMBEDDING_MODEL_NAMES: readonly ["voyage-3-large"]; /** * @category AI */ export declare const BEDROCK_EMBEDDING_MODEL_NAMES: readonly ["titan-embed-text-v2"]; /** * @category AI */ export declare const AI_EMBEDDINGS_MODEL_NAMES: readonly ["text-embedding-3-small", "voyage-3-large", "titan-embed-text-v2"]; /** * Checks if the given model name is a valid AI embeddings model name. * @category AI */ export declare function isAiEmbeddingsModelName(modelName: unknown): modelName is AiEmbeddingsModelName; /** * Represents an embedding model provided by an OpenAI-compatible integration. * Unlike chat's `IntegrationModelSpec`, this includes `dimensions` because the same * embedding model can be configured with different output dimensions. * @category AI */ export interface IntegrationEmbeddingModelSpec { /** The ID of the integration providing the embedding model. */ integrationId: string; /** The model name as recognized by the provider. */ model: string; /** The number of dimensions in the embedding vector output. */ dimensions: number; } /** * Type guard for `IntegrationEmbeddingModelSpec`. * @category AI */ export declare function isIntegrationEmbeddingModelSpec(model: unknown): model is IntegrationEmbeddingModelSpec; /** * Type for specifying which embedding model to use. * Can be either a vendor model name (string) or an integration-based embedding model (object). * @category AI */ export type AiEmbeddingsModelSelection = AiEmbeddingsModelName | IntegrationEmbeddingModelSpec; /** * The supported AI image generation model names. * @category AI */ export declare const OPENAI_IMAGE_MODEL_NAMES: readonly ["gpt-image-1", "gpt-image-1-mini", "gpt-image-1.5", "gpt-image-2", "gpt-image-2-2026-04-21", "chatgpt-image-latest"]; /** * @category AI */ export declare const OPENAI_AUDIO_TRANSCRIPTION_MODEL_NAMES: readonly ["whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe"]; /** * @category AI */ export declare const OPENAI_AUDIO_CREATE_SPEECH_MODEL_NAMES: readonly ["tts-1", "tts-1-hd", "gpt-4o-mini-tts"]; /** * @category AI */ export declare const OPENAI_AUDIO_MODEL_NAMES: readonly ["whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe", "tts-1", "tts-1-hd", "gpt-4o-mini-tts"]; /** * @category AI */ export declare const STABLE_DIFFUSION_MODEL_NAMES: readonly ["stable-diffusion-core"]; /** * @category AI */ export declare const FLUX_MODEL_NAMES: readonly ["flux-pro-1.1", "flux-kontext-pro"]; /** * @category AI */ export declare const AI_IMAGE_MODEL_NAMES: readonly ["gpt-image-1", "gpt-image-1-mini", "gpt-image-1.5", "gpt-image-2", "gpt-image-2-2026-04-21", "chatgpt-image-latest", "stable-diffusion-core", "flux-pro-1.1", "flux-kontext-pro"]; /** * @category AI */ export declare const AI_AUDIO_TRANSCRIPTION_MODEL_NAMES: readonly ["whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe"]; /** * @category AI */ export declare const AI_AUDIO_CREATE_SPEECH_MODEL_NAMES: readonly ["tts-1", "tts-1-hd", "gpt-4o-mini-tts"]; /** * @category AI */ export declare const OPEN_AI_CREATE_SPEECH_FORMATS: readonly ["mp3", "opus", "aac", "flac", "wav", "pcm"]; /** * @category AI */ export type VendorAiChatModelName = (typeof VENDOR_AI_CHAT_MODEL_NAMES)[number]; /** * @category AI */ export type AiChatModelName = VendorAiChatModelName | UserAiChatModelName; /** * @category AI */ export type AiEmbeddingsModelName = (typeof AI_EMBEDDINGS_MODEL_NAMES)[number]; /** * @category AI */ export type AiVoyageEmbeddingsModelName = (typeof VOYAGE_EMBEDDING_MODEL_NAMES)[number]; /** * @category AI */ export type OpenAiChatModelName = (typeof OPENAI_CHAT_MODEL_NAMES)[number]; /** * @category AI */ export type GeminiChatModelName = (typeof GEMINI_CHAT_MODEL_NAMES)[number]; /** * @category AI */ export type GrokChatModelName = (typeof GROK_CHAT_MODEL_NAMES)[number]; /** * @category AI */ export type AnthropicChatModelName = (typeof ANTHROPIC_CHAT_MODEL_NAMES)[number]; /** * @category AI */ export type AiImageModelName = (typeof AI_IMAGE_MODEL_NAMES)[number]; /** * @category AI */ export type AiAudioTranscriptionModelName = (typeof AI_AUDIO_TRANSCRIPTION_MODEL_NAMES)[number]; /** * @category AI */ export type AiAudioCreateSpeechModelName = (typeof OPENAI_AUDIO_CREATE_SPEECH_MODEL_NAMES)[number]; /** * @category AI */ export type AiAudioModelName = (typeof OPENAI_AUDIO_MODEL_NAMES)[number]; /** * @category AI */ export type OpenAiImageModelName = (typeof OPENAI_IMAGE_MODEL_NAMES)[number]; /** * @category AI */ export type OpenAiAudioTranscriptionModelName = (typeof OPENAI_AUDIO_TRANSCRIPTION_MODEL_NAMES)[number]; /** * @category AI */ export type OpenAiAudioCreateSpeechModelName = (typeof OPENAI_AUDIO_CREATE_SPEECH_MODEL_NAMES)[number]; /** * @category AI */ export type OpenAiCreateSpeechFormat = (typeof OPEN_AI_CREATE_SPEECH_FORMATS)[number]; /** * @category AI */ export type StableDiffusionModelName = (typeof STABLE_DIFFUSION_MODEL_NAMES)[number]; /** * @category AI */ export type FluxModelName = (typeof FLUX_MODEL_NAMES)[number]; /** * Where a chat model offered to an app comes from. See {@link ModelIdSpec.source}. * @category AI */ export declare const AI_MODEL_SOURCES: readonly ["vendor", "connector", "custom"]; /** * @category AI */ export type AiModelSource = (typeof AI_MODEL_SOURCES)[number]; /** Represents an AI model. */ export interface ModelIdSpec { /** The model ID used for API calls. */ modelId: AiChatModelName; /** The integration ID if this model comes from an integration (OpenAI-compatible, Bedrock). Is undefined for Squid-provided models. */ integrationId?: string; /** Human-readable display name for the model (e.g. "GPT-4o"). */ displayName?: string; /** Short human-readable description of the model. Undefined for custom integration models. */ description?: string; /** * Set only for deprecated models: the active model that calls to this model are routed to. * Undefined for active models. */ replacedBy?: AiChatModelName; /** * Where the model comes from. Always set on `listChatModels()` results: * - 'vendor': a Squid-provided model from the vendor model registry. * - 'connector': provided by an integration configured on the app (OpenAI-compatible, Bedrock, Vertex). * - 'custom': a user-added model from the app's bundle (e.g. CLI agent models like Claude Code or Codex). */ source?: AiModelSource; } /** * Type guard to check if a model selection is integration-based. * @category AI */ export declare function isIntegrationModelSpec(model: unknown): model is { integrationId: string; model: string; };