Update function call doc with example of not using decorator syntax. (#1441)

* update function call doc to address #1213

* typo
This commit is contained in:
Eric Zhu 2024-01-28 12:31:23 -08:00 committed by GitHub
parent 101d7fbf17
commit 6cf5bb0086
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 13 additions and 0 deletions

View File

@ -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(