Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,6 +42,8 @@ from datasets import load_dataset
|
|
| 42 |
from dotenv import load_dotenv
|
| 43 |
from pinecone import Pinecone
|
| 44 |
from PIL import Image
|
|
|
|
|
|
|
| 45 |
|
| 46 |
# Load environment variables
|
| 47 |
load_dotenv()
|
|
@@ -62,9 +64,11 @@ if not PINECONE_API_KEY:
|
|
| 62 |
|
| 63 |
# Initialize Hugging Face Embeddings & Pinecone
|
| 64 |
embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
|
| 65 |
-
pc = Pinecone(api_key=PINECONE_API_KEY)
|
| 66 |
-
vector_store = Pinecone.from_existing_index(index_name=INDEX_NAME, embedding=embeddings)
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
# Load LLM & Memory
|
| 69 |
llm = ChatAnthropic(
|
| 70 |
model="claude-2",
|
|
|
|
| 42 |
from dotenv import load_dotenv
|
| 43 |
from pinecone import Pinecone
|
| 44 |
from PIL import Image
|
| 45 |
+
from langchain_community.vectorstores import Pinecone
|
| 46 |
+
from pinecone import Pinecone as PineconeClient
|
| 47 |
|
| 48 |
# Load environment variables
|
| 49 |
load_dotenv()
|
|
|
|
| 64 |
|
| 65 |
# Initialize Hugging Face Embeddings & Pinecone
|
| 66 |
embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
|
|
|
|
|
|
|
| 67 |
|
| 68 |
+
# Initialize Pinecone client
|
| 69 |
+
pc = PineconeClient(api_key=PINECONE_API_KEY)
|
| 70 |
+
# Connect to existing Pinecone index
|
| 71 |
+
vector_store = Pinecone(index_name=INDEX_NAME, embedding_function=embeddings.embed_query, pinecone_api_key=PINECONE_API_KEY)
|
| 72 |
# Load LLM & Memory
|
| 73 |
llm = ChatAnthropic(
|
| 74 |
model="claude-2",
|