惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
爱范儿
爱范儿
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
博客园_首页
IT之家
IT之家
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 司徒正美
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
Jina AI
Jina AI
月光博客
月光博客
小众软件
小众软件
S
SegmentFault 最新的问题
量子位
阮一峰的网络日志
阮一峰的网络日志
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
The Daimon Java SDK: Chat, Stream, and Query Memory from ...
Rishi Kumar · 2026-05-17 · via DEV Community

If you've built AI features in Java recently, you know the drill: choose an LLM SDK, wire up HTTP clients, handle SSE parsing, build a session store, figure out RAG, repeat for every provider you want to support.

Daimon takes a different approach. It's a Go sidecar that runs next to your app and exposes a unified HTTP API for LLM inference, vector memory, graph queries, and session management — all wired from a single YAML file. Your application only talks to localhost.

Today the Daimon Java SDK (io.github.sonicboom15:daimon-client) lands on Maven Central. Here's what you can do with it.

Installation

Gradle (build.gradle):

dependencies {
    implementation 'io.github.sonicboom15:daimon-client:0.4.1'
}

Enter fullscreen mode Exit fullscreen mode

Maven (pom.xml):

<dependency>
    <groupId>io.github.sonicboom15</groupId>
    <artifactId>daimon-client</artifactId>
    <version>0.4.1</version>
</dependency>

Enter fullscreen mode Exit fullscreen mode

Requires Java 17+. The only transitive dependency is Gson.


Step 1: Configure and start the sidecar

Create config.yaml:

components:
  - name: assistant         # your name — "gpt", "local", whatever
    type: anthropic
    metadata:
      api_key: ${ANTHROPIC_API_KEY}
      default_model: claude-opus-4-7

Enter fullscreen mode Exit fullscreen mode

Start the sidecar (grab the binary from the GitHub releases page):

daimon serve --config config.yaml
# Listening on :3500

Enter fullscreen mode Exit fullscreen mode

Or run it with Go installed:

go install github.com/sonicboom15/daimon/cmd/daimon@latest
daimon serve --config config.yaml

Enter fullscreen mode Exit fullscreen mode


Step 2: Chat

Client client = new Client();

String reply = client.chat("assistant", "What is the capital of France?");
System.out.println(reply); // Paris

Enter fullscreen mode Exit fullscreen mode

Three lines. No HTTP wiring. No SSE parsing. No JSON boilerplate.

"assistant" is the component name you chose in config.yaml — nothing more. Want to switch from Anthropic to GPT-4o or Gemini? Change two lines in the YAML. The Java code stays exactly as it is.


Step 3: Streaming

For long responses where you want to display tokens as they arrive:

LLMClient llm = client.llm("assistant");

for (String fragment : llm.stream("Write a haiku about distributed systems")) {
    System.out.print(fragment);
    System.out.flush();
}

Enter fullscreen mode Exit fullscreen mode

stream() returns a lazy Iterable<String> backed by the SSE connection — no threads, no callbacks.


Step 4: Sessions (stateful conversations)

Attach a session_id to link requests into a conversation. The sidecar keeps the history server-side.

LLMClient llm = client.llm("assistant");

ChatOptions session = ChatOptions.builder()
        .sessionId("user-42")
        .build();

llm.chat("My name is Alice.", session);

String reply = llm.chat("What's my name?", session);
System.out.println(reply); // Alice

// Clear when done
llm.clearSession("user-42");

Enter fullscreen mode Exit fullscreen mode

Sessions default to in-memory storage. Add a session/redis or session/postgres component to make them persistent across restarts.


Step 5: Vector memory (RAG)

This is where things get interesting. Daimon can query a vector store on every request and inject the top results as context — automatically, before the LLM ever sees the message.

Update config.yaml:

components:
  - name: docs
    type: inmemory          # BM25, no external service needed

  - name: assistant
    type: anthropic
    metadata:
      api_key: ${ANTHROPIC_API_KEY}
    memory_store: docs      # inject top-5 docs before every chat call

Enter fullscreen mode Exit fullscreen mode

Java side:

MemoryStoreClient mem = client.memory("docs");

