davidfearne
commited on
Update retriever.py
Browse files- retriever.py +9 -4
retriever.py
CHANGED
@@ -5,13 +5,15 @@ from langchain_openai import AzureOpenAIEmbeddings
|
|
5 |
import uuid
|
6 |
import pandas as pd
|
7 |
import streamlit as st
|
8 |
-
|
9 |
# Initialize Pinecone client
|
10 |
-
pc = Pinecone(api_key=st.secrets["PC_API_KEY"])
|
|
|
11 |
index = pc.Index("openai-serverless")
|
12 |
|
13 |
# Azure OpenAI configuration
|
14 |
-
os.environ["AZURE_OPENAI_API_KEY"] = st.secrets["api_key"]
|
|
|
15 |
os.environ["AZURE_OPENAI_ENDPOINT"] = "https://davidfearn-gpt4.openai.azure.com/"
|
16 |
os.environ["AZURE_OPENAI_DEPLOYMENT_NAME"] = "text-embedding-ada-002"
|
17 |
os.environ["AZURE_OPENAI_API_VERSION"] = "2024-08-01-preview"
|
@@ -23,7 +25,10 @@ embeddings_model = AzureOpenAIEmbeddings(
|
|
23 |
openai_api_version=os.environ["AZURE_OPENAI_API_VERSION"],
|
24 |
)
|
25 |
|
26 |
-
def retriever(query
|
|
|
|
|
|
|
27 |
"""
|
28 |
Embeds a query string and searches the vector database for similar entries.
|
29 |
|
|
|
5 |
import uuid
|
6 |
import pandas as pd
|
7 |
import streamlit as st
|
8 |
+
import os
|
9 |
# Initialize Pinecone client
|
10 |
+
# pc = Pinecone(api_key=st.secrets["PC_API_KEY"])
|
11 |
+
pc = Pinecone(api_key="567aca04-6fb0-40a0-ba92-a5ed30be190b")
|
12 |
index = pc.Index("openai-serverless")
|
13 |
|
14 |
# Azure OpenAI configuration
|
15 |
+
# os.environ["AZURE_OPENAI_API_KEY"] = st.secrets["api_key"]
|
16 |
+
os.environ["AZURE_OPENAI_API_KEY"] = "86b631a9c0294e9698e327c59ff5ac2c"
|
17 |
os.environ["AZURE_OPENAI_ENDPOINT"] = "https://davidfearn-gpt4.openai.azure.com/"
|
18 |
os.environ["AZURE_OPENAI_DEPLOYMENT_NAME"] = "text-embedding-ada-002"
|
19 |
os.environ["AZURE_OPENAI_API_VERSION"] = "2024-08-01-preview"
|
|
|
25 |
openai_api_version=os.environ["AZURE_OPENAI_API_VERSION"],
|
26 |
)
|
27 |
|
28 |
+
def retriever(query):
|
29 |
+
|
30 |
+
namespace="gskRegIntel"
|
31 |
+
top_k=3
|
32 |
"""
|
33 |
Embeds a query string and searches the vector database for similar entries.
|
34 |
|