Skip to content

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

Open
nicoloesch wants to merge 2 commits into
mainfrom
catch-embeddings-error
Open

Wrap embedding API errors in EmbeddingClientError instead of letting them propagate raw#46
nicoloesch wants to merge 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
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