-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: update PineconeIndex to use aiohttp for async requests and … #520
base: main
Are you sure you want to change the base?
Conversation
…improve error handling - Replaced async_client with aiohttp.ClientSession for making asynchronous HTTP requests. - Added headers for API requests to enhance security and compatibility. - Simplified error handling by removing checks for async_client initialization. - Improved code readability and maintainability by consolidating request logic.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
…ient - Removed the async_client attribute and its related initialization logic. - Consolidated API key and headers setup into the constructor for clarity. - Enhanced code readability by eliminating redundant code and improving structure.
- Updated the constructor to retrieve the API key from environment variables if not provided. - Added a validation step to ensure the API key is present, raising a ValueError if missing. - Consolidated header management by using the instance's headers attribute for API requests, improving code clarity and maintainability.
User description
…improve error handling
PR Type
Enhancement, Bug fix
Description
Replaced
async_client
withaiohttp.ClientSession
for async HTTP requests.Added standardized headers for API requests.
Simplified error handling by removing
async_client
checks.Improved maintainability by consolidating request logic.
Changes walkthrough 📝
pinecone.py
Refactor async HTTP requests and error handling
semantic_router/index/pinecone.py
async_client
withaiohttp.ClientSession
for HTTP requests.async_client
initialization in error handling.aiohttp.ClientSession
.