Spaces:
Runtime error
Runtime error
Update rag.py
Browse files
rag.py
CHANGED
|
@@ -85,6 +85,25 @@ class Rag:
|
|
| 85 |
chain_type="stuff",#map_reduce, refine, map_rerank
|
| 86 |
return_source_documents=True,
|
| 87 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
def generate_text(self, subject):
|
| 89 |
try:
|
| 90 |
query = f"Elabore uma nova notícia sobre {subject}."
|
|
|
|
| 85 |
chain_type="stuff",#map_reduce, refine, map_rerank
|
| 86 |
return_source_documents=True,
|
| 87 |
)
|
| 88 |
+
|
| 89 |
+
# from langchain_together import Together
|
| 90 |
+
# self.qa = ConversationalRetrievalChain.from_llm(
|
| 91 |
+
# llm=Together(model="mistralai/Mixtral-8x7B-Instruct-v0.1", # 0125 #1106
|
| 92 |
+
# temperature=0,
|
| 93 |
+
# #top_k=20,
|
| 94 |
+
# together_api_key=os.environ['TOGETHER_KEY'],
|
| 95 |
+
# max_tokens=int(int(max_words) + (int(max_words) / 2))),
|
| 96 |
+
# # número máximo de tokens para a resposta
|
| 97 |
+
# memory=self.memory,
|
| 98 |
+
# # retriever=vectorstore.as_retriever(search_type='similarity_score_threshold',
|
| 99 |
+
# # search_kwargs={'k':4, 'score_threshold':0.8}), #search_kwargs={'k': 3}
|
| 100 |
+
# retriever=vectorstore.as_retriever(),
|
| 101 |
+
# combine_docs_chain_kwargs={"prompt": self.prompt},
|
| 102 |
+
# chain_type="stuff", # map_reduce, refine, map_rerank
|
| 103 |
+
# return_source_documents=True,
|
| 104 |
+
# )
|
| 105 |
+
|
| 106 |
+
|
| 107 |
def generate_text(self, subject):
|
| 108 |
try:
|
| 109 |
query = f"Elabore uma nova notícia sobre {subject}."
|