Skip to main content

Ollama adapter for PULSE Protocol — run local AI models with the same interface as cloud providers

Project description

pulse-ollama

Ollama adapter for PULSE Protocol — run local AI models with the same interface as cloud providers.

Your data never leaves your machine. GDPR-compliant by design.

# Switch from cloud to local — one line changes:
# from pulse_openai import OpenAIAdapter as AI; adapter = AI(api_key="sk-...")
from pulse_ollama import OllamaAdapter as AI; adapter = AI(model="llama3.2")

# Everything below stays EXACTLY the same
msg = PulseMessage(action="ACT.ANALYZE.SENTIMENT", parameters={"text": "I love open source!"})
response = adapter.send(msg)
print(response.content["parameters"]["result"])

Why pulse-ollama?

Feature Cloud (OpenAI/Anthropic) Local (Ollama)
Data leaves your machine Yes No
GDPR compliance Depends on DPA By design
Works offline No Yes
API key required Yes No
Cost per token Yes Free

Installation

pip install pulse-ollama

Requirements: Ollama must be installed and running.

# Install Ollama (macOS/Linux)
curl -fsSL https://ollama.ai/install.sh | sh

# Pull a model
ollama pull llama3.2       # 2GB, fast
ollama pull mistral        # 4GB, high quality
ollama pull phi3           # 2GB, efficient
ollama pull gemma2         # 5GB, Google's model

Quick Start

from pulse import PulseMessage
from pulse_ollama import OllamaAdapter

adapter = OllamaAdapter(model="llama3.2")

# See what models you have installed
print(adapter.list_models())
# ['llama3.2:latest', 'mistral:latest', 'phi3:latest']

# Ask a question
msg = PulseMessage(
    action="ACT.QUERY.DATA",
    parameters={"query": "Explain PULSE Protocol in one sentence"}
)
response = adapter.send(msg)
print(response.content["parameters"]["result"])

# Sentiment analysis
msg = PulseMessage(
    action="ACT.ANALYZE.SENTIMENT",
    parameters={"text": "I love this open source project!"}
)
response = adapter.send(msg)
print(response.content["parameters"]["result"])
# {"sentiment": "positive", "confidence": 0.95, "explanation": "..."}

# Translate
msg = PulseMessage(
    action="ACT.TRANSFORM.TRANSLATE",
    parameters={"text": "Hello, world!", "target_language": "German"}
)
response = adapter.send(msg)
print(response.content["parameters"]["result"])
# Hallo, Welt!

Supported Actions

PULSE Action Description
ACT.QUERY.DATA Ask questions, get answers
ACT.CREATE.TEXT Generate text from instructions
ACT.ANALYZE.SENTIMENT Analyze emotional tone
ACT.ANALYZE.PATTERN Find patterns in data
ACT.TRANSFORM.TRANSLATE Translate between languages
ACT.TRANSFORM.SUMMARIZE Summarize long text

Configuration

adapter = OllamaAdapter(
    model="llama3.2",                        # Default model
    host="http://localhost:11434",           # Ollama server URL
    timeout=120,                             # Inference timeout (seconds)
)

# Override model per-request
msg = PulseMessage(
    action="ACT.CREATE.TEXT",
    parameters={
        "instructions": "Write a poem about AI",
        "model": "mistral",           # Override default
        "temperature": 0.9,           # Creativity
    }
)

# Remote Ollama server (shared team deployment)
adapter = OllamaAdapter(host="http://ai-server.company.com:11434")

Provider Switching

The whole point of PULSE adapters is that switching providers is one line:

# Local model (privacy, offline, free)
from pulse_ollama import OllamaAdapter as AI
adapter = AI(model="llama3.2")

# Cloud (scale, latest models)
# from pulse_openai import OpenAIAdapter as AI
# adapter = AI(api_key="sk-...")

# Everything else stays identical
response = adapter.send(msg)

Part of the PULSE Ecosystem

pulse-protocol    # Core (install this first)
pulse-openai      # OpenAI GPT
pulse-anthropic   # Anthropic Claude
pulse-ollama      # Local models (this package)
pulse-gemini      # Google Gemini
pulse-binance     # Binance exchange
pulse-bybit       # Bybit exchange
pulse-kraken      # Kraken exchange

License

Apache 2.0 — free forever.

GitHub: github.com/pulseprotocolorg-cyber/pulse-python

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_ollama-0.1.0.tar.gz (11.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_ollama-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pulse_ollama-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ad89fab1be32d7709a448d2502f000353029b518b16bdc82a61373bf12512dff
MD5 af74d0b554a33d897dad9ef7eda1fd91
BLAKE2b-256 f2943333347d701dc8f45410e95d558a9589d40f62a0689761217469249edcce

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pulse_ollama-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 873c98d17eed2e0f58ddbfcfe0fe0f0e1ece52e89f33097b1bb1e6bb9acf6b2b
MD5 32482d0587d4739565c1eb82049ca40a
BLAKE2b-256 f3656edc10bb59c6c680db8ee3d1f7d48a40cefe97a90b5831e852d72912af2e

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