Skip to content

pulseprotocolorg-cyber/pulse-openai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PULSE-OpenAI

PyPI version PyPI downloads License

OpenAI adapter for PULSE Protocol — talk to GPT with semantic messages.

Send PULSE semantic messages, get AI responses. Zero OpenAI boilerplate. Same code works with Anthropic, Binance, Bybit — just change one line.

Quick Start

pip install pulse-openai
from pulse import PulseMessage
from pulse_openai import OpenAIAdapter

adapter = OpenAIAdapter(api_key="sk-...")

# 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_openai import OpenAIAdapter as Adapter
from pulse_anthropic import AnthropicAdapter 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 gpt-4o-mini
ACT.CREATE.TEXT Generate text gpt-4o
ACT.ANALYZE.SENTIMENT Analyze sentiment gpt-4o-mini
ACT.ANALYZE.PATTERN Find patterns gpt-4o
ACT.TRANSFORM.TRANSLATE Translate text gpt-4o-mini
ACT.TRANSFORM.SUMMARIZE Summarize text gpt-4o-mini

Examples

Analyze sentiment

msg = PulseMessage(
    action="ACT.ANALYZE.SENTIMENT",
    parameters={"text": "I love this product!"}
)
response = adapter.send(msg)

Generate text with custom model

msg = PulseMessage(
    action="ACT.CREATE.TEXT",
    parameters={
        "text": "Write a haiku about AI",
        "model": "gpt-4o",
        "temperature": 0.9,
        "max_tokens": 500,
    }
)
response = adapter.send(msg)

Translate text

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

Parameters

Parameter Description Default
model Override the default model per-action
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

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-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

OpenAI adapter for PULSE Protocol — pip install pulse-openai

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages