本页还没有译文
本页 6 段还没译成日本語,下面显示的是英文原文。AI SDK Core
还没翻译译自英文(ai-sdk.dev)本页 6 段都还没译
AI SDK Core is a set of functions that allow you to interact with language models and other AI models. These functions are designed to be easy-to-use and flexible, allowing you to generate text, structured data, and embeddings from language models and other AI models.
AI SDK Core contains the following main functions:
- generateText(): Generate text and call tools from a language model.
- streamText(): Stream text and call tools from a language model.
- Output: Structured output types for generateText and streamText.
- embed(): Generate an embedding for a single value using an embedding model.
- embedMany(): Generate embeddings for several values using an embedding model (batch embedding).
- generateImage(): Generate images based on a given prompt using an image model.
- experimental_generateVideo(): Generate videos based on a given prompt using a video model.
- experimental_startBatch(): Start an asynchronous text-generation batch.
- experimental_getBatchStatus(): Retrieve the status of an asynchronous batch.
- experimental_getBatchResults(): Retrieve terminal results from an asynchronous batch.
- experimental_cancelBatch(): Request cancellation of an asynchronous batch.
- experimental_listBatches(): List asynchronous batches and their latest statuses.
- transcribe(): Generate a transcript from an audio file.
- experimental_streamTranscribe(): Stream a transcript from live raw audio.
- experimental_streamTranslate(): Stream a speech-to-speech translation from live raw audio.
- generateSpeech(): Generate speech audio from text.
- experimental_streamSpeech(): Stream speech audio from text or a text stream.
- uploadFile(): Upload a file to a provider and get a provider reference.
- uploadSkill(): Upload a skill to a provider and get a provider reference.
It also contains the following helper functions:
- toolSearch(): Search deferred tools and load their definitions on demand.
- tool(): Type inference helper function for tools.
- experimental_getRealtimeToolDefinitions(): Convert AI SDK tools into realtime tool definitions.
- Experimental_SandboxSession: Experimental execution environment interface passed to tool execution.
- experimental_filterActiveTools(): Filters a tool set to only the currently active tools.
- createMCPClient(): Creates a client for connecting to MCP servers.
- MCP Events: Experimental event methods, webhook delivery, and subscription types.
- MCP Apps: Helpers for rendering interactive MCP tool UIs and filtering app-visible tools.
- jsonSchema(): Creates AI SDK compatible JSON schema objects.
- zodSchema(): Creates AI SDK compatible Zod schema objects.
- createProviderRegistry(): Creates a registry for using models from multiple providers.
- cosineSimilarity(): Calculates the cosine similarity between two vectors, e.g. embeddings.
- simulateReadableStream(): Creates a ReadableStream that emits values with configurable delays.
- wrapLanguageModel(): Wraps a language model with middleware.
- wrapImageModel(): Wraps an image model with middleware.
- extractReasoningMiddleware(): Extracts reasoning from the generated text and exposes it as a
reasoningproperty on the result. - extractJsonMiddleware(): Extracts JSON from text content by stripping markdown code fences.
- isStepCount(): Creates a stop condition that triggers after a specified number of steps.
- hasToolCall(): Creates a stop condition that triggers when any specified tool is called.
- isLoopFinished(): Creates a stop condition that lets the agent loop run until it naturally finishes.
- simulateStreamingMiddleware(): Simulates streaming behavior with responses from non-streaming language models.
- defaultSettingsMiddleware(): Applies default settings to a language model.
- defaultInstructionsMiddleware(): Applies default instructions to a language model.
- smoothStream(): Smooths text and reasoning streaming output.
- generateId(): Helper function for generating unique IDs
- createIdGenerator(): Creates an ID generator
AI 翻译查看英文原文