From 6cf5bb00869b3ca2b4b824f491b4a6a2f80b13f7 Mon Sep 17 00:00:00 2001 From: Eric Zhu Date: Sun, 28 Jan 2024 12:31:23 -0800 Subject: [PATCH] Update function call doc with example of not using decorator syntax. (#1441) * update function call doc to address #1213 * typo --- website/docs/Use-Cases/agent_chat.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/website/docs/Use-Cases/agent_chat.md b/website/docs/Use-Cases/agent_chat.md index 20965271a..50576240a 100644 --- a/website/docs/Use-Cases/agent_chat.md +++ b/website/docs/Use-Cases/agent_chat.md @@ -149,6 +149,19 @@ You can check the JSON schema generated by the decorator `chatbot.llm_config["to 'description': 'Quote currency'}}, 'required': ['base_amount']}}}] ``` + +Python decorators are functions themselves. If you do not want to use the +`@chatbot.register...` decorator syntax, +you can call the decorators as functions: + +```python +# Register the function with the chatbot's llm_config. +chatbot.register_for_llm(description="Currency exchange calculator.")(currency_calculator) + +# Register the function with the user_proxy's function_map. +user_proxy.register_for_execution()(currency_calculator) +``` + 4. Agents can now use the function as follows: ```python user_proxy.initiate_chat(