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

* Added example .txt file for agentchat_langchain sample notebook

* Update radius.txt

---------

Co-authored-by: Chi Wang <wang.chi@microsoft.com>
This commit is contained in:
Jason Holtkamp 2023-11-01 22:34:05 -07:00 committed by GitHub
parent 957ec00edd
commit 55d27cccc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 2 deletions

View File

@ -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",
")"
]

View File

@ -0,0 +1 @@
7.81mm