Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update function calling api to tools api #404

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nilspalumbo
Copy link
Collaborator

Resolves #293; updates default Azure API version to latest, which supports tools.

@Mohannadcse
Copy link
Collaborator

Mohannadcse commented Feb 19, 2024

@nilspalumbo @pchalasani the pytest has been running for almost 6 hrs, I think it should be cancelled

@@ -29,7 +29,7 @@ class AzureConfig(OpenAIGPTConfig):

api_key: str = "" # CAUTION: set this ONLY via env var AZURE_OPENAI_API_KEY
type: str = "azure"
api_version: str = "2023-05-15"
api_version: str = "2024-02-15-preview"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to update here, can be overwritten via the AZURE_OPENAI_API_VERSION in the .env

@Mohannadcse
Copy link
Collaborator

@nilspalumbo shouldn't docstring be added/updated to clarify the purpose of the mods involved | Dict[str, str]

@pchalasani
Copy link
Contributor

@nilspalumbo looking at the gh actions, I think this made test_multi_agent.py go into an infinite loop, which is why it ran 6h.

@nilspalumbo
Copy link
Collaborator Author

Oof, I hope OpenAI rate limited this one 😬 Though, when I look at it, test_multi_agent.py has four tests, one of which has two configs, and there are five successes; could the tasks be hanging on after the test completed?

@pchalasani
Copy link
Contributor

@nilspalumbo test_tool_messages.py is failing

tests/main/test_tool_messages.py ........F

========================================================================== FAILURES ==========================================================================
___________________________________________________ test_enable_message[FileExistsMessage-True-True-True] ____________________________________________________

msg_class = <class 'test_tool_messages.FileExistsMessage'>, use = True, handle = True, force = True

    @pytest.mark.parametrize(
        # cartesian product of all combinations of use, handle, force
        "msg_class, use, handle, force",
        cartesian_product,
    )
    def test_enable_message(
        msg_class: Optional[ToolMessage], use: bool, handle: bool, force: bool
    ):
        agent.enable_message(msg_class, use=use, handle=handle, force=force)
        tools = agent._get_tool_list(msg_class)
        for tool in tools:
            assert tool in agent.llm_tools_map
            if msg_class is not None:
                assert agent.llm_tools_map[tool] == msg_class
                assert agent.llm_functions_map[tool] == msg_class.llm_function_schema()
            assert (tool in agent.llm_tools_handled) == handle
            assert (tool in agent.llm_tools_usable) == use
            assert (tool in agent.llm_functions_handled) == handle
            assert (tool in agent.llm_functions_usable) == use

        if msg_class is not None:
>           assert (
                agent.llm_function_force is not None
                and agent.llm_function_force["name"] == tools[0]
            ) == force
E           KeyError: 'name'

tests/main/test_tool_messages.py:129: KeyError

@nilspalumbo
Copy link
Collaborator Author

Whoops, that makes sense, I'll update the test to be in terms of the new forcing format.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade: OpenAI function_call (deprecated) ==> tools
3 participants