Spaces:
Sleeping
Sleeping
Delete response.py
Browse files- response.py +0 -28
response.py
DELETED
|
@@ -1,28 +0,0 @@
|
|
| 1 |
-
##stores embedding vector and corresponding text with vector custom_id
|
| 2 |
-
##filter embeddings by custom_id
|
| 3 |
-
##search for similar embeddings
|
| 4 |
-
##return text data with given vector custom_id
|
| 5 |
-
from dotenv import load_dotenv
|
| 6 |
-
load_dotenv()
|
| 7 |
-
|
| 8 |
-
from langchain_mistralai import ChatMistralAI
|
| 9 |
-
|
| 10 |
-
llm = ChatMistralAI(
|
| 11 |
-
model="mistral-large-latest",
|
| 12 |
-
temperature=0,
|
| 13 |
-
max_retries=1,
|
| 14 |
-
)
|
| 15 |
-
|
| 16 |
-
prompt_tamplet = """
|
| 17 |
-
You just need to answer the question based on the following context.
|
| 18 |
-
QUESTIONS : {question}
|
| 19 |
-
CONTEXT : {context}
|
| 20 |
-
"""
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
def get_answer(question:str,context:str):
|
| 25 |
-
final_prompt = prompt_tamplet.format(question=question, context=context)
|
| 26 |
-
response = llm.invoke(final_prompt)
|
| 27 |
-
##print("from planner :",type(response.content))
|
| 28 |
-
return response.content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|