Skip to main content

Gemini helper wrappers for Sigil Python SDK

Project description

Sigil Python Provider Helper: Gemini

sigil-sdk-gemini provides strict Gemini Models wrappers and mappers for Sigil.

Installation

pip install sigil-sdk sigil-sdk-gemini google-genai

Public API

  • Wrappers:
    • models.generate_content(...)
    • models.generate_content_async(...)
    • models.generate_content_stream(...)
    • models.generate_content_stream_async(...)
    • models.embed_content(...)
    • models.embed_content_async(...)
  • Mappers:
    • models.from_request_response(...)
    • models.from_stream(...)
    • models.embedding_from_response(...)

Wrapper Mode (Sync)

from google.genai import types as genai_types
from sigil_sdk import Client, ClientConfig
from sigil_sdk_gemini import GeminiOptions, models

client = Client(ClientConfig())

model = "gemini-2.5-pro"
contents = [genai_types.Content(role="user", parts=[genai_types.Part(text="Hello")])]
config = genai_types.GenerateContentConfig(max_output_tokens=256)

response = models.generate_content(
    client,
    model,
    contents,
    config,
    lambda req_model, req_contents, req_config: gemini_client.models.generate_content(
        model=req_model,
        contents=req_contents,
        config=req_config,
    ),
    GeminiOptions(conversation_id="conv-1", agent_name="assistant", agent_version="1.0.0"),
)

Wrapper Mode (Stream)

from sigil_sdk_gemini import GeminiStreamSummary, models

summary = models.generate_content_stream(
    client,
    model,
    contents,
    config,
    lambda req_model, req_contents, req_config: GeminiStreamSummary(
        responses=list(gemini_client.models.generate_content_stream(
            model=req_model,
            contents=req_contents,
            config=req_config,
        ))
    ),
)

Mapper Mode

generation = models.from_request_response(model, contents, config, response)
stream_generation = models.from_stream(model, contents, config, summary)

Embedding example

embedding_response = models.embed_content(
    client,
    "gemini-embedding-001",
    contents,
    None,
    lambda req_model, req_contents, req_config: gemini_client.models.embed_content(
        model=req_model,
        contents=req_contents,
        config=req_config,
    ),
)

Raw Provider Artifacts (Opt-In)

options = GeminiOptions(raw_artifacts=True)

Raw artifacts are default OFF and should only be enabled for diagnostics.

Provider metadata mapping

Gemini-specific fields are mapped as follows:

  • usage.thoughts_token_count -> normalized usage.reasoning_tokens
  • usage.tool_use_prompt_token_count -> metadata sigil.gen_ai.usage.tool_use_prompt_tokens
  • config.thinking_config.thinking_budget -> metadata sigil.gen_ai.request.thinking.budget_tokens
  • config.thinking_config.thinking_level -> metadata sigil.gen_ai.request.thinking.level

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sigil_sdk_gemini-0.1.3.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sigil_sdk_gemini-0.1.3-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file sigil_sdk_gemini-0.1.3.tar.gz.

File metadata

  • Download URL: sigil_sdk_gemini-0.1.3.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sigil_sdk_gemini-0.1.3.tar.gz
Algorithm Hash digest
SHA256 22eccb301d6dcd89fc4110802106a331d2d5daee6427e2dc96c93632eba43473
MD5 ec6c2aff852b9a3c42e331f12ea7a8df
BLAKE2b-256 15786dac19e9c721bfd3d71dc994a8f6edb7b855cac4a343ffab93b9a75bd5d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for sigil_sdk_gemini-0.1.3.tar.gz:

Publisher: python-sdks-publish.yml on grafana/sigil-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sigil_sdk_gemini-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for sigil_sdk_gemini-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dca9ee59e1abba51b741e6762f24d5b597c30eab0692902babea60a37775ae8b
MD5 8c22aeedbb4b903ddf165d3bf0b693aa
BLAKE2b-256 b318509b1f7449888eca7a98e8ff0bf56a9f43672c751ad0c3cd338129bd5ec0

See more details on using hashes here.

Provenance

The following attestation bundles were made for sigil_sdk_gemini-0.1.3-py3-none-any.whl:

Publisher: python-sdks-publish.yml on grafana/sigil-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page