AI SDK Core
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.
generateObject()
Generate structured data from a language model.
streamObject()
Stream structured data from a language model.
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.
It also contains the following helper functions:
tool()
Type inference helper function for tools.
jsonSchema()
Creates AI SDK compatible JSON schema objects.
createProviderRegistry()
Creates a registry for using models from multiple providers.
cosineSimilarity()
Calculates the cosine similarity between two vectors, e.g. embeddings.
smoothStream()
Smooths text streaming output.