Skip to content

Commit 6856b69

Browse files
authored
Merge pull request #53 from petal-labs/docs/update-example-models
docs(examples): refresh README and examples to latest models
2 parents d6d62bc + 3cf5778 commit 6856b69

15 files changed

Lines changed: 152 additions & 33 deletions

File tree

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func main() {
8080
client := core.NewClient(provider)
8181

8282
// Send a chat request
83-
resp, err := client.Chat("gpt-4o").
83+
resp, err := client.Chat("gpt-5.6").
8484
System("You are a helpful assistant.").
8585
User("What is the capital of France?").
8686
Temperature(0.7).
@@ -393,7 +393,7 @@ client := core.NewClient(provider, core.WithTimeout(5*time.Minute))
393393
client := core.NewClient(provider, core.WithTimeout(0))
394394

395395
// Per-call override
396-
resp, err := client.Chat("gpt-4o").
396+
resp, err := client.Chat("gpt-5.6").
397397
User("Hello").
398398
Timeout(30 * time.Second).
399399
GetResponse(context.Background())
@@ -409,7 +409,7 @@ Precedence: a deadline already on the caller's `ctx` always wins; otherwise the
409409
### Streaming Responses
410410

411411
```go
412-
stream, err := client.Chat("gpt-4o").
412+
stream, err := client.Chat("gpt-5.6").
413413
User("Write a short poem about Go.").
414414
Stream(context.Background())
415415

@@ -445,7 +445,7 @@ client := core.NewClient(provider,
445445
// Define a tool
446446
weatherTool := mytools.NewWeatherTool()
447447

448-
resp, err := client.Chat("gpt-4o").
448+
resp, err := client.Chat("gpt-5.6").
449449
User("What's the weather in San Francisco?").
450450
Tools(weatherTool).
451451
GetResponse(ctx)
@@ -473,7 +473,7 @@ wrappedTool := tools.ApplyMiddleware(
473473
tools.WithLogging(logger),
474474
)
475475

476-
resp, err := client.Chat("gpt-4o").
476+
resp, err := client.Chat("gpt-5.6").
477477
User("What's the weather in San Francisco?").
478478
Tools(wrappedTool).
479479
GetResponse(ctx)
@@ -487,7 +487,7 @@ Constrain model output to valid JSON or a specific JSON Schema:
487487

488488
```go
489489
// JSON mode - model outputs valid JSON
490-
resp, err := client.Chat("gpt-4o").
490+
resp, err := client.Chat("gpt-5.6").
491491
User("List 3 programming languages with their year created").
492492
ResponseJSON().
493493
GetResponse(ctx)
@@ -517,7 +517,7 @@ schema := &core.JSONSchemaDefinition{
517517
}`),
518518
}
519519

520-
resp, err := client.Chat("gpt-4o").
520+
resp, err := client.Chat("gpt-5.6").
521521
User("Extract: John is 30 years old").
522522
ResponseJSONSchema(schema).
523523
GetResponse(ctx)
@@ -533,7 +533,7 @@ The `Conversation` type manages message history automatically:
533533

534534
```go
535535
// Create a conversation with a system prompt
536-
conv := core.NewConversation(client, "gpt-4o",
536+
conv := core.NewConversation(client, "gpt-5.6",
537537
core.WithSystemMessage("You are a helpful assistant."),
538538
)
539539

@@ -561,8 +561,8 @@ if !ok {
561561

562562
// Create batch requests
563563
requests := []core.BatchRequest{
564-
{CustomID: "req-1", Request: core.ChatRequest{Model: "gpt-4o", Messages: msgs1}},
565-
{CustomID: "req-2", Request: core.ChatRequest{Model: "gpt-4o", Messages: msgs2}},
564+
{CustomID: "req-1", Request: core.ChatRequest{Model: "gpt-5.6", Messages: msgs1}},
565+
{CustomID: "req-2", Request: core.ChatRequest{Model: "gpt-5.6", Messages: msgs2}},
566566
}
567567

568568
// Submit batch
@@ -719,7 +719,7 @@ iris keys set zai
719719
iris keys set ollama # Only needed for Ollama Cloud
720720

721721
# Chat with OpenAI
722-
iris chat --provider openai --model gpt-4o --prompt "Hello, world!"
722+
iris chat --provider openai --model gpt-5.6 --prompt "Hello, world!"
723723

724724
# Chat with Anthropic Claude
725725
iris chat --provider anthropic --model claude-sonnet-5 --prompt "Hello, world!"
@@ -740,11 +740,11 @@ iris chat --provider ollama --model llama3.2 --prompt "Hello, world!"
740740
iris chat --provider openai --model gpt-5 --prompt "Explain quantum entanglement"
741741

742742
# Stream responses
743-
iris chat --provider openai --model gpt-4o --prompt "Tell me a story" --stream
743+
iris chat --provider openai --model gpt-5.6 --prompt "Tell me a story" --stream
744744
iris chat --provider anthropic --model claude-sonnet-5 --prompt "Tell me a story" --stream
745745

746746
# Get JSON output
747-
iris chat --provider openai --model gpt-4o --prompt "Hello" --json
747+
iris chat --provider openai --model gpt-5.6 --prompt "Hello" --json
748748

749749
# Initialize a new project
750750
iris init myproject
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
---
2+
date: 2026-08-02
3+
version: v0.17.0
4+
feature: Example/README Model Refresh (latest provider models)
5+
product: iris
6+
change_type: docs
7+
affected_components: [README.md, examples/batch/basic/main.go, examples/chat/basic/main.go, examples/chat/conversation/main.go, examples/chat/conversation-streaming/main.go, examples/chat/streaming/main.go, examples/chat/structured-output/main.go, examples/chat/system-message/main.go, examples/chat/xai-basic/main.go, examples/chat/zai-basic/main.go, examples/chat/zai-streaming/main.go, examples/image/gemini/main.go, examples/testing/mock-provider/main.go, examples/tools/weather/main.go]
8+
related_frds: []
9+
---
10+
11+
## Summary
12+
13+
Updated the model identifiers used throughout `README.md`'s code snippets and the `examples/` programs so they demonstrate Iris against each provider's current latest models instead of older/deprecated ones. This is a documentation/example-only change: no `core/` or `providers/` production code was modified (provider `models.go` files were only read, to confirm target constant names exist). The refresh replaces the generic OpenAI small/flagship model strings (`gpt-4o-mini`, `gpt-4o`) and two typed provider constants (`xai.ModelGrok41FastNonReasoning`, `zai.ModelGLM47Flash`) with their current equivalents, and swaps the Gemini image example onto the newest image-generation constant. The xAI reasoning example intentionally stays on `grok-3-mini` (see below).
14+
15+
## Motivation
16+
17+
Examples are the first code a new Iris user copies and runs. Several had drifted behind the provider model catalogs (already kept current in the README's own "Supported Models" tables and in `providers/*/models.go`), so a user following the README or `go run`-ing an example would unknowingly reach for an older/soon-to-be-legacy model. This change brings example code back in line with the catalog without touching the catalog itself or the reference tables, which were already current.
18+
19+
## What Changed
20+
21+
### New Additions
22+
23+
N/A — no new files, types, or exported symbols were added. This change only edits existing example programs and README code fences.
24+
25+
### Modifications
26+
27+
- **`"gpt-4o-mini"``"gpt-5.4-mini"`** (string literal, OpenAI small model) in:
28+
- `examples/batch/basic/main.go` (3 occurrences — three batch request entries)
29+
- `examples/chat/basic/main.go` (1)
30+
- `examples/chat/conversation/main.go` (1)
31+
- `examples/chat/conversation-streaming/main.go` (1)
32+
- `examples/chat/streaming/main.go` (1)
33+
- `examples/chat/structured-output/main.go` (2)
34+
- `examples/chat/system-message/main.go` (3)
35+
- `examples/testing/mock-provider/main.go` (2 — both the `RecordingProvider` fallback mock response's declared `Model` field and the live `client.Chat(...)` call in `demonstrateRecordingProvider`/`demonstrateRecordingWithProvider`, so the two stay consistent with each other)
36+
- `examples/tools/weather/main.go` (1)
37+
- **`"gpt-4o"``"gpt-5.6"`** (string literal, OpenAI flagship model, used generically) in `README.md`, 13 occurrences across the Quick Start example, the Timeouts/Streaming/Tools/Tool-Middleware/Structured-Output/Conversation-Management/Batch-API sections, and three `iris chat --model gpt-4o ...` CLI examples.
38+
- **`xai.ModelGrok41FastNonReasoning``xai.ModelGrok45`** in `examples/chat/xai-basic/main.go`. The stale inline comment ("Using grok-4-1-fast-non-reasoning for quick responses") was updated to reference grok-4.5.
39+
- **`examples/chat/xai-reasoning/main.go` deliberately keeps `xai.ModelGrok3Mini`.** Per the provider catalog, `grok-3-mini` is the model that exposes `reasoning_content` in responses; newer models like `grok-4.5` support reasoning but do not surface the reasoning trace via `resp.Reasoning`. Since this example prints `resp.Reasoning.Summary`, bumping it to a "latest" model would make the demo produce no reasoning output. It is left on `grok-3-mini` with its explanatory comments intact.
40+
- **`zai.ModelGLM47Flash``zai.ModelGLM52`** in `examples/chat/zai-basic/main.go` and `examples/chat/zai-streaming/main.go`.
41+
- **`gemini.ModelGemini25FlashImage``gemini.ModelGemini31FlashImagePreview`** in `examples/image/gemini/main.go`.
42+
43+
### Removals
44+
45+
N/A — nothing was deleted; only model references and the comments describing them were updated.
46+
47+
## Technical Specification
48+
49+
### Data Schemas / Types
50+
51+
N/A — no schema or type changes. All edits are string-literal or constant-reference swaps in example `main()` functions, plus corresponding comment updates.
52+
53+
### CLI Interface
54+
55+
README's `iris chat` invocation examples now use `gpt-5.6` in place of `gpt-4o` for the three flagship-model illustrations (basic chat, `--stream`, `--json`). The CLI itself is unchanged; these are documentation examples only.
56+
57+
### Go Package API
58+
59+
No exported Go API changed. Example programs now reference:
60+
- `xai.ModelGrok45` (`core.ModelID = "grok-4.5"`) instead of `xai.ModelGrok41FastNonReasoning` (in `xai-basic`). `xai-reasoning` keeps `xai.ModelGrok3Mini` (the model that exposes `reasoning_content`).
61+
- `zai.ModelGLM52` (`core.ModelID = "glm-5.2"`) instead of `zai.ModelGLM47Flash`.
62+
- `gemini.ModelGemini31FlashImagePreview` (`core.ModelID = "gemini-3.1-flash-image-preview"`) instead of `gemini.ModelGemini25FlashImage`.
63+
64+
All three constants were confirmed to already exist in the corresponding `providers/*/models.go` files before use; no constant names needed correcting.
65+
66+
### Configuration
67+
68+
N/A — no configuration fields changed.
69+
70+
## Usage Examples
71+
72+
### Example: xAI basic example now uses grok-4.5
73+
74+
```go
75+
// examples/chat/xai-basic/main.go (after this change)
76+
resp, err := client.Chat(xai.ModelGrok45).
77+
User("What are the three laws of robotics?").
78+
GetResponse(ctx)
79+
```
80+
81+
The reasoning example (`examples/chat/xai-reasoning/main.go`) is intentionally NOT bumped: it stays on `xai.ModelGrok3Mini` because that model exposes `reasoning_content` (surfaced via `resp.Reasoning`), which the example prints.
82+
83+
### Example: Gemini image generation now targets the 3.1 preview image model
84+
85+
```go
86+
// examples/image/gemini/main.go (after this change)
87+
resp, err := imageGen.GenerateImage(ctx, &core.ImageGenerateRequest{
88+
Model: gemini.ModelGemini31FlashImagePreview,
89+
Prompt: "A serene mountain landscape at sunset with a calm lake reflecting the colors of the sky",
90+
Size: core.ImageSize1024x1024,
91+
})
92+
```
93+
94+
## Integration Notes
95+
96+
- `providers/gemini/models.go` lists Gemini model series newest-first in file order and comments: "Gemini 3.6", "Gemini 3.5", "Gemini 3.1" (which includes `ModelGemini31FlashImagePreview`), then "Gemini 3" (which includes the older `ModelGemini3ProImage`, nicknamed "Nano Banana Pro" in its `DisplayName`). Despite the "Pro" naming suggesting more capability, `ModelGemini31FlashImagePreview` belongs to the newer 3.1 series and is therefore the constant this refresh selects — per the task's explicit tie-breaking rule ("prefer the newest image-generation constant that actually exists"), version series takes priority over tier name.
97+
- The mock-provider example's `"mock-model"` and `"any-model"` literals, and the Ollama (`llama3.2`, `qwen3`) and HuggingFace (`meta-llama/Llama-3.1-8B-Instruct`) example model strings, were deliberately left unchanged — these are either testing placeholders or represent locally-pulled/availability-varies models, not provider flagship references.
98+
- `examples/chat/responses-api/main.go` was left unchanged: it already uses `openai.ModelGPT56` (latest) for all Responses API calls, plus one intentional `openai.ModelGPT4o` call used specifically to contrast the Chat Completions code path against the Responses API path.
99+
- `examples/chat/xai-streaming/main.go` (already `xai.ModelGrok45`) and `examples/chat/zai-reasoning/main.go` (already `zai.ModelGLM52`) were already current and required no changes.
100+
- `examples/chat/xai-reasoning/main.go` was deliberately left on `xai.ModelGrok3Mini`: it is the model that returns `reasoning_content`, which the example demonstrates by printing `resp.Reasoning.Summary`. Bumping it to a newer model that does not expose the reasoning trace would defeat the example's purpose.
101+
- README's "Supported Models" / provider reference tables (OpenAI, Anthropic, xAI, Z.ai, Perplexity, Gemini, Ollama sections starting around line 850) were not touched — they were already catalog-current and are explicitly out of scope for this refresh.
102+
- README's Configuration section (`default_model: gpt-5.6 # or gpt-4o for older models`) was left as-is; it already shows the latest model and intentionally references `gpt-4o` as a contrasting "older model" example, not a generic flagship reference.
103+
104+
## Breaking Changes & Migration
105+
106+
N/A — example programs and documentation only; no public API, CLI, or configuration surface changed. Users who copy these examples will simply target newer provider models by default.
107+
108+
## Deferred / Out of Scope
109+
110+
- No production code changes (`core/`, `providers/*` implementation files) — only `providers/*/models.go` files were read to confirm constant names.
111+
- No changes to Ollama or HuggingFace example model strings, per explicit scope exclusion.
112+
- No changes to `examples/chat/responses-api/main.go`'s intentional `gpt-4o` comparison, or to any README "Supported Models" table.
113+
114+
## Testing Notes
115+
116+
- `go build ./examples/... ./...` — succeeds with no errors.
117+
- `go vet ./examples/...` — clean, no findings.
118+
- `gofmt -l examples/` — empty output (no formatting diffs).
119+
- Verified via `rg` that no unintended `"gpt-4o-mini"` or non-excluded `"gpt-4o"` literals remain in `examples/` or `README.md`, and that `xai.ModelGrok45`, `zai.ModelGLM52`, and `gemini.ModelGemini31FlashImagePreview` are valid, existing exported constants in their respective `providers/*/models.go` files.

examples/batch/basic/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func main() {
4747
{
4848
CustomID: "translate-1",
4949
Request: core.ChatRequest{
50-
Model: "gpt-4o-mini",
50+
Model: "gpt-5.4-mini",
5151
Messages: []core.Message{
5252
{Role: core.RoleSystem, Content: "You are a translator. Translate to French."},
5353
{Role: core.RoleUser, Content: "Hello, how are you?"},
@@ -57,7 +57,7 @@ func main() {
5757
{
5858
CustomID: "translate-2",
5959
Request: core.ChatRequest{
60-
Model: "gpt-4o-mini",
60+
Model: "gpt-5.4-mini",
6161
Messages: []core.Message{
6262
{Role: core.RoleSystem, Content: "You are a translator. Translate to Spanish."},
6363
{Role: core.RoleUser, Content: "Good morning!"},
@@ -67,7 +67,7 @@ func main() {
6767
{
6868
CustomID: "translate-3",
6969
Request: core.ChatRequest{
70-
Model: "gpt-4o-mini",
70+
Model: "gpt-5.4-mini",
7171
Messages: []core.Message{
7272
{Role: core.RoleSystem, Content: "You are a translator. Translate to German."},
7373
{Role: core.RoleUser, Content: "Thank you very much."},

examples/chat/basic/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func main() {
3838
defer cancel()
3939

4040
// Send chat request using fluent builder
41-
resp, err := client.Chat("gpt-4o-mini").
41+
resp, err := client.Chat("gpt-5.4-mini").
4242
User("What is the capital of France? Please respond in one sentence.").
4343
GetResponse(ctx)
4444

examples/chat/conversation-streaming/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func main() {
3030
client := core.NewClient(provider)
3131

3232
// Create a conversation with a system prompt
33-
conv := core.NewConversation(client, "gpt-4o-mini",
33+
conv := core.NewConversation(client, "gpt-5.4-mini",
3434
core.WithSystemMessage("You are a helpful programming tutor. Keep responses concise. Remember our conversation context."),
3535
)
3636

examples/chat/conversation/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func main() {
9393
// Create conversation with system prompt
9494
conv := NewConversation(
9595
client,
96-
"gpt-4o-mini",
96+
"gpt-5.4-mini",
9797
"You are a helpful programming tutor. Keep responses concise but informative. Remember the context of our conversation.",
9898
)
9999

examples/chat/streaming/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func main() {
3636
fmt.Println("---")
3737

3838
// Start streaming request
39-
stream, err := client.Chat("gpt-4o-mini").
39+
stream, err := client.Chat("gpt-5.4-mini").
4040
User("Write a short poem about programming in Go. Make it 4 lines.").
4141
Stream(ctx)
4242

examples/chat/structured-output/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func main() {
4242

4343
// Example 1: JSON mode - model outputs valid JSON
4444
fmt.Println("=== JSON Mode ===")
45-
resp, err := client.Chat("gpt-4o-mini").
45+
resp, err := client.Chat("gpt-5.4-mini").
4646
System("You are a helpful assistant that responds in JSON format.").
4747
User("List 3 programming languages with their name, year created, creator, and a brief description.").
4848
ResponseJSON().
@@ -101,7 +101,7 @@ func main() {
101101
}`),
102102
}
103103

104-
resp, err = client.Chat("gpt-4o-mini").
104+
resp, err = client.Chat("gpt-5.4-mini").
105105
User("Extract information: Sarah is a 28-year-old software engineer who enjoys hiking, reading, and playing chess.").
106106
ResponseJSONSchema(schema).
107107
GetResponse(ctx)

examples/chat/system-message/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func main() {
3434

3535
// Example 1: Technical assistant
3636
fmt.Println("=== Technical Assistant ===")
37-
resp, err := client.Chat("gpt-4o-mini").
37+
resp, err := client.Chat("gpt-5.4-mini").
3838
System("You are a technical assistant. Provide concise, accurate answers focused on programming and technology. Use code examples when helpful.").
3939
User("How do I read a file in Go?").
4040
GetResponse(ctx)
@@ -48,7 +48,7 @@ func main() {
4848

4949
// Example 2: Friendly tutor
5050
fmt.Println("=== Friendly Tutor ===")
51-
resp, err = client.Chat("gpt-4o-mini").
51+
resp, err = client.Chat("gpt-5.4-mini").
5252
System("You are a friendly programming tutor. Explain concepts simply, as if teaching a beginner. Use analogies and encouraging language.").
5353
User("How do I read a file in Go?").
5454
GetResponse(ctx)
@@ -62,7 +62,7 @@ func main() {
6262

6363
// Example 3: Pirate personality
6464
fmt.Println("=== Pirate Personality ===")
65-
resp, err = client.Chat("gpt-4o-mini").
65+
resp, err = client.Chat("gpt-5.4-mini").
6666
System("You are a pirate programmer. Answer questions about code but speak like a pirate. Use nautical terms and pirate expressions.").
6767
User("How do I read a file in Go?").
6868
Temperature(0.9). // Higher temperature for more creative responses

examples/chat/xai-basic/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ func main() {
3838
defer cancel()
3939

4040
// Send chat request using fluent builder
41-
// Using grok-4-1-fast-non-reasoning for quick responses
42-
resp, err := client.Chat(xai.ModelGrok41FastNonReasoning).
41+
// Using grok-4.5 for quick responses
42+
resp, err := client.Chat(xai.ModelGrok45).
4343
User("What is the capital of France? Please respond in one sentence.").
4444
GetResponse(ctx)
4545

0 commit comments

Comments
 (0)