orxtra v0.13.0 /transport.src.orxtra.transport.providers._google
On this page

GoogleProvider: Provider implementation for the Gemini API -- converts orxtra's Anthropic-style messages and tool specs to Gemini's contents/functionDeclaration format and back.

#transport.src.orxtra.transport.providers._google

#transport.src.orxtra.transport.providers._google

#GoogleProvider

#build_request

python
def build_request(self, messages: list[dict[str, Any]], tools: list[dict[str, Any]], system: str, model: str) -> dict[str, Any]

#parse_response

python
def parse_response(self, response: dict[str, Any]) -> list[ContentBlock]

#parse_stream

python
async def parse_stream(self, byte_stream: AsyncIterator[bytes]) -> AsyncIterator[TransportEvent]

#extract_usage

python
def extract_usage(self, response: dict[str, Any]) -> Usage

#format_tool_result

python
def format_tool_result(self, tool_use_id: str, content: str, is_error: bool) -> dict[str, Any]

#wrap_tool_results

python
def wrap_tool_results(self, results: list[dict[str, Any]]) -> list[dict[str, Any]]

#format_assistant_message

python
def format_assistant_message(self, blocks: list[ContentBlock]) -> dict[str, Any]

#_convert_messages

python
def _convert_messages(messages: list[dict[str, Any]]) -> list[dict[str, Any]]

Convert orxtra-internal messages to Gemini contents format.

#_map_role

python
def _map_role(role: str) -> str

Map standard roles to Gemini roles.

#_extract_parts

python
def _extract_parts(msg: dict[str, Any]) -> list[dict[str, Any]]

Extract parts from a message dict.

#_convert_content_block

python
def _convert_content_block(block: dict[str, Any]) -> list[dict[str, Any]]

Convert a single content block to Gemini parts.

#_convert_tool

python
def _convert_tool(tool: dict[str, Any]) -> dict[str, Any]

Convert an orxtra tool definition to a Gemini functionDeclaration.

Deferred tools omit parameters entirely (Gemini allows this), producing a compact declaration with only name and description.

Search