Spaces:
Runtime error
Runtime error
Update kadi_apy_bot.py
Browse files- kadi_apy_bot.py +11 -10
kadi_apy_bot.py
CHANGED
|
@@ -180,8 +180,9 @@ class KadiAPYBot:
|
|
| 180 |
|
| 181 |
Guidelines if generating code:
|
| 182 |
- Display the complete code first, followed by a concise explanation in no more than 5 sentences.
|
| 183 |
-
|
| 184 |
General Guidelines:
|
|
|
|
| 185 |
- If the user's query cannot be fulfilled based on the provided snippets, reply with "The API does not support the requested functionality."
|
| 186 |
- If the user's query does not implicate any task, reply with a question asking the user to elaborate.
|
| 187 |
|
|
@@ -225,12 +226,12 @@ class KadiAPYBot:
|
|
| 225 |
return formatted_docs
|
| 226 |
|
| 227 |
def format_history(conversation_history):
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
|
|
|
| 180 |
|
| 181 |
Guidelines if generating code:
|
| 182 |
- Display the complete code first, followed by a concise explanation in no more than 5 sentences.
|
| 183 |
+
|
| 184 |
General Guidelines:
|
| 185 |
+
- Refer to the "Conversation History" if it provides context that could enhance your understanding of the user's query.
|
| 186 |
- If the user's query cannot be fulfilled based on the provided snippets, reply with "The API does not support the requested functionality."
|
| 187 |
- If the user's query does not implicate any task, reply with a question asking the user to elaborate.
|
| 188 |
|
|
|
|
| 226 |
return formatted_docs
|
| 227 |
|
| 228 |
def format_history(conversation_history):
|
| 229 |
+
formatted_history = []
|
| 230 |
+
for i, entry in enumerate(conversation_history, start=1):
|
| 231 |
+
user_query = entry.get("query", "No query provided")
|
| 232 |
+
assistant_response = entry.get("response", "No response yet") # Updated label
|
| 233 |
+
formatted_history.append(f"Turn {i}:")
|
| 234 |
+
formatted_history.append(f"User Query: {user_query}")
|
| 235 |
+
formatted_history.append(f"Assistant Response: {assistant_response}") # Using "Assistant Response"
|
| 236 |
+
formatted_history.append("\n")
|
| 237 |
+
return "\n".join(formatted_history)
|