Skip to content

[bot] Ollama JS SDK (ollama) not instrumented — no tracing for local LLM chat, generation, or embedding calls #2007

@braintrust-bot

Description

@braintrust-bot

Summary

The Ollama JavaScript SDK (ollama on npm, v0.6.3, ~607K weekly downloads) provides execution APIs for running LLM inference locally via an Ollama server. It has a distinct, non-OpenAI-compatible TypeScript API covering chat completions, text generation, and embeddings. This repository has zero instrumentation for any Ollama SDK surface — no wrapper, no channels, no plugin, no auto-instrumentation config. Users who call the ollama JS SDK directly get no Braintrust spans.

What instrumentation is missing

The ollama npm package exposes these execution surfaces, none of which are instrumented:

SDK Method Description
ollama.chat({ model, messages }) Chat completions with conversation history and tool use
ollama.generate({ model, prompt }) Raw prompt-based text generation
ollama.embed({ model, input }) Generate text embeddings
Streaming variants (stream: true on any of the above) Returns AsyncGenerator yielding incremental chunks

These methods use Ollama-specific request/response schemas and differ from the OpenAI SDK API shape. Users cannot use wrapOpenAI() or any existing wrapper with the ollama npm SDK.

No coverage in any instrumentation layer:

  • No wrapper function (e.g. wrapOllama())
  • No diagnostics channels for Ollama methods
  • No plugin handler in js/src/instrumentation/plugins/
  • No auto-instrumentation config in js/src/auto-instrumentations/configs/
  • No e2e test scenarios

A search for ollama across js/src/ returns zero matches.

Indirect coverage exists but is limited:

Users can access Ollama models through the Vercel AI SDK (@ai-sdk/ollama provider), which is instrumented. However, users who call the ollama npm SDK directly — which is the primary SDK documented by Ollama — get no tracing. While Ollama also exposes an OpenAI-compatible REST endpoint, the ollama SDK's own type-safe API does not route through the openai package and is not patched by the OpenAI plugin.

Context

Ollama is the dominant platform for local LLM inference in development environments, and the ollama npm SDK is its TypeScript-first client with ~607K weekly downloads. The SDK supports streaming, multimodal inputs, and tool calling via its own distinct API surface.

Braintrust docs status

not_found — Braintrust does not have a dedicated Ollama SDK instrumentation page. The Ollama SDK is not listed on https://www.braintrust.dev/docs/guides/tracing or the integrations index.

Upstream references

Local files inspected

  • js/src/auto-instrumentations/configs/ — no Ollama config entry
  • js/src/instrumentation/plugins/ — no Ollama channels or plugin
  • e2e/scenarios/ — no Ollama test scenarios
  • Full repo grep for ollama in js/src/ — zero matches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions