Skip to content

Add OpenAI embeddings instrumentation - #81

Merged
piotrekno1 merged 1 commit into
develfrom
feat/openai-embeddings
Oct 20, 2026
Merged

piotrekno1 merged 1 commit into
develfrom
feat/openai-embeddings

Conversation

@piotrekno1

Copy link
Copy Markdown
Collaborator

Applications calling client.embeddings.create() currently emit no inference telemetry. This adds sync and async embeddings instrumentation, recording latency, provider-reported input tokens, batch size, dimensions, resolved model metadata, and API errors. Text, string batches, token IDs, and token-ID batches are handled without consuming arbitrary input iterables. Application responses are returned unchanged; raw inputs and vectors are not uploaded.

Adds optional tokens_in to EmbeddingOutputMeta, matching the existing ingest schema and analytics extraction path, so embedding input usage is queryable. Dimensions are measured from returned float vectors or decoded float32 byte length for explicit base64 output. Embeddings do not report generated tokens or TTFT.

Includes a runnable sync/async example, documentation, unit tests, and real OpenAI SDK tests using mocked HTTP. This PR is independently based on devel; it does not include or depend on the Responses changes in #80.

Validation

  • Full suite: 722 passed, 28 skipped.
  • OpenAI compatibility suite: 7 passed against openai 3.35.1, covering sync/async and float/base64 embeddings alongside existing Chat Completions tests.
  • Ruff lint, formatting, and diff whitespace checks pass.
  • Local process-compose WildEdge verification: ran both example paths with mocked OpenAI responses; ingest accepted four events, rejected zero. Queried Iceberg and confirmed two inference events and two spans, correct parent linkage, input usage 7, dimensions 3, no generated-token count or TTFT, and no vectors in stored event data. Run ID: embeddings-local-e2e-0b23ac028d21.
  • Live OpenAI requests were not tested; provider payloads were deterministic fixtures.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Coverage report

  • Total: 88% (10314/11749 lines)

Top uncovered files

  • wildedge/integrations/mlx.py: 28.7% (122 lines missed)
  • wildedge/integrations/transformers.py: 62.9% (112 lines missed)
  • wildedge/integrations/ultralytics.py: 67.7% (86 lines missed)
  • wildedge/integrations/pytorch.py: 57.5% (79 lines missed)
  • wildedge/platforms/macos.py: 56.8% (67 lines missed)

@piotrekno1
piotrekno1 force-pushed the feat/openai-embeddings branch from ca1f3d4 to 9577047 Compare October 20, 2026 16:01
@piotrekno1
piotrekno1 merged commit 13c2d2b into devel Oct 20, 2026
14 checks passed
@piotrekno1
piotrekno1 deleted the feat/openai-embeddings branch October 20, 2026 16:09
@github-actions github-actions Bot mentioned this pull request Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant