Fix Pinecone API compatibility for v6.x

Update embedding service to use new Pinecone API syntax:
- Import ServerlessSpec from pinecone package
- Add spec parameter to create_index() call with AWS serverless configuration
- Resolves TypeError: missing required positional argument 'spec'
- Maintains existing functionality with updated API requirements
This commit is contained in:
Aherobo Ovie Victor
2025-07-18 00:52:51 +01:00
parent 11db2bc697
commit c7caf06db5
+6 -2
View File
@@ -1,7 +1,7 @@
import cohere
from typing import List, Dict, Any, Optional
import uuid
from pinecone import Pinecone
from pinecone import Pinecone, ServerlessSpec
import weaviate
from loguru import logger
@@ -31,7 +31,11 @@ class EmbeddingService:
pc.create_index(
name=settings.PINECONE_INDEX_NAME,
dimension=1024, # Cohere embed-english-v3.0 dimension
metric="cosine"
metric="cosine",
spec=ServerlessSpec(
cloud='aws',
region='us-east-1'
)
)
# Return the index