Skip to content

Adapters

Adapters for external formats.

from_google_function(function_declaration, func=None)

Convert a Google ADK function declaration into the SDK Tool representation.

The Google ADK FunctionDeclaration provides access to: 1. name: The function name 2. description: The function description 3. parameters: A dict in JSON Schema format (OpenAPI 3.0 compatible)

Parameters:

Name Type Description Default
function_declaration Any

The Google ADK function declaration to convert.

required
func Callable | None

The implementation function for the tool. Defaults to None.

None

Returns:

Name Type Description
Tool Tool

The converted SDK tool.

Raises:

Type Description
ValueError

If the function declaration is None or has invalid fields.

AttributeError

If required attributes are missing.

TypeError

If field types are incorrect.

from_langchain_tool(langchain_tool)

Convert a LangChain tool into the SDK Tool representation.

Parameters:

Name Type Description Default
langchain_tool Any

The LangChain tool to convert.

required

Returns:

Name Type Description
Tool Tool

The converted SDK tool.

Raises:

Type Description
ValueError

If the input is not a valid LangChain tool.