Calculate cosine similarity between two vectors.
Calculate cosine similarity between two vectors.
First vector
Second vector
Cosine similarity (-1 to 1)
Find similar items from a corpus.
Find most similar items from a list of embeddings.
Query embedding
Array of candidate embeddings with associated data
Number of results to return
Top K most similar items with scores
Create a chat completion.
Optionaloptions: Partial<ChatOptions>Create a chat completion and return just the content.
Optionaloptions: Partial<ChatOptions>Chat with tool handling.
Optionaloptions: Partial<ChatOptions>Chat with structured output.
Optionaloptions: Partial<ChatOptions>Stream and accumulate full response.
Optionaloptions: Partial<ChatStreamOptions>OptionalonChunk: (delta: { content: string; chunk: ChatCompletionChunk }) => voidCreate a readable stream of content.
Optionaloptions: Partial<ChatStreamOptions>Create embeddings.
Optionaloptions: Partial<EmbeddingOptions>Create embedding for single text.
Optionaloptions: Partial<EmbeddingOptions>Create embeddings for multiple texts.
Optionaloptions: Partial<EmbeddingOptions>Generate a single image URL.
Optionaloptions: Partial<ImageGenerationOptions>Generate a single image as base64.
Optionaloptions: Partial<ImageGenerationOptions>List all available models.
Get model details.
List model IDs.
Check if a model exists.
Client for local OpenAI-compatible inference servers.
Supports chat, streaming, tool calling, and structured output via the same interface as OpenAIClient. The server is expected to implement the OpenAI Chat Completions API at the given
baseUrl.Example