Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

1.0 KB
Raw Blame
"""Tests for the Vertex AI Google provider."""

import pytest

from composio.client.types import Tool

GoogleProvider = pytest.importorskip("composio_google").GoogleProvider


def test_wrap_tool_dereferences_internal_refs() -> None:
    """Referenced input properties must be expanded before Vertex translation."""
    tool = Tool.model_construct(
        slug="TEST_REF",
        description="test",
        input_parameters={
            "type": "object",
            "properties": {"message": {"$ref": "#/$defs/Message"}},
            "required": ["message"],
            "$defs": {
                "Message": {
                    "type": "object",
                    "properties": {"subject": {"type": "string"}},
                    "required": ["subject"],
                }
            },
        },
    )

    wrapped = GoogleProvider().wrap_tool(tool)
    message_schema = wrapped.to_dict()["parameters"]["properties"]["message"]

    assert "ref" not in message_schema
    assert message_schema["properties"]["subject"]["type"] == "STRING"