Spaces:
Runtime error
Runtime error
Update rag.py
Browse files
rag.py
CHANGED
@@ -42,7 +42,7 @@ def generate_embeddings_and_vectorstore(path):
|
|
42 |
#print('docs')
|
43 |
#print(docs)
|
44 |
|
45 |
-
fc_embeddings = OpenAIEmbeddings(openai_api_key=os.
|
46 |
vectorstore = Chroma.from_documents(docs, fc_embeddings)
|
47 |
|
48 |
return vectorstore
|
@@ -71,7 +71,7 @@ class Rag:
|
|
71 |
self.qa = ConversationalRetrievalChain.from_llm(
|
72 |
llm=ChatOpenAI(model_name="gpt-3.5-turbo",
|
73 |
temperature=0.3,
|
74 |
-
openai_api_key=os.
|
75 |
max_tokens=int(int(max_words) + (int(max_words) / 2))), #número máximo de tokens para a resposta
|
76 |
memory=self.memory,
|
77 |
retriever=vectorstore.as_retriever(), #search_kwargs={'k': 3}
|
|
|
42 |
#print('docs')
|
43 |
#print(docs)
|
44 |
|
45 |
+
fc_embeddings = OpenAIEmbeddings(openai_api_key=os.environ['OPENAI_KEY'])
|
46 |
vectorstore = Chroma.from_documents(docs, fc_embeddings)
|
47 |
|
48 |
return vectorstore
|
|
|
71 |
self.qa = ConversationalRetrievalChain.from_llm(
|
72 |
llm=ChatOpenAI(model_name="gpt-3.5-turbo",
|
73 |
temperature=0.3,
|
74 |
+
openai_api_key=os.environ['OPENAI_KEY'],
|
75 |
max_tokens=int(int(max_words) + (int(max_words) / 2))), #número máximo de tokens para a resposta
|
76 |
memory=self.memory,
|
77 |
retriever=vectorstore.as_retriever(), #search_kwargs={'k': 3}
|