Skip to content

BuiltinToolCallEvent

autogen.beta.events.tool_events.BuiltinToolCallEvent #

BuiltinToolCallEvent(**kwargs)

Bases: ToolCallEvent

Represents a builtin tool invocation requested by the model.

Source code in autogen/beta/events/base.py
def __init__(self, **kwargs: Any) -> None:
    # Apply defaults first, then user-provided kwargs so that
    # property setters (e.g. content -> _content) aren't overwritten
    # by a field default applied afterwards.
    defaults: dict[str, Any] = {}
    for klass in reversed(type(self).__mro__):
        for name, f in getattr(klass, "_event_fields_", {}).items():
            if name not in kwargs:
                default = f.get_default()
                if default is not Ellipsis:
                    defaults[name] = default

    for key, value in defaults.items():
        setattr(self, key, value)
    for key, value in kwargs.items():
        setattr(self, key, value)

id class-attribute instance-attribute #

id = Field(default_factory=lambda: str(uuid4()))

name instance-attribute #

name

arguments class-attribute instance-attribute #

arguments = '{}'

provider_data class-attribute instance-attribute #

provider_data = Field(default_factory=dict)

serialized_arguments property writable #

serialized_arguments

to_api #

to_api()
Source code in autogen/beta/events/tool_events.py
def to_api(self) -> dict[str, Any]:
    return {
        "id": self.id,
        "type": "function",
        "function": {
            "arguments": json.dumps(self.serialized_arguments),
            "name": self.name,
        },
    }