-
Notifications
You must be signed in to change notification settings - Fork 0
Indexing Router Integration with VectorDBClient and Pinecone API integration #24
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
Indexing Router Integration with VectorDBClient and Pinecone API integration #24
Conversation
… creation functionality
WalkthroughMigrates api/indexing_router.py from VectorDBService to VectorDBClient, adds index preparation (sanitized index name and create_index), updates upsert call to upsert_vectors, and introduces structured logging and refined error handling. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant Router as Indexing Router
participant VDB as VectorDBClient
participant Util as sanitize_index_name
Client->>Router: POST /index { project_id, vectors, ids }
note over Router: Initialize logger and VectorDBClient
Router->>Util: sanitize(project_id)
Util-->>Router: index_name
Router->>VDB: create_index(index_name)
alt create_index fails
Router-->>Client: 500 VECTOR_DB_UPSERT_FAILED
else create_index ok
Router->>VDB: upsert_vectors(vectors, ids)
alt upsert raises ValueError
Router-->>Client: 422 Unprocessable Entity
else upsert raises other Exception
Router-->>Client: 500 VECTOR_DB_UPSERT_FAILED
else upsert ok
Router-->>Client: 200 OK
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks (2 passed, 1 warning)❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal). Please share your feedback with us on this Discord post. ✨ Finishing touches
🧪 Generate unit tests
Comment |
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.
Actionable comments posted: 3
🧹 Nitpick comments (1)
api/indexing_router.py (1)
28-31
: Remove innerimport logging
; define a module-level logger to avoid F811 and duplicate setup.Re-importing
logging
inside the handler shadows the module import and triggers Ruff F811. Prefer a module-level logger and reuse it.Apply:
- import logging - logger = logging.getLogger("indexing_router") vdb = VectorDBClient() - logger.info("Pinecone VectorDBClient instantiated.")Then (outside this hunk), add once near the imports:
# at module top, near other imports logger = logging.getLogger("indexing_router")
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
api/indexing_router.py
(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
api/indexing_router.py (2)
services/vector_db_service.py (4)
VectorDBClient
(10-56)create_index
(24-35)upsert_vectors
(37-49)__init__
(10-25)tests/test_vector_db_service.py (1)
vdb
(17-20)
🪛 Ruff (0.12.2)
api/indexing_router.py
28-28: Redefinition of unused logging
from line 11
Remove definition: logging
(F811)
89-89: Within an except
clause, raise exceptions with raise ... from err
or raise ... from None
to distinguish them from errors in exception handling
(B904)
90-90: Do not catch blind exception: Exception
(BLE001)
91-91: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
🔇 Additional comments (1)
api/indexing_router.py (1)
7-7
: Good swap to the new client.Switching to
VectorDBClient
aligns with the refactor direction.
85b0cb3
into
feature/vector-db-service-refactor-and-tests
Overview
This PR refactors the
/internal/index
endpoint to fully adopt the newVectorDBClient
for Pinecone integration. It introduces stricter index management, better error handling, and improved observability, ensuring the indexing pipeline is reliable and production-ready.Features
VectorDBClient Integration
VectorDBClient
.Index Name Sanitization
Enforced Pinecone-compliant naming:
Prevents runtime failures due to invalid index names.
Enhanced Observability
Fixes
Refactors
Simplified endpoint workflow:
Streamlined error-handling logic to reduce duplication.
Updated internal documentation and inline comments for future maintainers.
Acceptance Criteria
/internal/index
works reliably withVectorDBClient
.Summary by CodeRabbit