Skip to content

Wrap embedding API errors in EmbeddingClientError instead of letting them propagate raw - #46

Merged
nicoloesch merged 2 commits into
mainfrom
catch-embeddings-error
Aug 5, 2026
Merged

Wrap embedding API errors in EmbeddingClientError instead of letting them propagate raw#46
nicoloesch merged 2 commits into
mainfrom
catch-embeddings-error

Conversation

@nicoloesch

Copy link
Copy Markdown
Collaborator

Summary

  • EmbeddingClient.embeddings() and the embedding_dim live probe now catch openai.APIError around the underlying .embeddings.create() calls and re-raise as EmbeddingClientError
    • callers get a richer, more actionable message instead of a raw SDK exception with no context.
  • The message names plausible causes (oversized input, auth, rate-limit, connectivity) without asserting a specific diagnosis, since the true cause can vary by provider and isn't reliably detectable from the exception alone.
  • No proactive token/length limit added
    • per-model limits vary and a hardcoded cap would be arbitrary and go stale.

Related to conversation here: AustralianCancerDataNetwork/omop-graph#29 (comment)

@nicoloesch
nicoloesch force-pushed the catch-embeddings-error branch from 95a8ebb to 34ca6d7 Compare July 23, 2026 00:06
@nicoloesch nicoloesch added the fix Bug fix, backwards-compatible. PATCH: x.y.z+1 label Aug 5, 2026
@nicoloesch
nicoloesch merged commit e07b603 into main Aug 5, 2026
3 of 4 checks passed
@nicoloesch
nicoloesch deleted the catch-embeddings-error branch August 5, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix, backwards-compatible. PATCH: x.y.z+1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants