Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
@@ -2,10 +2,21 @@ from sentence_transformers import SentenceTransformer
|
|
2 |
import pinecone
|
3 |
import openai
|
4 |
import streamlit as st
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
7 |
|
8 |
-
pinecone.init(api_key=
|
9 |
index = pinecone.Index('langchain-chatbot')
|
10 |
|
11 |
def find_match(input):
|
|
|
2 |
import pinecone
|
3 |
import openai
|
4 |
import streamlit as st
|
5 |
+
import os
|
6 |
+
from dotenv import load_dotenv
|
7 |
+
|
8 |
+
# Load environment variables from .env file
|
9 |
+
load_dotenv()
|
10 |
+
|
11 |
+
# Access OpenAI and Pinecone API keys from environment variables
|
12 |
+
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
|
13 |
+
PINECONE_API_KEY = os.getenv("PINECONE_API_KEY")
|
14 |
+
|
15 |
+
OPENAI_API_KEY= OPENAI_API_KEY
|
16 |
+
|
17 |
model = SentenceTransformer('all-MiniLM-L6-v2')
|
18 |
|
19 |
+
pinecone.init(api_key=PINECONE_API_KEY, environment='asia-southeast1-gcp-free')
|
20 |
index = pinecone.Index('langchain-chatbot')
|
21 |
|
22 |
def find_match(input):
|