Spaces:
Sleeping
Sleeping
update
Browse files- agent.py +1 -1
- app_playground.ipynb +14 -26
agent.py
CHANGED
|
@@ -34,7 +34,7 @@ def get_graph(llm):
|
|
| 34 |
print("\n-------------------- Agent has been called -----------------------------------\n")
|
| 35 |
prompt = prompt_template.invoke(state["messages"])
|
| 36 |
response = llm.invoke(prompt)
|
| 37 |
-
print("Agent has made a decision: ",response
|
| 38 |
return {"messages": [response], "aggregate": ["Agent"]}
|
| 39 |
|
| 40 |
# Build graph
|
|
|
|
| 34 |
print("\n-------------------- Agent has been called -----------------------------------\n")
|
| 35 |
prompt = prompt_template.invoke(state["messages"])
|
| 36 |
response = llm.invoke(prompt)
|
| 37 |
+
print("Agent has made a decision: ",response.content)
|
| 38 |
return {"messages": [response], "aggregate": ["Agent"]}
|
| 39 |
|
| 40 |
# Build graph
|
app_playground.ipynb
CHANGED
|
@@ -6,8 +6,8 @@
|
|
| 6 |
"metadata": {
|
| 7 |
"collapsed": true,
|
| 8 |
"ExecuteTime": {
|
| 9 |
-
"end_time": "2025-04-
|
| 10 |
-
"start_time": "2025-04-
|
| 11 |
}
|
| 12 |
},
|
| 13 |
"source": [
|
|
@@ -22,16 +22,7 @@
|
|
| 22 |
"\n",
|
| 23 |
"graph = get_graph(llm)\n"
|
| 24 |
],
|
| 25 |
-
"outputs": [
|
| 26 |
-
{
|
| 27 |
-
"name": "stderr",
|
| 28 |
-
"output_type": "stream",
|
| 29 |
-
"text": [
|
| 30 |
-
"C:\\Users\\dennis.binzen\\PycharmProjects\\Final_Assignment\\.venv\\Lib\\site-packages\\tqdm\\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
|
| 31 |
-
" from .autonotebook import tqdm as notebook_tqdm\n"
|
| 32 |
-
]
|
| 33 |
-
}
|
| 34 |
-
],
|
| 35 |
"execution_count": 1
|
| 36 |
},
|
| 37 |
{
|
|
@@ -64,12 +55,12 @@
|
|
| 64 |
{
|
| 65 |
"metadata": {
|
| 66 |
"ExecuteTime": {
|
| 67 |
-
"end_time": "2025-04-
|
| 68 |
-
"start_time": "2025-04-
|
| 69 |
}
|
| 70 |
},
|
| 71 |
"cell_type": "code",
|
| 72 |
-
"source": "res = graph.invoke({\"messages\": [HumanMessage(content=\"
|
| 73 |
"id": "a9fdfecc1af0975e",
|
| 74 |
"outputs": [
|
| 75 |
{
|
|
@@ -78,7 +69,8 @@
|
|
| 78 |
"text": [
|
| 79 |
"\n",
|
| 80 |
"-------------------- Agent has been called -----------------------------------\n",
|
| 81 |
-
"\n"
|
|
|
|
| 82 |
]
|
| 83 |
}
|
| 84 |
],
|
|
@@ -87,8 +79,8 @@
|
|
| 87 |
{
|
| 88 |
"metadata": {
|
| 89 |
"ExecuteTime": {
|
| 90 |
-
"end_time": "2025-04-
|
| 91 |
-
"start_time": "2025-04-
|
| 92 |
}
|
| 93 |
},
|
| 94 |
"cell_type": "code",
|
|
@@ -98,15 +90,15 @@
|
|
| 98 |
{
|
| 99 |
"data": {
|
| 100 |
"text/plain": [
|
| 101 |
-
"
|
| 102 |
]
|
| 103 |
},
|
| 104 |
-
"execution_count":
|
| 105 |
"metadata": {},
|
| 106 |
"output_type": "execute_result"
|
| 107 |
}
|
| 108 |
],
|
| 109 |
-
"execution_count":
|
| 110 |
},
|
| 111 |
{
|
| 112 |
"metadata": {},
|
|
@@ -140,11 +132,7 @@
|
|
| 140 |
}
|
| 141 |
},
|
| 142 |
"cell_type": "code",
|
| 143 |
-
"source":
|
| 144 |
-
"res = llm.invoke(\"Hello, how are you?\")\n",
|
| 145 |
-
"\n",
|
| 146 |
-
"res.content"
|
| 147 |
-
],
|
| 148 |
"id": "df3ed82e9ec7006c",
|
| 149 |
"outputs": [
|
| 150 |
{
|
|
|
|
| 6 |
"metadata": {
|
| 7 |
"collapsed": true,
|
| 8 |
"ExecuteTime": {
|
| 9 |
+
"end_time": "2025-04-27T12:08:14.862059Z",
|
| 10 |
+
"start_time": "2025-04-27T12:08:08.256846Z"
|
| 11 |
}
|
| 12 |
},
|
| 13 |
"source": [
|
|
|
|
| 22 |
"\n",
|
| 23 |
"graph = get_graph(llm)\n"
|
| 24 |
],
|
| 25 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
"execution_count": 1
|
| 27 |
},
|
| 28 |
{
|
|
|
|
| 55 |
{
|
| 56 |
"metadata": {
|
| 57 |
"ExecuteTime": {
|
| 58 |
+
"end_time": "2025-04-27T12:09:56.893993Z",
|
| 59 |
+
"start_time": "2025-04-27T12:09:56.702812Z"
|
| 60 |
}
|
| 61 |
},
|
| 62 |
"cell_type": "code",
|
| 63 |
+
"source": "res = graph.invoke({\"messages\": [HumanMessage(content=\"How many studio albums were published by Mercedes Sosa between 2000 and 2009 (included)? You can use the latest 2022 version of english wikipedia.\"),]})",
|
| 64 |
"id": "a9fdfecc1af0975e",
|
| 65 |
"outputs": [
|
| 66 |
{
|
|
|
|
| 69 |
"text": [
|
| 70 |
"\n",
|
| 71 |
"-------------------- Agent has been called -----------------------------------\n",
|
| 72 |
+
"\n",
|
| 73 |
+
"Agent has made a decision: 3\n"
|
| 74 |
]
|
| 75 |
}
|
| 76 |
],
|
|
|
|
| 79 |
{
|
| 80 |
"metadata": {
|
| 81 |
"ExecuteTime": {
|
| 82 |
+
"end_time": "2025-04-27T12:10:00.906265Z",
|
| 83 |
+
"start_time": "2025-04-27T12:10:00.897923Z"
|
| 84 |
}
|
| 85 |
},
|
| 86 |
"cell_type": "code",
|
|
|
|
| 90 |
{
|
| 91 |
"data": {
|
| 92 |
"text/plain": [
|
| 93 |
+
"'3'"
|
| 94 |
]
|
| 95 |
},
|
| 96 |
+
"execution_count": 5,
|
| 97 |
"metadata": {},
|
| 98 |
"output_type": "execute_result"
|
| 99 |
}
|
| 100 |
],
|
| 101 |
+
"execution_count": 5
|
| 102 |
},
|
| 103 |
{
|
| 104 |
"metadata": {},
|
|
|
|
| 132 |
}
|
| 133 |
},
|
| 134 |
"cell_type": "code",
|
| 135 |
+
"source": "",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
"id": "df3ed82e9ec7006c",
|
| 137 |
"outputs": [
|
| 138 |
{
|