UNPKG

ai-functions

Version:

Core AI primitives for building intelligent applications

44 lines 6.76 kB
/** * ai-functions - Full-featured AI primitives for building intelligent applications * * This package provides the complete feature set including: * - Core primitives from ai-core (generate, AIPromise, templates, context) * - Batch processing (BatchQueue, BatchMapPromise) * - Retry/resilience patterns (RetryPolicy, CircuitBreaker, FallbackChain) * - Budget tracking (BudgetTracker, TokenCounter) * - Caching (MemoryCache, EmbeddingCache, GenerationCache) * - Tool orchestration (AgenticLoop, ToolRouter) * - Embeddings * - Provider integrations * * For lightweight usage with just core primitives, use ai-core directly. * * @packageDocumentation */ export type { AIFunctionDefinition, JSONSchema, AIGenerateOptions, AIGenerateResult, AIFunctionCall, AIClient, ImageOptions, ImageResult, VideoOptions, VideoResult, WriteOptions, TemplateFunction as CoreTemplateFunction, ListItem, ListResult, NamedList, ListsResult, CodeLanguage, GenerativeOutputType, HumanChannel, LegacyHumanChannel, SchemaLimitations, BaseFunctionDefinition, CodeFunctionDefinition, CodeFunctionResult, CodeGenerationDefinition, GenerativeFunctionDefinition, GenerativeFunctionResult, AgenticFunctionDefinition, AgenticExecutionState, HumanFunctionDefinition, HumanFunctionResult, FunctionDefinition, DefinedFunction, FunctionRegistry, AutoDefineResult, SandboxEnv, } from './types.js'; export { schema, type SimpleSchema } from './schema.js'; export { parseTemplate, createTemplateFunction, createChainablePromise, createStreamableList, withBatch, type FunctionOptions, type TemplateFunction, type BatchableFunction, type StreamableList, type ChainablePromise, } from './template.js'; export { AIPromise, isAIPromise, getRawPromise, createTextPromise, createObjectPromise, createListPromise, createListsPromise, createBooleanPromise, createExtractPromise, createAITemplateFunction, parseTemplateWithDependencies, AI_PROMISE_SYMBOL, RAW_PROMISE_SYMBOL, type AIPromiseOptions, type StreamingAIPromise, type StreamOptions, } from './ai-promise.js'; export { generateObject, generateText, streamObject, streamText } from './generate.js'; export { generate, type GenerateType, type GenerateOptions, ai, write, code, list, lists, extract, summarize, is, diagram, slides, image, video, do, research, read, browse, decide, ask, approve, review, type HumanOptions, type HumanResult, } from './primitives.js'; export { configure, getContext, withContext, getGlobalContext, resetContext, getModel, getProvider, type ExecutionContext, } from './context.js'; export { isZodSchema } from './type-guards.js'; export { AI, ai as aiProxy, define, defineFunction, functions, createFunctionRegistry, resetGlobalRegistry, withTemplate, type AIProxy, createSchemaFunctions, type AISchemaOptions, type SchemaFunctions, type InferSimpleSchemaResult, createDefinedFunction, convertArgsToJSONSchema, fillTemplate, generateCode, generateAndRunCode, type GeneratedCodeRunResult, } from './ai.js'; export { ai as aiPrompt } from './primitives.js'; export * from './embeddings.js'; export * from './providers/index.js'; export { BatchQueue, createBatch, withBatch as withBatchQueue, registerBatchAdapter, getBatchAdapter, registerFlexAdapter, getFlexAdapter, hasFlexAdapter, tiersForModel, modelSupportsTier, isBatchMode, deferToBatch, BATCH_MODE_SYMBOL, type BatchMode as BatchQueueMode, type BatchProvider, type BatchStatus, type BatchItem, type BatchJob, type BatchResult, type BatchSubmitResult, type BatchAdapter, type FlexAdapter, type BatchQueueOptions, type DeferredOptions, } from './batch-queue.js'; export { policyFor as modelPolicyFor, type ModelPolicy, type BatchTier, type RetryPolicyData, type CircuitBreakerPolicyData, type ErrorCategoryName, } from 'language-models'; export { BatchMapPromise, createBatchMap, isBatchMapPromise, BATCH_MAP_SYMBOL, type CapturedOperation, type BatchMapOptions, } from './batch-map.js'; export { getBatchMode, getBatchThreshold, shouldUseBatchAPI, getFlexThreshold, getExecutionTier, isFlexAvailable, type BatchMode, type ContextBudgetConfig, type ExecutionTier, } from './context.js'; export { BudgetTracker, TokenCounter, RequestContext, BudgetExceededError, createRequestContext, withBudget, type BudgetConfig, type BudgetAlert, type BudgetSnapshot, type TokenUsage, type RequestInfo, type RequestContextOptions, type ModelPricing, type WithBudgetOptions, type RemainingBudget, type CheckBudgetOptions, } from './budget.js'; export { AgenticLoop, ToolRouter, ToolValidator, createTool, createToolset, wrapTool, cachedTool, rateLimitedTool, timeoutTool, createAgenticLoop, type Tool, type ToolCall, type ToolResult, type FormattedToolResult, type ValidationResult, type ModelResponse, type Message, type StepInfo, type LoopOptions, type RunOptions, type ToolCallResult, type SDKToolResult, type LoopResult, type LoopStreamEvent, } from './tool-orchestration.js'; export { MemoryCache, EmbeddingCache, GenerationCache, withCache, hashKey, createCacheKey, type CacheStorage, type CacheEntry, type CacheOptions, type CacheStats, type MemoryCacheOptions, type CacheKeyType, type EmbeddingCacheOptions, type BatchEmbeddingResult, type GenerationParams, type GenerationCacheGetOptions, type WithCacheOptions, type CachedFunction, } from './cache.js'; export { RetryableError, NonRetryableError, NetworkError, RateLimitError, CircuitOpenError, ErrorCategory, classifyError, calculateBackoff, RetryPolicy, CircuitBreaker, FallbackChain, withRetry, type JitterStrategy, type BackoffOptions, type RetryOptions, type RetryInfo, type BatchItemResult, type CircuitState, type CircuitBreakerOptions, type CircuitBreakerMetrics, type FallbackModel, type FallbackOptions, type FallbackMetrics, } from './retry.js'; export { DigitalObjectsFunctionRegistry, createDigitalObjectsRegistry, FUNCTION_NOUNS, FUNCTION_VERBS, type StoredFunctionDefinition, type FunctionCallData, type DigitalObjectsRegistryOptions, } from './digital-objects-registry.js'; export { configureLogger, getLogger, resetLogger, getLogLevel, setLogLevel, type Logger, type LoggerConfig, } from './logger.js'; export { cacheMiddleware, embeddingCacheMiddleware, budgetMiddleware, traceMiddleware, type CacheMiddlewareOptions, type CacheMiddlewareStore, type EmbedCacheMiddlewareOptions, type EmbedCacheMiddlewareStore, type BudgetMiddlewareOptions, type PricingOverlay, type TraceEvent, type TraceEventKind, type TraceMiddlewareOptions, } from './middleware/index.js'; export { wrapForV3, type WrapForV3Options } from './wrap-for-v3.js'; export type { LanguageModelV3 } from '@ai-sdk/provider'; export { InMemoryEvalLogStore, getEvalLogStore, configureEvalLogStore, type EvalLogEntry, type EvalLogListOptions, type EvalLogStore, } from './eval-log/index.js'; //# sourceMappingURL=index.d.ts.map