Skip to content

A programming framework for agentic AI

Added example .txt file for agentchat_langchain sample notebook (#373)

Jason Holtkamp55d27cccc9ed
diff --git a/notebook/agentchat_langchain.ipynb b/notebook/agentchat_langchain.ipynb
index f1eac5f49..a756bc3af 100644
--- a/notebook/agentchat_langchain.ipynb
+++ b/notebook/agentchat_langchain.ipynb
@@ -205,6 +205,7 @@
"from langchain.tools import BaseTool\n",
"from typing import Optional, Type\n",
"import math\n",
+ "import os\n",
"\n",
"class CircumferenceToolInput(BaseModel):\n",
" radius: float = Field()\n",
@@ -215,7 +216,22 @@
" args_schema: Type[BaseModel] = CircumferenceToolInput\n",
"\n",
" def _run(self, radius: float):\n",
- " return float(radius) * 2.0 * math.pi"
+ " return float(radius) * 2.0 * math.pi\n",
+ " \n",
+ "def get_file_path_of_example():\n",
+ " # Get the current working directory\n",
+ " current_dir = os.getcwd()\n",
+ "\n",
+ " # Go one directory up\n",
+ " parent_dir = os.path.dirname(current_dir)\n",
+ "\n",
+ " # Move to the target directory\n",
+ " target_folder = os.path.join(parent_dir, \"test\")\n",
+ "\n",
+ " # Construct the path to your target file\n",
+ " file_path = os.path.join(target_folder, \"test_files/radius.txt\")\n",
+ " \n",
+ " return file_path"
]
},
{
@@ -355,7 +371,7 @@
"\n",
"user_proxy.initiate_chat(\n",
" chatbot,\n",
- " message=\"Read the file with the path 'Test.txt', then calculate the circumference of a circle that has a radius of that files contents.\", #\" 7.81mm\" in the file\n",
+ " message=f\"Read the file with the path {get_file_path_of_example()}, then calculate the circumference of a circle that has a radius of that files contents.\", #7.81mm in the file\n",
" llm_config=llm_config,\n",
")"
]
diff --git a/test/test_files/radius.txt b/test/test_files/radius.txt
new file mode 100644
index 000000000..e69a5131f
--- /dev/null
+++ b/test/test_files/radius.txt
@@ -0,0 +1 @@
+7.81mm