Skip to main content

Module types

Module types 

Source
Expand description

Lightweight types mirroring the Google Gemini API structures needed for token counting.

These types support serde serialization/deserialization for JSON interop. They are intentionally minimal — only the fields relevant to token counting are included.

Structs§

ComputeTokensResult
Result of computing tokens, matching the Python SDK’s ComputeTokensResult.
Content
A content message in a conversation, containing a role and parts.
CountTokensConfig
Configuration for count_tokens, matching the Python SDK’s CountTokensConfig.
CountTokensResult
Result of counting tokens, matching the Python SDK’s CountTokensResult.
FunctionCall
A function call made by the model.
FunctionDeclaration
A declaration of a function that the model can call.
FunctionResponse
A response from a function call.
Part
A single part of a content message.
Schema
A JSON Schema definition used to describe function parameters and responses.
TokensInfo
Information about tokens for a single content part, matching the Python SDK’s TokensInfo.
Tool
A tool definition containing function declarations.

Enums§

Contents
Input contents, accepting either a text string or structured Content objects.