fix(openai): add default 60s timeout to OpenAI clients#4450
Open
badhra-ajaz wants to merge 1 commit intomem0ai:mainfrom
Open
fix(openai): add default 60s timeout to OpenAI clients#4450badhra-ajaz wants to merge 1 commit intomem0ai:mainfrom
badhra-ajaz wants to merge 1 commit intomem0ai:mainfrom
Conversation
…and image loader Currently, both OpenAIAssistant and ImageLoader create OpenAI clients without timeout parameters, which means API calls can hang indefinitely on network issues, server unresponsiveness, or slow model responses. This causes: - RAG applications stuck waiting forever on assistant/vision API calls - Resource exhaustion when multiple embedchain apps run concurrently - Poor UX (no error feedback, hanging applications) - Wasted compute resources on hung HTTP requests This adds timeout=60.0 seconds to both OpenAI client instantiations. **PeakInfer Issue:** Missing default timeout on OpenAI clients **Impact:** Prevents indefinite hangs in assistants and vision operations **Category:** Reliability + Latency Changes: - assistants.py:44 - Added timeout=60.0 to OpenAI client for assistants - image.py:21 - Added timeout=60.0 to OpenAI client for vision operations This follows PeakInfer best practices for production LLM systems: - Prevents resource exhaustion from hung requests - Enables faster error detection and recovery - Improves system resilience under network issues - 60s timeout balances patience for vision/assistant operations vs system health 🤖 Generated with [PeakInfer](https://peakinfer.com) LLM inference optimization
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds default 60-second timeout to OpenAI clients in OpenAIAssistant and ImageLoader classes to prevent indefinite hangs on network issues.
Problem
Currently, embedchain creates OpenAI clients without timeout parameters in two locations, which causes:
Solution
Added
timeout=60.0to both OpenAI client instantiations:PeakInfer Analysis
Category: Reliability + Latency
Issue: Missing default timeout on OpenAI clients
Impact: Prevents indefinite hangs in assistants and vision operations
Testing
✅ Both sync OpenAI clients now have 60s timeout
✅ Applies to assistants API and vision API operations
✅ 60s timeout appropriate for both use cases
Benefits
🤖 Generated with PeakInfer LLM inference optimization