Skip to content

Commit

Permalink
[Core] Update documentation for function call compatibility (#1237)
Browse files Browse the repository at this point in the history
* #1206

* doc

* add test for azure openai

* prior to

* filter for versions

* up to

* literal type

* update doc

* update doc

* update model list

* Update autogen/agentchat/conversable_agent.py

Co-authored-by: Chi Wang <[email protected]>

* Update test/agentchat/test_tool_calls.py

Co-authored-by: Chi Wang <[email protected]>

* Update test_tool_calls.py

---------

Co-authored-by: Chi Wang <[email protected]>
  • Loading branch information
ekzhu and sonichi authored Jan 16, 2024
1 parent d1c1548 commit e784f2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion autogen/agentchat/conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,7 @@ def register_for_llm(
For Azure OpenAI API, use version 2023-12-01-preview or later.
`"function"` style will be deprecated. For earlier version use
`"function"` if `"tool"` doesn't work.
See [Azure OpenAI documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/function-calling?tabs=python) for details.
Returns:
The decorator for registering a function to be used by an agent.
Expand All @@ -1731,7 +1732,7 @@ def my_function(a: Annotated[str, "description of a parameter"] = "a", b: int, c
return a + str(b * c)
```
For Azure OpenAI versions 2023-10-01-preview and earlier, set `api_style`
For Azure OpenAI versions prior to 2023-12-01-preview, set `api_style`
to `"function"` if `"tool"` doesn't work:
```
@agent2.register_for_llm(api_style="function")
Expand Down
3 changes: 3 additions & 0 deletions test/agentchat/test_tool_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def test_eval_math_responses_api_style_function():
config_list = autogen.config_list_from_models(
KEY_LOC,
model_list=["gpt-4-0613", "gpt-3.5-turbo-0613", "gpt-3.5-turbo-16k"],
filter_dict={
"api_type": ["azure"],
},
)
functions = [
{
Expand Down

0 comments on commit e784f2b

Please sign in to comment.