Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,12 +61,13 @@ def preprocess_response(response: str) -> str:
|
|
| 61 |
|
| 62 |
def shorten_response(response: str) -> str:
|
| 63 |
"""Uses the Zephyr model to shorten and refine the response."""
|
| 64 |
-
messages = [{"role": "system", "content": "
|
| 65 |
-
result = client.chat_completion(messages, max_tokens=512, temperature=0.
|
| 66 |
return result.choices[0].message['content'].strip()
|
| 67 |
-
|
|
|
|
| 68 |
def respond(message: str, history: List[Tuple[str, str]]):
|
| 69 |
-
system_message = "You're an experienced and knowledgeable CAPA tickets analyst assistant.
|
| 70 |
messages = [{"role": "system", "content": system_message}]
|
| 71 |
|
| 72 |
for val in history:
|
|
@@ -78,7 +79,7 @@ def respond(message: str, history: List[Tuple[str, str]]):
|
|
| 78 |
messages.append({"role": "user", "content": message})
|
| 79 |
|
| 80 |
# RAG - Retrieve relevant documents if the query suggests exercises or specific information
|
| 81 |
-
if any(keyword in message.lower() for keyword in ["exercise", "technique", "information", "guide", "help", "how to",
|
| 82 |
retrieved_docs = app.search_documents(message)
|
| 83 |
context = "\n".join(retrieved_docs)
|
| 84 |
if context.strip():
|
|
|
|
| 61 |
|
| 62 |
def shorten_response(response: str) -> str:
|
| 63 |
"""Uses the Zephyr model to shorten and refine the response."""
|
| 64 |
+
messages = [{"role": "system", "content": "Shorten and refine this response"}, {"role": "user", "content": response}]
|
| 65 |
+
result = client.chat_completion(messages, max_tokens=512, temperature=0.2, top_p=0.9)
|
| 66 |
return result.choices[0].message['content'].strip()
|
| 67 |
+
|
| 68 |
+
#You guide customers through understanding and resolving CAPA-related queries with clarity and expertise. When customers inquire about CAPA information for a specific issue, you provide precise details, including the relevant CAPA ID. Address one query at a time and ask follow-up questions to clarify or deepen understanding, maintaining a supportive and solution-oriented tone throughout. Remember to give CAPA Name, CAPA count, Capa Title and problem summary for each query.
|
| 69 |
def respond(message: str, history: List[Tuple[str, str]]):
|
| 70 |
+
system_message = "You're an experienced and knowledgeable CAPA tickets analyst assistant. Just give the Summary of the complaint. "
|
| 71 |
messages = [{"role": "system", "content": system_message}]
|
| 72 |
|
| 73 |
for val in history:
|
|
|
|
| 79 |
messages.append({"role": "user", "content": message})
|
| 80 |
|
| 81 |
# RAG - Retrieve relevant documents if the query suggests exercises or specific information
|
| 82 |
+
if any(keyword in message.lower() for keyword in ["exercise", "technique", "information", "guide", "help", "how to","tell me", "how","tell me","how many","capa","department","product","issue","issues","find","which"]):
|
| 83 |
retrieved_docs = app.search_documents(message)
|
| 84 |
context = "\n".join(retrieved_docs)
|
| 85 |
if context.strip():
|