Skip to content

Fix: add retry logic to LiteLLM embedding for transient 500 errors#396

Merged
ArnavAgrawal03 merged 3 commits intomainfrom
arnav/fix-embedding-retry
Apr 2, 2026
Merged

Fix: add retry logic to LiteLLM embedding for transient 500 errors#396
ArnavAgrawal03 merged 3 commits intomainfrom
arnav/fix-embedding-retry

Conversation

@ArnavAgrawal03
Copy link
Copy Markdown
Collaborator

Summary

  • Adds num_retries=3 to the litellm.aembedding() call, matching the retry behavior already present in the completion path.
  • Fixes issue Add enforcement of user immutable fields in document ingestion and up… #272 where transient OpenAI 500 errors during embedding generation would propagate as unhandled exceptions, returning 500s to users.
  • LiteLLM's built-in retry mechanism handles exponential backoff automatically.

Test plan

  • Verify embedding calls succeed under normal conditions
  • Confirm transient provider errors are retried before surfacing to the caller

ArnavAgrawal03 and others added 3 commits April 2, 2026 14:33
The embedding path lacked num_retries, causing OpenAI 500 errors to
propagate as unhandled exceptions. The completion path already uses
num_retries=3; this aligns embedding to match.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The test was running the Morphik container standalone without any
database or cache, causing the entrypoint to timeout waiting for
PostgreSQL. Now spins up pgvector and Redis containers in a shared
Docker network, fixes the POSTGRES_URI scheme, and disables ColPali
to avoid loading ML models in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Settings model expects a list[str] for MORPHIK_EMBEDDING_API_DOMAIN
but the CI test config provided a plain string. Fixed by:
1. Using a list in the CI test TOML config
2. Adding a defensive str-to-list coercion in config.py for robustness

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ArnavAgrawal03 ArnavAgrawal03 merged commit 6fdfe25 into main Apr 2, 2026
9 checks passed
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