Skip to main content

Google Gemini adapter for PULSE Protocol — send PULSE messages, get Gemini responses

Project description

PULSE-Gemini

Google Gemini adapter for PULSE Protocol — talk to Gemini with semantic messages.

Same interface as pulse-openai and pulse-anthropic — swap provider in one line. Zero Gemini boilerplate. Uses the new google-genai SDK (recommended by Google).

Quick Start

pip install pulse-gemini
from pulse import PulseMessage
from pulse_gemini import GeminiAdapter

adapter = GeminiAdapter(api_key="AIza...")

# Ask a question
msg = PulseMessage(
    action="ACT.QUERY.DATA",
    parameters={"query": "What is quantum computing?"}
)
response = adapter.send(msg)
print(response.content["parameters"]["result"])

Switch Providers in One Line

# from pulse_gemini import GeminiAdapter as Adapter
# from pulse_anthropic import AnthropicAdapter as Adapter
from pulse_openai import OpenAIAdapter as Adapter

adapter = Adapter(api_key="...")

Your code stays exactly the same. Only the import changes.

Supported Actions

PULSE Action What It Does Default Model
ACT.QUERY.DATA Ask a question gemini-2.0-flash
ACT.CREATE.TEXT Generate text gemini-2.0-flash
ACT.ANALYZE.SENTIMENT Analyze sentiment gemini-2.0-flash
ACT.ANALYZE.PATTERN Find patterns gemini-2.0-flash
ACT.TRANSFORM.TRANSLATE Translate text gemini-2.0-flash
ACT.TRANSFORM.SUMMARIZE Summarize text gemini-2.0-flash

Examples

Analyze sentiment

msg = PulseMessage(
    action="ACT.ANALYZE.SENTIMENT",
    parameters={"text": "This is the best day ever!"}
)
response = adapter.send(msg)

Translate text

msg = PulseMessage(
    action="ACT.TRANSFORM.TRANSLATE",
    parameters={"text": "Hello, world!", "target_language": "German"}
)
response = adapter.send(msg)

Summarize a long text

msg = PulseMessage(
    action="ACT.TRANSFORM.SUMMARIZE",
    parameters={
        "text": "Very long article text here...",
        "max_tokens": 200,
    }
)
response = adapter.send(msg)

Custom system prompt

msg = PulseMessage(
    action="ACT.QUERY.DATA",
    parameters={
        "query": "Explain recursion",
        "system_prompt": "You are a CS professor. Use simple analogies.",
    }
)
response = adapter.send(msg)

Use a different model

msg = PulseMessage(
    action="ACT.CREATE.TEXT",
    parameters={
        "instructions": "Write a poem about AI",
        "model": "gemini-2.0-pro",
        "temperature": 0.9,
    }
)
response = adapter.send(msg)

Parameters

Parameter Description Default
model Override the default model gemini-2.0-flash
temperature Creativity (0.0 - 2.0) 0.7
max_tokens Max response length 1000
system_prompt Custom system instruction per-action
target_language For translation action required

Why Gemini?

  • Free tier — 15 requests/minute, no credit card needed
  • Fast — Gemini 2.0 Flash is one of the fastest models
  • Multimodal — text, images, video, audio (PULSE text actions work out of the box)
  • Google ecosystem — integrates with Vertex AI for enterprise

Testing

pytest tests/ -q  # All tests mocked, no API key needed

PULSE Ecosystem

Package Provider Install
pulse-protocol Core pip install pulse-protocol
pulse-openai OpenAI pip install pulse-openai
pulse-anthropic Anthropic pip install pulse-anthropic
pulse-gemini Google pip install pulse-gemini
pulse-binance Binance pip install pulse-binance
pulse-bybit Bybit pip install pulse-bybit
pulse-kraken Kraken pip install pulse-kraken
pulse-okx OKX pip install pulse-okx
pulse-gateway Gateway pip install pulse-gateway

License

Apache 2.0 — open source, free forever.

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

pulse_gemini-0.1.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

pulse_gemini-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file pulse_gemini-0.1.0.tar.gz.

File metadata

  • Download URL: pulse_gemini-0.1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pulse_gemini-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8a2be9069e3df5198916aa36cdeb0b2f733ac25345584c667ef0a35a9540582c
MD5 6734827f851ac7514e1ef6cccbb4ef2c
BLAKE2b-256 12c2c985bf35850853a632aa57bfb9607bac0c144233f49a16ef05d9a48596a7

See more details on using hashes here.

File details

Details for the file pulse_gemini-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pulse_gemini-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pulse_gemini-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 391dc431fe8add9ef3d116c12abc4e67dfada3228d8011c683471be473485dca
MD5 1fe367448c10b00b66561905fb6fb886
BLAKE2b-256 93a589eb419c56a33459a732ca1163df461d1fd6d58bc1cc558ae416981fc1c9

See more details on using hashes here.

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