Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,10 +40,19 @@ chat = ChatHuggingFace(llm=llm, verbose=True)
|
|
| 40 |
|
| 41 |
tools = []
|
| 42 |
chat_with_tools = chat.bind_tools(tools)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
def assistant(state: MessagesState):
|
| 45 |
return {
|
| 46 |
-
"messages": [chat_with_tools.invoke(state["messages"])],
|
| 47 |
}
|
| 48 |
|
| 49 |
class BasicAgent:
|
|
|
|
| 40 |
|
| 41 |
tools = []
|
| 42 |
chat_with_tools = chat.bind_tools(tools)
|
| 43 |
+
|
| 44 |
+
# load the system prompt from the file
|
| 45 |
+
with open("system_prompt.txt", "r", encoding="utf-8") as f:
|
| 46 |
+
system_prompt = f.read()
|
| 47 |
+
|
| 48 |
+
print(system_prompt)
|
| 49 |
+
|
| 50 |
+
# System message
|
| 51 |
+
sys_msg = SystemMessage(content=system_prompt)
|
| 52 |
|
| 53 |
def assistant(state: MessagesState):
|
| 54 |
return {
|
| 55 |
+
"messages": [chat_with_tools.invoke([sys_msg] + state["messages"])],
|
| 56 |
}
|
| 57 |
|
| 58 |
class BasicAgent:
|