-
Notifications
You must be signed in to change notification settings - Fork 0
Update docs #6
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
base: main
Are you sure you want to change the base?
Update docs #6
Conversation
… API key. 2. Fixed linter violations in quickstart.md.
… request data - Updated backend logic to check for "index_name" and "namespace" in incoming request data (payload, query params, or kwargs) and use them if provided, falling back to environment variables only if not present. - Refactored Pinecone utility functions and all relevant endpoints in ingestor_server and rag_server to support request-level overrides for index and namespace. - Improves flexibility for multi-tenant and dynamic index/namespace selection in API calls. - Maintains backward compatibility with existing environment variable configuration.
There was a problem hiding this 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 enhances backend flexibility by allowing API clients to override the default Pinecone index and namespace using request data. Key changes include updating utility functions to accept override values, modifying server startup and ingestion methods accordingly, and updating documentation and notebooks to reflect the switch from Milvus to Pinecone.
- Updated Pinecone utility functions (get_index, create_index, add_documents) to use request-level overrides.
- Modified server and ingestion endpoints in rag_server and ingestor_server to support dynamic index/namespace values.
- Updated notebooks and docs to reflect the Pinecone changes and improved API usage instructions.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
src/utils/pinecone_utils.py | Updated functions to accept **kwargs override values for index_name and namespace. |
src/rag_server/server.py | Modified the startup_event to use request overrides for index_name. |
src/ingestor_server/main.py | Refactored functions to adopt index/namespace parameters instead of collection names. |
notebooks/launchable.ipynb | Updated git clone URL and installation instructions from NVIDIA to Pinecone. |
notebooks/ingestion_api_usage.ipynb | Updated API usage examples and request payloads to align with Pinecone. |
docs/quickstart.md | Revised documentation to include Pinecone API key instructions and updated wording. |
Comments suppressed due to low confidence (1)
notebooks/ingestion_api_usage.ipynb:330
- The variable 'pc' is used but not defined within the scope of the delete_documents function. Obtain the Pinecone client instance prior to using it (e.g., by calling get_pinecone_client()).
" index = pc.Index(index)\n",
notebooks/ingestion_api_usage.ipynb
Outdated
" }\n", | ||
"\n", | ||
" HEADERS = {\"Content-Type\": \"application/json\"}\n", | ||
"\n", | ||
" async with aiohttp.ClientSession() as session:\n", | ||
" try:\n", | ||
" async with session.post(f\"{BASE_URL}/v1/collections\", params=params, json=collection_names, headers=HEADERS) as response:\n", | ||
" async with session.post(f\"{BASE_URL}/v1/collections\", params=params, json=create_index, headers=HEADERS) as response:\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The payload passed as json is the function 'create_index' instead of a proper data object. Ensure that a valid JSON serializable dictionary is provided to the API endpoint.
" async with session.post(f\"{BASE_URL}/v1/collections\", params=params, json=create_index, headers=HEADERS) as response:\n", | |
" async with session.post(f\"{BASE_URL}/v1/collections\", params=params, json=params, headers=HEADERS) as response:\n", |
Copilot uses AI. Check for mistakes.
" if fetched_count is None:\n", | ||
" # Pinecone does not return total count, so we estimate as we go\n", | ||
" fetched_count = len(vectors)\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable 'fetched_count' is used without prior initialization. Initialize and update 'fetched_count' appropriately in the pagination loop.
" if fetched_count is None:\n", | |
" # Pinecone does not return total count, so we estimate as we go\n", | |
" fetched_count = len(vectors)\n", | |
" fetched_count += len(vectors)\n", |
Copilot uses AI. Check for mistakes.
notebooks/ingestion_api_usage.ipynb
Outdated
"\n", | ||
"await delete_collections(collection_names=[\"multimodal_data\"])" | ||
"await delete_namespaces(index=\"nvidia-rag-index\", namespace=\"multimodal_data\")" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function delete_namespaces expects a parameter 'namespaces' but is being called with 'namespace'. Update the call to use the correct parameter name for consistency with the function definition.
"await delete_namespaces(index=\"nvidia-rag-index\", namespace=\"multimodal_data\")" | |
"await delete_namespaces(index=\"nvidia-rag-index\", namespaces=[\"multimodal_data\"])" |
Copilot uses AI. Check for mistakes.
Allow Backend to Override Pinecone
index_name
andnamespace
via Request DataOverview
This PR enhances the flexibility of the backend by allowing API clients to specify the Pinecone
index_name
andnamespace
directly in the request payload or query parameters. If these values are provided in the request, they will be used for all Pinecone operations; otherwise, the backend will fall back to the default values set in environment variables.Key Changes
index_name
andnamespace
in the incoming request data (payload, query params, or kwargs).get_index
) to accept and use request-level overrides.ingestor_server
andrag_server
now support dynamic index/namespace selection.Motivation
Testing
index_name
and/ornamespace
use the provided values.