Skip to content

Commit fe9f09d

Browse files
authored
Added Eliza model (#31)
* Added Eliza model * Updates based on PR comments * Added WithThinking option for eliza
1 parent e21226c commit fe9f09d

14 files changed

Lines changed: 2686 additions & 17 deletions

File tree

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ docker run -d --name go-llm \
3939

4040
### Client
4141

42-
The client-only CLI can be downloaded from the [releases page](https://github.com/mutablelogic/go-llm/releases). It does not include the server or the Telegram bot. Point it at a running server:
42+
The client-only CLI can be downloaded from the [releases page](https://github.com/mutablelogic/go-llm/releases), or use `go install -tags client github.com/mutablelogic/go-llm/cmd/llm@latest`. It does not include the server or the Telegram bot. Point it at a running server:
4343

4444
```bash
4545
export LLM_ADDR="localhost:8085"
@@ -76,17 +76,18 @@ docker run -d --name go-llm-telegram \
7676

7777
### Providers
7878

79-
API keys are configured on the server via flags or environment variables:
79+
Providers are sources of models and generation capabilities. Some providers may support additional features like thinking/reasoning, tool use and embeddings. API keys for access to provider models are configured on the server via flags or environment variables:
8080

8181
| Provider | Flag | Env Variable | Models |
8282
|----------|------|-------------|--------|
8383
| **Google Gemini** | `--gemini-api-key` | `GEMINI_API_KEY` | Gemini 2.0 Flash, Flash Lite, embedding models, etc. |
8484
| **Anthropic Claude** | `--anthropic-api-key` | `ANTHROPIC_API_KEY` | Claude Sonnet, Haiku, Opus, etc. |
8585
| **Mistral** | `--mistral-api-key` | `MISTRAL_API_KEY` | Mistral Large, Small, embedding models, etc. |
86+
| **ELIZA** | `--eliza` | *(none)* | Mock provider based on Weizenbaum's 1966 chatbot; no API key needed (en, de, fr) |
8687

8788
### Tools
8889

89-
The following tools are included as examples of how to build tool integrations with the SDK:
90+
Tools are external functions that can be called by the agent during generation. They are registered with the agent and exposed via the API and MCP server. Tools can be configured with flags or environment variables as needed for authentication or connection details. The following tools are included as examples of how to build tool integrations with the SDK:
9091

9192
| Tool | Flag | Env Variable | Description |
9293
|------|------|-------------|-------------|
@@ -138,6 +139,8 @@ The `llm` command-line tool can connect to any running go-llm server (set `LLM_A
138139

139140
### Session
140141

142+
Sessions represent stateful conversations with context and memory. They can be managed via the CLI or API, and are persisted on the server for later retrieval.
143+
141144
| Command | Description | Example |
142145
|---------|-------------|---------|
143146
| `sessions` | List sessions | `llm sessions` |
@@ -157,8 +160,8 @@ The `llm` command-line tool can connect to any running go-llm server (set `LLM_A
157160

158161
| Command | Description | Example |
159162
|---------|-------------|---------|
160-
| `run` | Start the HTTP API server | `llm run` |
161-
| `telegram` | Run as a Telegram bot | `llm telegram --model gemini-2.0-flash` |
163+
| `run` | Start the server | `llm run` |
164+
| `telegram` | Run as a Telegram bot, requiring a server | `llm telegram --model gemini-2.0-flash` |
162165

163166
Use `llm --help` or `llm <command> --help` for full options.
164167

@@ -229,6 +232,8 @@ flowchart LR
229232
Anthropic Claude`"]
230233
Mistral["`**pkg/provider/mistral**
231234
Mistral`"]
235+
Eliza["`**pkg/provider/eliza**
236+
ELIZA (mock)`"]
232237
end
233238
234239
subgraph ToolImpls["Example Tools"]
@@ -251,6 +256,7 @@ flowchart LR
251256
Agent --> Gemini
252257
Agent --> Claude
253258
Agent --> Mistral
259+
Agent --> Eliza
254260
Tools --> HA
255261
Tools --> News
256262
Tools --> Weather
@@ -303,7 +309,7 @@ func main() {
303309
| Package | Description |
304310
|---------|-------------|
305311
| `pkg/agent` | Central manager orchestrating providers, sessions, and tools |
306-
| `pkg/provider/{google,anthropic,mistral}` | Provider implementations |
312+
| `pkg/provider/{google,anthropic,mistral,eliza}` | Provider implementations |
307313
| `pkg/session` | Session storage backends (in-memory, file-backed JSON) |
308314
| `pkg/tool` | Tool interface and toolkit registry |
309315
| `pkg/schema` | Core types (Model, Message, ContentBlock, Attachment, Session, etc.) |

cmd/llm/server.go

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,20 @@ import (
99
"path/filepath"
1010

1111
// Packages
12-
"github.com/mutablelogic/go-client"
12+
client "github.com/mutablelogic/go-client"
1313
agent "github.com/mutablelogic/go-llm/pkg/agent"
14-
"github.com/mutablelogic/go-llm/pkg/homeassistant"
14+
homeassistant "github.com/mutablelogic/go-llm/pkg/homeassistant"
1515
httphandler "github.com/mutablelogic/go-llm/pkg/httphandler"
16-
"github.com/mutablelogic/go-llm/pkg/newsapi"
17-
"github.com/mutablelogic/go-llm/pkg/provider/anthropic"
18-
"github.com/mutablelogic/go-llm/pkg/provider/google"
19-
"github.com/mutablelogic/go-llm/pkg/provider/mistral"
20-
"github.com/mutablelogic/go-llm/pkg/schema"
21-
"github.com/mutablelogic/go-llm/pkg/session"
22-
"github.com/mutablelogic/go-llm/pkg/tool"
16+
newsapi "github.com/mutablelogic/go-llm/pkg/newsapi"
17+
anthropic "github.com/mutablelogic/go-llm/pkg/provider/anthropic"
18+
"github.com/mutablelogic/go-llm/pkg/provider/eliza"
19+
google "github.com/mutablelogic/go-llm/pkg/provider/google"
20+
mistral "github.com/mutablelogic/go-llm/pkg/provider/mistral"
21+
schema "github.com/mutablelogic/go-llm/pkg/schema"
22+
session "github.com/mutablelogic/go-llm/pkg/session"
23+
tool "github.com/mutablelogic/go-llm/pkg/tool"
2324
version "github.com/mutablelogic/go-llm/pkg/version"
24-
"github.com/mutablelogic/go-llm/pkg/weatherapi"
25+
weatherapi "github.com/mutablelogic/go-llm/pkg/weatherapi"
2526
server "github.com/mutablelogic/go-server"
2627
httprouter "github.com/mutablelogic/go-server/pkg/httprouter"
2728
httpserver "github.com/mutablelogic/go-server/pkg/httpserver"
@@ -37,6 +38,7 @@ type RunServer struct {
3738
GeminiAPIKey string `name:"gemini-api-key" env:"GEMINI_API_KEY" help:"Google Gemini API key"`
3839
AnthropicAPIKey string `name:"anthropic-api-key" env:"ANTHROPIC_API_KEY" help:"Anthropic API key"`
3940
MistralAPIKey string `name:"mistral-api-key" env:"MISTRAL_API_KEY" help:"Mistral API key"`
41+
Eliza bool `name:"eliza" help:"Include ELIZA provider (no API key required)"`
4042

4143
// Tool API Keys
4244
NewsAPIKey string `name:"news-api-key" env:"NEWS_API_KEY" help:"NewsAPI key"`
@@ -106,6 +108,15 @@ func (cmd *RunServer) WithManager(ctx *Globals, fn func(*agent.Manager, string)
106108
opts = append(opts, agent.WithClient(mistralClient))
107109
}
108110

111+
// Eliza
112+
if cmd.Eliza {
113+
elizaClient, err := eliza.New()
114+
if err != nil {
115+
return fmt.Errorf("failed to create ELIZA client: %w", err)
116+
}
117+
opts = append(opts, agent.WithClient(elizaClient))
118+
}
119+
109120
// Check if at least one client is configured
110121
if len(opts) == 0 {
111122
return fmt.Errorf("no API keys configured. Set --gemini-api-key, --anthropic-api-key, or --mistral-api-key (or use environment variables)")
@@ -285,7 +296,7 @@ func (g *Globals) Manager() (*agent.Manager, error) {
285296
286297
// Check if at least one client is configured
287298
if len(opts) == 0 {
288-
return nil, fmt.Errorf("no API keys configured. Set --gemini-api-key, --anthropic-api-key, or --mistral-api-key (or use environment variables)")
299+
return nil, fmt.Errorf("no providers configured. Set --gemini-api-key, --anthropic-api-key, or --mistral-api-key (or use environment variables), or use --eliza for a local provider")
289300
}
290301
291302
return agent.NewAgent(opts...)

pkg/agent/generator.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
llm "github.com/mutablelogic/go-llm"
1111
opt "github.com/mutablelogic/go-llm/pkg/opt"
1212
anthropic "github.com/mutablelogic/go-llm/pkg/provider/anthropic"
13+
eliza "github.com/mutablelogic/go-llm/pkg/provider/eliza"
1314
google "github.com/mutablelogic/go-llm/pkg/provider/google"
1415
mistral "github.com/mutablelogic/go-llm/pkg/provider/mistral"
1516
schema "github.com/mutablelogic/go-llm/pkg/schema"
@@ -269,6 +270,8 @@ func withThinking() opt.Opt {
269270
switch provider {
270271
case schema.Gemini:
271272
return google.WithThinking()
273+
case schema.Eliza:
274+
return eliza.WithThinking()
272275
default:
273276
return opt.Error(llm.ErrBadParameter.Withf("%s: WithThinking without budget not supported (use --thinking-budget)", provider))
274277
}
@@ -283,6 +286,8 @@ func withThinkingBudget(budgetTokens uint) opt.Opt {
283286
return google.WithThinkingBudget(budgetTokens)
284287
case schema.Anthropic:
285288
return anthropic.WithThinking(budgetTokens)
289+
case schema.Eliza:
290+
return eliza.WithThinking()
286291
default:
287292
return opt.Error(llm.ErrNotImplemented.Withf("%s: WithThinking not supported", provider))
288293
}

0 commit comments

Comments
 (0)