Skip to content

hellonico/pyjama

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

234 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Pyjama

Multi-Provider LLM Client + Agent Framework for Clojure

Switch transparently between Ollama, ChatGPT, Claude, DeepSeek, and OpenRouter. Chain LLM calls with declarative workflows.

Related blog posts

🎬 Video Demo

Pyjama CLI Demo

Watch the demo: Native binary CLI with streaming, vision analysis, image generation, and auto-pull features.

LLM Client - Any Provider

Ollama (Local)

(require '[pyjama.core :as p])

(p/ollama "http://localhost:11434" :generate 
  {:prompt "Explain Clojure in one sentence"})

Interactive Chat:

# Start chat with default model (llama3.2)
clj -M:ollama

# Specify a different model
clj -M:ollama -m llama3.1

# Use a remote Ollama server
clj -M:ollama -m qwen2.5 -u http://192.168.1.100:11434

Image Generation:

# Generate image (auto-detects by .png extension)
clj -M -m pyjama.cli.ollama -o sunset.png -p "Beautiful sunset over ocean"

# Custom size
clj -M -m pyjama.cli.ollama -o art.png -w 1920 -g 1080 -p "Cyberpunk city"

# Save text to markdown
clj -M -m pyjama.cli.ollama -m llama3.2 -o response.md -p "Explain Clojure"

Native Binary (instant startup, standalone):

# Build once (~2 minutes)
clj -M:native-cli

# Use anywhere
./pyjama -o image.png -w 512 -g 512 -p "A robot"
./pyjama -m llama3.2 -o doc.md -p "Explain macros"

πŸ“– Full Ollama Documentation - Chat, image generation, vision models, native binary, and more

ChatGPT / OpenAI

(require '[pyjama.openai :as openai])

(openai/chatgpt 
  {:messages [{:role "user" :content "Explain Clojure"}]})

Interactive Chat (Any Provider):

# ChatGPT (default)
clj -M:llm

# Claude
clj -M:llm -l claude

# DeepSeek
clj -M:llm -l deepseek

# Gemini
clj -M:llm -l gemini

# OpenRouter
clj -M:llm -l openrouter -m anthropic/claude-3.5-sonnet

Secrets loaded automatically from ~/.secrets/secrets.edn or Vault.

Claude / OpenRouter / DeepSeek

Same simple interface - just swap the provider. See docs/EXAMPLES.md for all providers.

Agent Framework - Chain LLM Calls

Want to chain multiple LLM calls? The Agent Framework lets you dynamically route between providers and steps.

Quick Example

{:my-agent
 {:start :analyze
  :steps
  {:analyze
   {:prompt "Analyze: {{ctx.input}}. Return: positive/negative/neutral"
    :next :route}
   
   :route
   {:routes [{:when [:= [:obs] "positive"] :next :celebrate}
             {:when [:= [:obs] "negative"] :next :sympathize}]
    :next :neutral-response}}}}

Run it:

clj -M -m pyjama.cli.agent run my-agent '{"input": "I love Clojure!"}'

Real-World Examples

Full documentation: docs/LOOP_SUPPORT.md

Live Dashboard πŸ“Š

Monitor running agents with interactive Mermaid diagrams:

clj -M -m pyjama.agent.hooks.dashboard
open http://localhost:8090

Full guide: docs/DASHBOARD.md

Secrets Management

Secure API credentials with the Secrets Library (100% open source):

(require '[secrets.core :as secrets])

;; Get secrets in your agents
(secrets/get-secret [:openai :api-key])     ; => "sk-..."
(secrets/get-secret [:gitlab :token])        ; => "glpat-..."

File-based (secrets.edn):

{:openai {:api-key "sk-..."}
 :gitlab {:token "glpat-..." :url "https://gitlab.com"}}

Vault integration (open source):

(vault/read-secret config "secret" "pyjama/openai")
;; => {:api-key "sk-..."}

Environment-aware staging/production separation.

πŸ‘‰ Full Documentation | Quick Start

Agent Showcases

Full-stack example agents demonstrating Pyjama's capabilities:

AI image generation with Ollama's Z-Image Turbo model. Full-stack ClojureScript app with real-time progress tracking and beautiful UI.

  • Text-to-image generation
  • Real-time HTTP polling
  • Custom dimensions (128Γ—128 to 2048Γ—2048)
  • Modern gradient UI

AI-powered movie analysis using TMDB API. CLI and web UI modes.

  • TMDB API integration
  • LLM-powered reviews
  • Plot summaries & recommendations
  • Web UI + CLI modes

πŸ“§ Email Agents

Email automation with pure EDN (no Clojure code!). Watcher and sender agents.

  • Email monitoring with batch processing
  • LLM email composition
  • IMAP/SMTP integration
  • Declarative loops

More showcases: pyjama-agent-showcases

Documentation

Installation

; deps.edn
{:deps {hellonico/pyjama {:git/url "https://github.com/hellonico/pyjama"
                          :git/tag "v0.3.0"
                          :git/sha "78b0c77"}}}

License

Copyright Β© 2024-2026 hellonico

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.

About

Unified Clojure interface for agentic AI: Ollama, ChatGPT, OpenAI, DeepSeek, Claude.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors