feat: solution for 'Повторный экзамен: Граф с рефлексией и доработкой'
This commit is contained in:
@@ -1,25 +1,7 @@
|
||||
from langgraph.graph import StateGraph
|
||||
from src.graph import build_graph
|
||||
from langchain_core.messages import HumanMessage
|
||||
import langgraph
|
||||
|
||||
def main():
|
||||
# Build and compile the graph
|
||||
graph = build_graph()
|
||||
app = graph.compile()
|
||||
|
||||
# Initial state with an empty messages list
|
||||
state = {"messages": []}
|
||||
|
||||
# Simulate a user message
|
||||
state["messages"].append(HumanMessage(content="Hello, agent!"))
|
||||
|
||||
# Run the graph
|
||||
result = app.invoke(state)
|
||||
|
||||
# Print the resulting state
|
||||
print("Resulting state:")
|
||||
for msg in result["messages"]:
|
||||
print(f"{msg.__class__.__name__}: {msg.content}")
|
||||
print("Langgraph version:", langgraph.__version__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user