Update app.py
Browse files
app.py
CHANGED
@@ -110,12 +110,12 @@ class BasicAgent(LocalLLM):
|
|
110 |
# )
|
111 |
|
112 |
def _serialize_messages(self, messages):
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
|
120 |
def __call__(self, question: str) -> str:
|
121 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
110 |
# )
|
111 |
|
112 |
def _serialize_messages(self, messages):
|
113 |
+
prompt = []
|
114 |
+
for m in messages:
|
115 |
+
role = m['role'].value # "system" / "user" / "assistant"
|
116 |
+
text = "".join([c['text'] for c in m['content']])
|
117 |
+
prompt.append(f"{role}: {text}")
|
118 |
+
return "\n".join(prompt)
|
119 |
|
120 |
def __call__(self, question: str) -> str:
|
121 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|