~kris/9p

llm9p

ref: 11a3967dad6f8daf61558564240fb0ed7a7a2660 llm9p/internal/llm/session_compact_test.go -rw-r--r-- 6.2 KiB
11a3967d — P. D. Finn KD9WEH 6 months ago
Merge pull request #1 from NERVsystems/claude/local-llm-feasibility-gVLhq

Add OpenAI-compatible local LLM backend support
2eac753a — Claude 6 months ago
Add OpenAI-compatible backend for local LLM support (GPT-OSS)

Implement OpenAIClient backend that speaks the OpenAI Chat Completions
API (/v1/chat/completions), enabling llm9p to work with any local model
server: Ollama, vLLM, llama-server, LocalAI, or LM Studio.

Primary target is GPT-OSS (OpenAI's open-weight MoE models), but any
model served via these platforms works. The backend supports:
- Blocking and streaming chat completions
- Tool/function calling with STOP:/TOOL: formatting
- Token counting from API usage (with estimation fallback)
- Conversation history, system prompts, temperature control
- Stateless AskWithRequest for session isolation

Usage:
  ./llm9p -backend openai -openai-url http://localhost:11434/v1 -model gpt-oss:20b

Also fixes pre-existing stale mock backends in test files (AskWithRequest
signature was out of date with the Backend interface).

https://claude.ai/code/session_017qVVZUUhfCCvNkMYmXDZAa
58bb4b6e — pdfinn 6 months ago
test(llm9p): add tests for per-session compact and usage files

- session_compact_test.go (llm): Tests for Session.EstimatedContextTokens,
  SessionManager.Compact (not found, too short, replaces messages, resets
  tokens), SessionManager.ContextLimit and EstimatedContextTokens.

- session_compact.go (llmfs): Fix Stat().Length for SessionCompactFile
  (was 0 from BaseFile default; now returns fixed read-msg length).

- session_compact_test.go (llmfs): Tests for SessionCompactFile (read,
  read EOF, write no-op short history, write compacts, stat), for
  SessionUsageFile (format, EOF, read-only write, stat, dynamic content),
  and SessionDir.Children/Lookup wiring for compact and usage.

52 tests total, all pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>