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

[Bug]: GeminiClient fails when registering a function with Annotated type #611

Open
rjambrecic opened this issue Jan 22, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@rjambrecic
Copy link
Collaborator

Describe the bug

Gemini isn't working when there is agent with tool parameter like this:

additional_notes: Annotated[Optional[str], "Additional notes"] = None

Here is a test case which is failing:

@pytest.mark.gemini
def test_gemini_with_tools_parameters_set_to_is_annotated_with_none_as_default_value(
    credentials_gemini_pro: Credentials,
) -> None:
    agent = ConversableAgent(name="agent", llm_config=credentials_gemini_pro.llm_config)

    user_proxy = UserProxyAgent(
        name="user_proxy_1",
        human_input_mode="NEVER",
    )

    mock = MagicMock()

    @user_proxy.register_for_execution()
    @agent.register_for_llm(description="Login function")
    def login(
        additional_notes: Annotated[Optional[str], "Additional notes"] = None,
    ) -> str:
        return "Login successful."

    user_proxy.initiate_chat(agent, message="Please login", max_turns=2)

    mock.assert_called_once()

This test is already in the test/agentchat/test_conversable_agent.py but currently it is marked with @pytest.skip because it is failing

Steps to reproduce

No response

Model Used

No response

Expected Behavior

No response

Screenshots and logs

No response

Additional Information

No response

@rjambrecic rjambrecic added the bug Something isn't working label Jan 22, 2025
@rjambrecic rjambrecic self-assigned this Jan 22, 2025
@rjambrecic rjambrecic added this to ag2 Jan 22, 2025
@rjambrecic rjambrecic moved this to Todo in ag2 Jan 22, 2025
@rjambrecic rjambrecic changed the title [Bug]: Fix GeminiClient [Bug]: GeminiClient fails when registering a function with Annotated type Jan 23, 2025
@rjambrecic rjambrecic moved this from Todo to In Progress in ag2 Jan 23, 2025
@rjambrecic rjambrecic moved this from In Progress to Todo in ag2 Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

1 participant