Skip to content

XSearchTool

autogen.beta.tools.builtin.x_search.XSearchTool #

XSearchTool(*, allowed_x_handles=None, excluded_x_handles=None, from_date=None, to_date=None, enable_image_understanding=None, enable_video_understanding=None)

Bases: Tool

Source code in autogen/beta/tools/builtin/x_search.py
def __init__(
    self,
    *,
    allowed_x_handles: list[str] | Variable | None = None,
    excluded_x_handles: list[str] | Variable | None = None,
    from_date: datetime | Variable | None = None,
    to_date: datetime | Variable | None = None,
    enable_image_understanding: bool | Variable | None = None,
    enable_video_understanding: bool | Variable | None = None,
) -> None:
    self._params: dict[str, object] = {}
    if allowed_x_handles is not None:
        self._params["allowed_x_handles"] = allowed_x_handles
    if excluded_x_handles is not None:
        self._params["excluded_x_handles"] = excluded_x_handles
    if from_date is not None:
        self._params["from_date"] = from_date
    if to_date is not None:
        self._params["to_date"] = to_date
    if enable_image_understanding is not None:
        self._params["enable_image_understanding"] = enable_image_understanding
    if enable_video_understanding is not None:
        self._params["enable_video_understanding"] = enable_video_understanding

    self.name = X_SEARCH_TOOL_NAME

name instance-attribute #

name = X_SEARCH_TOOL_NAME

schemas async #

schemas(context)
Source code in autogen/beta/tools/builtin/x_search.py
async def schemas(self, context: "Context") -> list[XSearchToolSchema]:
    resolved = {k: resolve_variable(v, context, param_name=k) for k, v in self._params.items()}
    return [XSearchToolSchema(**resolved)]

register #

register(stack, context, *, middleware=())
Source code in autogen/beta/tools/builtin/x_search.py
def register(
    self,
    stack: "ExitStack | AsyncExitStack",
    context: "Context",
    *,
    middleware: Iterable["BaseMiddleware"] = (),
) -> None:
    async def execute(event: "ToolCallEvent", context: "Context") -> None:
        pass

    stack.enter_context(
        context.stream.where(BuiltinToolCallEvent.name == X_SEARCH_TOOL_NAME).sub_scope(execute),
    )

set_provider #

set_provider(provider)
Source code in autogen/beta/tools/tool.py
def set_provider(self, provider: Provider) -> None:
    pass