Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,13 +17,13 @@ embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-
|
|
17 |
vector_store= FAISS.load_local("vector_db/", embeddings)
|
18 |
|
19 |
repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1"
|
20 |
-
llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={"temperature": 0.
|
21 |
|
22 |
memory = ConversationSummaryBufferMemory(
|
23 |
llm=llm,
|
24 |
output_key='answer',
|
25 |
memory_key='chat_history',
|
26 |
-
max_token_limit=
|
27 |
return_messages=True)
|
28 |
|
29 |
retriever = vector_store.as_retriever(
|
@@ -44,7 +44,11 @@ agent=create_csv_agent(llm,['data/Gretel_Data.csv','data/RAN_Data _T.csv'],verbo
|
|
44 |
def echo(message, history):
|
45 |
context_prompt = """Assume the role of Clara, a seasoned senior telecom network engineer with access to troubleshooting tickets data and various technical and product documentation.
|
46 |
Rely on information derived from these tickets to address queries. Feel free to seek clarification through relevant questions."""
|
47 |
-
|
|
|
|
|
|
|
|
|
48 |
result=qa({"question":message})
|
49 |
bold_answer= "<b>" + result['answer'].split('Helpful Answer:')[-1] + "</b>"
|
50 |
return bold_answer + "<br></br>" +'1. ' + str(result["source_documents"][0]) +"<br>" + '2. ' + str(result["source_documents"][1]) + "<br>" + "3. " + str(result["source_documents"][2])
|
|
|
17 |
vector_store= FAISS.load_local("vector_db/", embeddings)
|
18 |
|
19 |
repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1"
|
20 |
+
llm = HuggingFaceHub(repo_id=repo_id, model_kwargs={"temperature": 0.01, "max_new_tokens": 2048})
|
21 |
|
22 |
memory = ConversationSummaryBufferMemory(
|
23 |
llm=llm,
|
24 |
output_key='answer',
|
25 |
memory_key='chat_history',
|
26 |
+
max_token_limit=300,
|
27 |
return_messages=True)
|
28 |
|
29 |
retriever = vector_store.as_retriever(
|
|
|
44 |
def echo(message, history):
|
45 |
context_prompt = """Assume the role of Clara, a seasoned senior telecom network engineer with access to troubleshooting tickets data and various technical and product documentation.
|
46 |
Rely on information derived from these tickets to address queries. Feel free to seek clarification through relevant questions."""
|
47 |
+
csv_context_prompt = """Assume access to multiple files, including a CSV with ticket details (ticket ID as primary key, columns like network element, location, RCA, status, severity, etc.).
|
48 |
+
The model should refer to the CSV file specifically when users inquire about tickets or related network issues. For other queries, the model can utilize information from the broader context or available data sources as needed."""
|
49 |
+
|
50 |
+
message= context_prompt + csv_context_prompt + "User Query: "+ message + "If asked about Root cause analysis (rca), give only one possible awnser and then give the steps to resolve in the exact format which is :- The steps to resolve could be -"
|
51 |
+
|
52 |
result=qa({"question":message})
|
53 |
bold_answer= "<b>" + result['answer'].split('Helpful Answer:')[-1] + "</b>"
|
54 |
return bold_answer + "<br></br>" +'1. ' + str(result["source_documents"][0]) +"<br>" + '2. ' + str(result["source_documents"][1]) + "<br>" + "3. " + str(result["source_documents"][2])
|