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:
@@ -1,7 +1,7 @@
|
|||||||
import cohere
|
import cohere
|
||||||
from typing import List, Dict, Any, Optional
|
from typing import List, Dict, Any, Optional
|
||||||
import uuid
|
import uuid
|
||||||
from pinecone import Pinecone
|
from pinecone import Pinecone, ServerlessSpec
|
||||||
import weaviate
|
import weaviate
|
||||||
from loguru import logger
|
from loguru import logger
|
||||||
|
|
||||||
@@ -31,7 +31,11 @@ class EmbeddingService:
|
|||||||
pc.create_index(
|
pc.create_index(
|
||||||
name=settings.PINECONE_INDEX_NAME,
|
name=settings.PINECONE_INDEX_NAME,
|
||||||
dimension=1024, # Cohere embed-english-v3.0 dimension
|
dimension=1024, # Cohere embed-english-v3.0 dimension
|
||||||
metric="cosine"
|
metric="cosine",
|
||||||
|
spec=ServerlessSpec(
|
||||||
|
cloud='aws',
|
||||||
|
region='us-east-1'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Return the index
|
# Return the index
|
||||||
|
|||||||
Reference in New Issue
Block a user