This commit is contained in:
Nuno Campos
2024-04-18 10:18:56 -07:00
parent 38d990cf99
commit 3edf7e4d73
2 changed files with 46 additions and 110 deletions
+36 -108
View File
@@ -387,21 +387,12 @@
# ---
# name: test_conditional_graph[end_of_run].2
'''
+-----------+
| __start__ |
+-----------+
*
*
*
+-------+
| agent |
+-------+
* .
** ..
* .
+-------+ +---------+
| tools | | __end__ |
+-------+ +---------+
graph TD;
__start__ --> agent;
tools --> agent;
agent -. continue .-> tools;
agent -. exit .-> __end__;
'''
# ---
# name: test_conditional_graph[end_of_run].3
@@ -611,45 +602,18 @@
# ---
# name: test_conditional_graph[end_of_run].5
'''
+-----------+
| __start__ |
+-----------+
*
*
*
+------------------------------+
| Parallel<agent_outcome>Input |
+------------------------------+
***** * *****
****** * ****
*** * *****
+----------------+ * ***
| PromptTemplate | * *
+----------------+ * *
* * *
* * *
* * *
+----------------------+ * *
| FakeStreamingListLLM | * *
+----------------------+ * *
* * *
* * *
* * *
+----------------------+ +-------------+ *
| Lambda(agent_parser) | | Passthrough | *
+----------------------+ +-------------+ *
*** *** *
** ** *
** ** *
+-------------------------------+ *
| Parallel<agent_outcome>Output | *
+-------------------------------+..... *
. ......... *
. ........ *
. ..... *
+---------+ +-------+
| __end__ | | tools |
+---------+ +-------+
graph TD;
PromptTemplate --> FakeStreamingListLLM;
FakeStreamingListLLM --> Lambda_agent_parser_;
Parallel_agent_outcome_Input --> PromptTemplate;
Lambda_agent_parser_ --> Parallel_agent_outcome_Output;
Parallel_agent_outcome_Input --> Passthrough;
Passthrough --> Parallel_agent_outcome_Output;
__start__ --> Parallel_agent_outcome_Input;
tools --> Parallel_agent_outcome_Input;
Parallel_agent_outcome_Output -. continue .-> tools;
Parallel_agent_outcome_Output -. exit .-> __end__;
'''
# ---
# name: test_conditional_graph[end_of_step]
@@ -762,21 +726,12 @@
# ---
# name: test_conditional_graph[end_of_step].2
'''
+-----------+
| __start__ |
+-----------+
*
*
*
+-------+
| agent |
+-------+
. .
.. ..
. .
+-------+ +---------+
| tools | | __end__ |
+-------+ +---------+
graph TD;
__start__ --> agent;
tools --> agent;
agent -. continue .-> tools;
agent -. exit .-> __end__;
'''
# ---
# name: test_conditional_graph[end_of_step].3
@@ -986,45 +941,18 @@
# ---
# name: test_conditional_graph[end_of_step].5
'''
+-----------+
| __start__ |
+-----------+
*
*
*
+------------------------------+
| Parallel<agent_outcome>Input |
+------------------------------+
***** * *****
****** * ****
*** * *****
+----------------+ * ***
| PromptTemplate | * *
+----------------+ * *
* * *
* * *
* * *
+----------------------+ * *
| FakeStreamingListLLM | * *
+----------------------+ * *
* * *
* * *
* * *
+----------------------+ +-------------+ *
| Lambda(agent_parser) | | Passthrough | *
+----------------------+ +-------------+ *
*** *** *
** ** *
** ** *
+-------------------------------+ *
| Parallel<agent_outcome>Output | *
+-------------------------------+..... *
. ......... *
. ........ *
. ..... *
+---------+ +-------+
| __end__ | | tools |
+---------+ +-------+
graph TD;
PromptTemplate --> FakeStreamingListLLM;
FakeStreamingListLLM --> Lambda_agent_parser_;
Parallel_agent_outcome_Input --> PromptTemplate;
Lambda_agent_parser_ --> Parallel_agent_outcome_Output;
Parallel_agent_outcome_Input --> Passthrough;
Passthrough --> Parallel_agent_outcome_Output;
__start__ --> Parallel_agent_outcome_Input;
tools --> Parallel_agent_outcome_Input;
Parallel_agent_outcome_Output -. continue .-> tools;
Parallel_agent_outcome_Output -. exit .-> __end__;
'''
# ---
# name: test_conditional_graph_state[end_of_run]
+10 -2
View File
@@ -796,10 +796,18 @@ def test_conditional_graph(
assert json.dumps(app.get_graph().to_json(), indent=2) == snapshot
assert app.get_graph().draw_ascii() == snapshot
assert app.get_graph(add_condition_nodes=False).draw_ascii() == snapshot
assert (
app.get_graph(add_condition_nodes=False).draw_mermaid(with_styles=False)
== snapshot
)
assert json.dumps(app.get_graph(xray=True).to_json(), indent=2) == snapshot
assert app.get_graph(xray=True).draw_ascii() == snapshot
assert app.get_graph(xray=True, add_condition_nodes=False).draw_ascii() == snapshot
assert (
app.get_graph(xray=True, add_condition_nodes=False).draw_mermaid(
with_styles=False
)
== snapshot
)
assert app.invoke({"input": "what is weather in sf"}) == {
"input": "what is weather in sf",