Skip to content

Conversation

juchengquan
Copy link

@juchengquan juchengquan commented Jul 10, 2025

Summary

This PR addresses issues with proxy handling in the AsyncTavilyClient class by ensuring that proxies are correctly mapped and passed to httpx.AsyncClient. The changes improve compatibility with custom proxy settings and environment variables.

Relates to the issue #123.

Changes

  • Bug fixes:

    • Refactored the __init__ method of AsyncTavilyClient:
    • The httpx.AsyncClient is now initialized with the correct proxy configuration using httpx.AsyncHTTPTransport.
    • No changes to the public API or method signatures.
    • All existing async methods (search, extract, crawl, map, etc.) remain compatible.
  • Code refraction:

    • Removed unused imports and added better module export.
    • Improved exception handling specifying ImportError for cohere client in hybrid_rag.py.
    • Standardization of string quotes and formatting for enhanced code readability and consistency.
    • Updated Tavily Client constructor parameters to use Optional types for better type hinting.
    • Cleaned up code formatting and removed unnecessary comments for clarity.

Checklist

  • No breaking changes to the API.
  • All tests pass.

Bug fixes:
- Replace `self._client_creator` with `self._client` to avoid crash in async.gather when setting up proxies in `proxy_mounts`

Code refraction:
- Removed unused imports and added better module export.
- Improved exception handling specifying ImportError for cohere client in `hybrid_rag.py`.
- Standardization of string quotes and formatting for enhanced code readability and consistency.
- Updated Tavily Client constructor parameters to use Optional types for better type hinting.
- Cleaned up code formatting and removed unnecessary comments for clarity.
@juchengquan juchengquan changed the title Fix ReadError in during async concurrent requests and related modules Fix ReadError in AsyncTavilyClient during async concurrent requests and related modules Jul 10, 2025
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