Skip to content

fix: retry on httpx exceptions in embedding requests#168

Merged
marcelklehr merged 1 commit into
masterfrom
fix/embedding-exceptions
Mar 29, 2025
Merged

fix: retry on httpx exceptions in embedding requests#168
marcelklehr merged 1 commit into
masterfrom
fix/embedding-exceptions

Conversation

@kyteinsky
Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a retry mechanism for embedding requests by catching specific httpx exceptions and non-200 HTTP responses, adding robustness to network calls.

  • Added retry logic with a default of 3 attempts for embedding requests
  • Implemented a sleep delay of 5 seconds between retries
  • Replaced the generic exception handler with more granular exception handling
Comments suppressed due to low confidence (1)

context_chat_backend/network_em.py:40

  • [nitpick] The parameter name 'try_' might be unclear; consider renaming it to 'retries' or 'attempts_left' for better clarity.
def _get_embedding(self, input_: str | list[str], try_: int = 3) -> list[float] | list[list[float]]:

Copy link
Copy Markdown
Member

@marcelklehr marcelklehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@marcelklehr marcelklehr merged commit 2b42c8a into master Mar 29, 2025
4 checks passed
kyteinsky added a commit that referenced this pull request Apr 1, 2025
## 4.1.1 - 2025-04-02

### Fixed
- do not fail access update requests if source is not found in db (#163)
@kyteinsky
- fix for when too many sources/chunks for postgres IN (#166)
@lukasdotcom
- retry on httpx exceptions in embedding requests (#168) @kyteinsky

Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
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.

3 participants