zuno 0.1.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +158 -0
- data/lib/zuno/version.rb +1 -1
- data/lib/zuno.rb +1415 -10
- metadata +30 -29
- data/lib/providers/openai.rb +0 -58
- data/lib/zuno/chat.rb +0 -39
- data/lib/zuno/configuration.rb +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d1dea919bc404d8bafb4e970ffd4d2d418d5ea38123bc78abc4668fc72ce985d
|
|
4
|
+
data.tar.gz: 4953724ce6061eb7641d7e4c5ee7564204d4647968822fd8d88303b481cf09c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 16d264d3143fca0a55bb4a2ed1ad4cc08e0f8dbbb6effdf8ed75c7425b5087fd1a8763135117bcc3b1ea8cf9061a579fa95b21e813b81d90c7de1076978d3a32
|
|
7
|
+
data.tar.gz: 8f19a868f736ec65ddf5484affe0a538a54690fc420c234afa7ead82f6943040441bce2336b334becb14fedad7babaaec03025854bf7e638ee31330f4eadddbb
|
data/README.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Zuno
|
|
2
|
+
|
|
3
|
+
Standalone Ruby SDK for:
|
|
4
|
+
|
|
5
|
+
- provider/model abstraction
|
|
6
|
+
- single-shot generation
|
|
7
|
+
- iterative tool loops
|
|
8
|
+
- streaming via SSE (OpenRouter)
|
|
9
|
+
|
|
10
|
+
## Install (local development)
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
bundle install
|
|
14
|
+
bundle exec rspec
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Breaking change: `generate` vs `loop`
|
|
18
|
+
|
|
19
|
+
- `Zuno.generate` is now single-shot.
|
|
20
|
+
- `Zuno.loop` contains the previous iterative tool-loop behavior.
|
|
21
|
+
|
|
22
|
+
If you previously relied on iterative tool calls in `generate`, move that code to `loop`.
|
|
23
|
+
|
|
24
|
+
## Providers
|
|
25
|
+
|
|
26
|
+
### OpenRouter
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
require "zuno"
|
|
30
|
+
|
|
31
|
+
openrouter = Zuno.openrouter(
|
|
32
|
+
api_key: "your-openrouter-key", # required
|
|
33
|
+
app_url: "https://example.com",
|
|
34
|
+
title: "my-app"
|
|
35
|
+
)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Replicate
|
|
39
|
+
|
|
40
|
+
```ruby
|
|
41
|
+
replicate = Zuno.replicate(api_key: "your-replicate-key") # required
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Single-shot generation (`generate`)
|
|
45
|
+
|
|
46
|
+
### OpenRouter
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
result = Zuno.generate(
|
|
50
|
+
model: openrouter.model("openai/gpt-5-mini"),
|
|
51
|
+
prompt: "Say hello"
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
puts result[:text]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`generate` supports tool definitions and executes returned tool calls once, without a follow-up LLM request.
|
|
58
|
+
|
|
59
|
+
### Replicate
|
|
60
|
+
|
|
61
|
+
`generate` with Replicate requires `input:` and waits for completion using:
|
|
62
|
+
|
|
63
|
+
- `Prefer: wait=60` on create
|
|
64
|
+
- polling every 1 second
|
|
65
|
+
- hard timeout at 10 minutes
|
|
66
|
+
|
|
67
|
+
```ruby
|
|
68
|
+
result = Zuno.generate(
|
|
69
|
+
model: replicate.model("owner/model"),
|
|
70
|
+
input: { prompt: "A watercolor fox" }
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
puts result[:status]
|
|
74
|
+
pp result[:output]
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Replicate reference types:
|
|
78
|
+
|
|
79
|
+
```ruby
|
|
80
|
+
replicate.version("version-id")
|
|
81
|
+
replicate.model("owner/model")
|
|
82
|
+
replicate.deployment("owner/deployment")
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Webhooks are not supported. Passing `webhook` or `webhook_events_filter` raises an error.
|
|
86
|
+
|
|
87
|
+
## Iterative tool execution (`loop`)
|
|
88
|
+
|
|
89
|
+
`loop` is OpenRouter-only and preserves the previous iterative behavior.
|
|
90
|
+
|
|
91
|
+
```ruby
|
|
92
|
+
ping = Zuno.tool(
|
|
93
|
+
name: "ping",
|
|
94
|
+
description: "Ping tool",
|
|
95
|
+
input_schema: { type: "object", properties: {} }
|
|
96
|
+
) { { ok: true } }
|
|
97
|
+
|
|
98
|
+
result = Zuno.loop(
|
|
99
|
+
model: openrouter.model("openai/gpt-5-mini"),
|
|
100
|
+
prompt: "Run tools until done",
|
|
101
|
+
tools: { ping: ping },
|
|
102
|
+
max_iterations: 24
|
|
103
|
+
)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`loop` supports:
|
|
107
|
+
|
|
108
|
+
- `before_generation`
|
|
109
|
+
- `after_generation`
|
|
110
|
+
- `before_iteration`
|
|
111
|
+
- `after_iteration`
|
|
112
|
+
- `before_tool_execution`
|
|
113
|
+
- `after_tool_execution`
|
|
114
|
+
- `max_iterations` (`Integer`, `:infinite`, or `Float::INFINITY`)
|
|
115
|
+
- `stop_when: { tool_called: ... }`
|
|
116
|
+
|
|
117
|
+
Callbacks can accept a second argument (`control`) and call `control.stop!(reason: "...")`.
|
|
118
|
+
|
|
119
|
+
## Tool choice
|
|
120
|
+
|
|
121
|
+
`generate` and `loop` support AI SDK-style tool choice when tools are present:
|
|
122
|
+
|
|
123
|
+
- `"auto"` (default)
|
|
124
|
+
- `"required"`
|
|
125
|
+
- `"none"`
|
|
126
|
+
- `{ type: "tool", toolName: "my_tool" }`
|
|
127
|
+
|
|
128
|
+
## Streaming (`stream`)
|
|
129
|
+
|
|
130
|
+
`stream` is OpenRouter-only.
|
|
131
|
+
|
|
132
|
+
```ruby
|
|
133
|
+
Zuno.stream(
|
|
134
|
+
model: openrouter.model("openai/gpt-5-mini"),
|
|
135
|
+
prompt: "Stream hello"
|
|
136
|
+
) do |event|
|
|
137
|
+
p event
|
|
138
|
+
end
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Automated releases
|
|
142
|
+
|
|
143
|
+
This repo includes `.github/workflows/release.yml` to automate versioning and gem publication:
|
|
144
|
+
|
|
145
|
+
- `release-please` inspects Conventional Commits on `main`, opens/updates a release PR, and bumps `lib/zuno/version.rb` when the release PR is merged.
|
|
146
|
+
- When a new GitHub release/tag is created, the workflow builds the gem and publishes it to RubyGems.
|
|
147
|
+
|
|
148
|
+
### One-time setup
|
|
149
|
+
|
|
150
|
+
Add this GitHub repository secret:
|
|
151
|
+
|
|
152
|
+
- `RUBYGEMS_API_KEY`
|
|
153
|
+
|
|
154
|
+
### Commit format for version bumping
|
|
155
|
+
|
|
156
|
+
- `fix: ...` -> patch
|
|
157
|
+
- `feat: ...` -> minor
|
|
158
|
+
- `feat!: ...` or any commit with `BREAKING CHANGE:` -> major
|
data/lib/zuno/version.rb
CHANGED