Skip to content

pulseprotocolorg-cyber/pulse-gemini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PULSE-Gemini

PyPI version PyPI downloads License

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.

About

Google Gemini adapter for PULSE Protocol

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages