Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,13 +22,6 @@ class BasicAgent:
|
|
| 22 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 23 |
return fixed_answer
|
| 24 |
|
| 25 |
-
import os
|
| 26 |
-
from langgraph.graph import StateGraph, END
|
| 27 |
-
from langchain_core.runnables import Runnable
|
| 28 |
-
from langchain_core.messages import HumanMessage
|
| 29 |
-
from langchain_core.runnables import RunnableLambda
|
| 30 |
-
from langchain_openai import ChatOpenAI
|
| 31 |
-
|
| 32 |
from langgraph.graph import StateGraph
|
| 33 |
from langchain_core.runnables import RunnableLambda
|
| 34 |
from langchain_core.messages import HumanMessage, SystemMessage
|
|
@@ -58,7 +51,8 @@ class LangGraphAgent:
|
|
| 58 |
final_answer = self._extract_final_answer(response)
|
| 59 |
return {"answer": final_answer}
|
| 60 |
|
| 61 |
-
builder = StateGraph(
|
|
|
|
| 62 |
builder.add_node("answer_question", RunnableLambda(answer_fn))
|
| 63 |
builder.set_entry_point("answer_question")
|
| 64 |
builder.set_finish_point("answer_question")
|
|
|
|
| 22 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 23 |
return fixed_answer
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
from langgraph.graph import StateGraph
|
| 26 |
from langchain_core.runnables import RunnableLambda
|
| 27 |
from langchain_core.messages import HumanMessage, SystemMessage
|
|
|
|
| 51 |
final_answer = self._extract_final_answer(response)
|
| 52 |
return {"answer": final_answer}
|
| 53 |
|
| 54 |
+
builder = StateGraph()
|
| 55 |
+
builder = builder.with_input_types(question=str, answer=str)
|
| 56 |
builder.add_node("answer_question", RunnableLambda(answer_fn))
|
| 57 |
builder.set_entry_point("answer_question")
|
| 58 |
builder.set_finish_point("answer_question")
|