wt002 commited on
Commit
1b2bf09
·
verified ·
1 Parent(s): e677952

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -143,6 +143,12 @@ def reasoning_node(state: AgentState) -> AgentState:
143
  if not token:
144
  raise ValueError("Hugging Face API token not found in environment variables")
145
 
 
 
 
 
 
 
146
  # Create the underlying LLM model
147
  llm = HuggingFaceHub(
148
  repo_id="HuggingFaceH4/zephyr-7b-beta",
 
143
  if not token:
144
  raise ValueError("Hugging Face API token not found in environment variables")
145
 
146
+ history = state["history"]
147
+
148
+ # FIX: Add a HumanMessage if the last message is not one
149
+ if not isinstance(history[-1], HumanMessage):
150
+ raise ValueError("Last message in history must be a HumanMessage")
151
+
152
  # Create the underlying LLM model
153
  llm = HuggingFaceHub(
154
  repo_id="HuggingFaceH4/zephyr-7b-beta",