// Index some facts
mem.upsert("The Eiffel Tower is 330 metres tall and located in Paris.", "eiffel", null);
mem.upsert("The Colosseum is 48 metres tall and located in Rome.", "colosseum", null);
mem.upsert("The Burj Khalifa is 828 metres tall and located in Dubai.", "burj", null);

// Ask the LLM — relevant docs are injected automatically
String reply = client.chat("assistant", "Which famous landmark is tallest?");
System.out.println(reply); // mentions Burj Khalifa

Enter fullscreen mode Exit fullscreen mode

You can also query the store directly:

List<MemoryResult> results = mem.query("tall structures", 3);
for (MemoryResult r : results) {
    System.out.printf("[%.2f] %s%n", r.score(), r.content());
}

Enter fullscreen mode Exit fullscreen mode

Swap type: inmemory for type: chroma, type: qdrant, type: pgvector, or type: redis without touching a single line of Java.


Step 6: Graph queries

Daimon also exposes graph stores through the same thin client.

Add to config.yaml:

  - name: kg
    type: neo4j
    metadata:
      bolt_url: bolt://localhost:7687
      password: secret

Enter fullscreen mode Exit fullscreen mode

Java side:

GraphStoreClient graph = client.graph("kg");

graph.addNode("alice", List.of("Person"), Map.of("name", "Alice", "role", "engineer"));
graph.addNode("daimon", List.of("Project"), Map.of("name", "Daimon"));
graph.addEdge("alice", "daimon", "MAINTAINS", null);

List<Map<String, Object>> rows = graph.cypher(
        "MATCH (p:Person)-[:MAINTAINS]->(proj) RETURN p.name, proj.name",
        null
);

rows.forEach(row -> System.out.println(row.get("p.name") + " maintains " + row.get("proj.name")));
// Alice maintains Daimon

Enter fullscreen mode Exit fullscreen mode

For a deeper look at graph + LLM pipelines, see my earlier article: Build a Medical Chart Coding Pipeline with Daimon, Claude, and Neo4j.


Putting it together: a self-populating knowledge assistant

Here's a complete example that combines all three — LLM, memory, and graph — in under 50 lines:

import io.github.sonicboom15.daimon.*;
import java.util.List;
import java.util.Map;

public class KnowledgeAssistant {

    public static void main(String[] args) {
        Client client = new Client();

        // ── Populate memory store ───────────────────────────────
        MemoryStoreClient mem = client.memory("docs");
        mem.upsert("Java 17 introduced sealed classes and pattern matching for instanceof.", "java17", null);
        mem.upsert("Java 21 introduced virtual threads (Project Loom) and record patterns.", "java21", null);
        mem.upsert("Java 23 introduced structured concurrency as a preview feature.", "java23", null);

        // ── Populate graph store ────────────────────────────────
        GraphStoreClient graph = client.graph("kg");
        graph.addNode("java17", List.of("Release"), Map.of("version", "17", "year", "2021"));
        graph.addNode("java21", List.of("Release"), Map.of("version", "21", "year", "2023"));
        graph.addEdge("java17", "java21", "FOLLOWED_BY", null);

        // ── Ask a question — docs are injected automatically ────
        // (memory_store: docs is set on the assistant component in config.yaml)
        LLMClient llm = client.llm("assistant");
        String answer = llm.chat("What major features came in Java 21?");
        System.out.println("Answer: " + answer);

        // ── Direct graph query ───────────────────────────────────
        var timeline = graph.cypher(
                "MATCH (a:Release)-[:FOLLOWED_BY]->(b:Release) RETURN a.version, b.version ORDER BY a.year",
                null
        );
        System.out.println("Timeline: " + timeline);
    }
}

Enter fullscreen mode Exit fullscreen mode

The LLM will mention virtual threads and record patterns because the sidecar queried the memory store with "What major features came in Java 21?" and prepended the matching document as context.


What providers does Daimon support?

All configured in YAML — no code changes when you swap:

Type Provider
anthropic Claude (opus-4-7, sonnet-4-6, haiku-4-5)
openai GPT-4o, GPT-4o-mini, o1, o3
gemini Gemini 2.0 Flash, 1.5 Pro
mistral Mistral Large, Small, Nemo
llamacpp Any local OpenAI-compatible server (Ollama, LM Studio)

Links

Feedback, issues, and PRs are welcome.