Interface for OllamaEmbeddings parameters. Extends EmbeddingsParams and defines additional parameters specific to the OllamaEmbeddings class.

interface OllamaEmbeddingsParams {
    baseUrl?: string;
    fetch?: {
        (input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
        (input: string | Request | URL, init?: RequestInit): Promise<Response>;
    };
    headers?: Record<string, string> | Headers;
    keepAlive?: string | number;
    maxConcurrency?: number;
    maxRetries?: number;
    model?: string;
    onFailedAttempt?: FailedAttemptHandler;
    requestOptions?: OllamaCamelCaseOptions & Partial<Options>;
    truncate?: boolean;
}

Hierarchy

  • EmbeddingsParams
    • OllamaEmbeddingsParams

Properties

baseUrl?: string

Base URL of the Ollama server

"http://localhost:11434"
fetch?: {
    (input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
    (input: string | Request | URL, init?: RequestInit): Promise<Response>;
}

The fetch function to use.

Type declaration

    • (input, init?): Promise<Response>
    • Parameters

      • input: RequestInfo | URL
      • Optionalinit: RequestInit

      Returns Promise<Response>

    • (input, init?): Promise<Response>
    • Parameters

      • input: string | Request | URL
      • Optionalinit: RequestInit

      Returns Promise<Response>

fetch
headers?: Record<string, string> | Headers

Optional HTTP Headers to include in the request.

keepAlive?: string | number

Defaults to "5m"

maxConcurrency?: number

The maximum number of concurrent calls that can be made. Defaults to Infinity, which means no limit.

maxRetries?: number

The maximum number of retries that can be made for a single call, with an exponential backoff between each attempt. Defaults to 6.

model?: string

The Ollama model to use for embeddings.

"mxbai-embed-large"
onFailedAttempt?: FailedAttemptHandler

Custom handler to handle failed attempts. Takes the originally thrown error object as input, and should itself throw an error if the input error is not retryable.

requestOptions?: OllamaCamelCaseOptions & Partial<Options>

Advanced Ollama API request parameters in camelCase, see https://github.com/ollama/ollama/blob/main/docs/modelfile.md#valid-parameters-and-values for details of the available parameters.

truncate?: boolean

Whether or not to truncate the input text to fit inside the model's context window.

false