liter_llm 1.2.2-aarch64-linux → 1.4.0.pre.rc.4-aarch64-linux
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 +0 -19
- data/Steepfile +18 -0
- data/lib/liter_llm.rb +0 -5
- data/lib/liter_llm_rb.so +0 -0
- data/sig/types.rbs +720 -0
- metadata +8 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 175e6490c390912cb65e84619ff6e40110e444423d42fbe2c374d6679d24a2c8
|
|
4
|
+
data.tar.gz: bad432961179b86d32e85994d8180bc9908867eae5b629baa0dd69a57433f2db
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f7dfe491e66191c10ea7767f919b40c56cee7870baa44dc350ea7dcd71829c1e08e94f45e11a359b8b5025269ad6ddb0c3fee3bb37f0a2dbf34fa58eebb6e350
|
|
7
|
+
data.tar.gz: 03f4bcb5f3100238e4111173f9f1224925186c55300197dfb2a3cd1fe12967bdc9de015a1d405d6d0eca24fbb3338513ec6051029f90ea540cabc93537a1220b
|
data/README.md
CHANGED
|
@@ -51,24 +51,20 @@
|
|
|
51
51
|
</a>
|
|
52
52
|
</div>
|
|
53
53
|
|
|
54
|
-
|
|
55
54
|
<div align="center" style="margin: 20px 0;">
|
|
56
55
|
<picture>
|
|
57
56
|
<img width="100%" alt="kreuzberg.dev" src="https://github.com/user-attachments/assets/1b6c6ad7-3b6d-4171-b1c9-f2026cc9deb8" />
|
|
58
57
|
</picture>
|
|
59
58
|
</div>
|
|
60
59
|
|
|
61
|
-
|
|
62
60
|
<div align="center" style="margin-bottom: 20px;">
|
|
63
61
|
<a href="https://discord.gg/xt9WY3GnKR">
|
|
64
62
|
<img height="22" src="https://img.shields.io/badge/Discord-Join%20our%20community-7289da?logo=discord&logoColor=white" alt="Discord">
|
|
65
63
|
</a>
|
|
66
64
|
</div>
|
|
67
65
|
|
|
68
|
-
|
|
69
66
|
Universal LLM API client for Ruby. Access 143+ LLM providers through a single interface with idiomatic Ruby API and native performance.
|
|
70
67
|
|
|
71
|
-
|
|
72
68
|
## Installation
|
|
73
69
|
|
|
74
70
|
### Package Installation
|
|
@@ -77,7 +73,6 @@ Universal LLM API client for Ruby. Access 143+ LLM providers through a single in
|
|
|
77
73
|
Install via one of the supported package managers:
|
|
78
74
|
|
|
79
75
|
|
|
80
|
-
|
|
81
76
|
**gem:**
|
|
82
77
|
|
|
83
78
|
```bash
|
|
@@ -85,8 +80,6 @@ gem install liter_llm
|
|
|
85
80
|
```
|
|
86
81
|
|
|
87
82
|
|
|
88
|
-
|
|
89
|
-
|
|
90
83
|
**Bundler:**
|
|
91
84
|
|
|
92
85
|
```ruby
|
|
@@ -94,9 +87,6 @@ gem 'liter_llm'
|
|
|
94
87
|
```
|
|
95
88
|
|
|
96
89
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
90
|
### System Requirements
|
|
101
91
|
|
|
102
92
|
|
|
@@ -104,7 +94,6 @@ gem 'liter_llm'
|
|
|
104
94
|
- API keys via environment variables (e.g. `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`)
|
|
105
95
|
|
|
106
96
|
|
|
107
|
-
|
|
108
97
|
## Quick Start
|
|
109
98
|
|
|
110
99
|
### Basic Chat
|
|
@@ -127,7 +116,6 @@ response = JSON.parse(client.chat(JSON.generate(
|
|
|
127
116
|
puts response.dig("choices", 0, "message", "content")
|
|
128
117
|
```
|
|
129
118
|
|
|
130
|
-
|
|
131
119
|
### Common Use Cases
|
|
132
120
|
|
|
133
121
|
|
|
@@ -152,16 +140,12 @@ chunks.each { |chunk| puts chunk }
|
|
|
152
140
|
```
|
|
153
141
|
|
|
154
142
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
143
|
### Next Steps
|
|
159
144
|
|
|
160
145
|
- **[Provider Registry](https://github.com/kreuzberg-dev/liter-llm/blob/main/schemas/providers.json)** - Full list of supported providers
|
|
161
146
|
- **[GitHub Repository](https://github.com/kreuzberg-dev/liter-llm)** - Source, issues, and discussions
|
|
162
147
|
|
|
163
148
|
|
|
164
|
-
|
|
165
149
|
## Features
|
|
166
150
|
|
|
167
151
|
### Supported Providers (143+)
|
|
@@ -208,7 +192,6 @@ Built on a compiled Rust core for speed and safety:
|
|
|
208
192
|
- **API keys** wrapped in secure memory, zeroed on drop
|
|
209
193
|
|
|
210
194
|
|
|
211
|
-
|
|
212
195
|
## Provider Routing
|
|
213
196
|
|
|
214
197
|
Route to 143+ providers using the `provider/model` prefix convention:
|
|
@@ -223,7 +206,6 @@ mistral/mistral-large-latest
|
|
|
223
206
|
See the [provider registry](https://github.com/kreuzberg-dev/liter-llm/blob/main/schemas/providers.json) for the full list.
|
|
224
207
|
|
|
225
208
|
|
|
226
|
-
|
|
227
209
|
## Proxy Server
|
|
228
210
|
|
|
229
211
|
liter-llm also ships as an OpenAI-compatible proxy server with Docker support:
|
|
@@ -234,7 +216,6 @@ docker run -p 4000:4000 -e LITER_LLM_MASTER_KEY=sk-your-key ghcr.io/kreuzberg-de
|
|
|
234
216
|
|
|
235
217
|
See the [proxy server documentation](https://docs.liter-llm.kreuzberg.dev/server/proxy/) for configuration, CLI usage, and MCP integration.
|
|
236
218
|
|
|
237
|
-
|
|
238
219
|
## Documentation
|
|
239
220
|
|
|
240
221
|
- **[Documentation](https://docs.liter-llm.kreuzberg.dev)** -- Full docs and API reference
|
data/Steepfile
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Steep configuration for the LiterLlm Ruby package.
|
|
4
|
+
|
|
5
|
+
target :lib do
|
|
6
|
+
signature 'sig'
|
|
7
|
+
|
|
8
|
+
check 'lib'
|
|
9
|
+
|
|
10
|
+
# Standard library used by the wrapper layer.
|
|
11
|
+
library 'json'
|
|
12
|
+
|
|
13
|
+
# Strategic ignores:
|
|
14
|
+
|
|
15
|
+
# 1. Native extension entry point — methods are defined in Rust via Magnus
|
|
16
|
+
# and cannot be resolved by Steep's static analysis.
|
|
17
|
+
ignore 'lib/liter_llm_rb.rb' if File.exist?('lib/liter_llm_rb.rb')
|
|
18
|
+
end
|
data/lib/liter_llm.rb
CHANGED
data/lib/liter_llm_rb.so
CHANGED
|
Binary file
|
data/sig/types.rbs
ADDED
|
@@ -0,0 +1,720 @@
|
|
|
1
|
+
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
+
# alef:hash:ccc0d43561ced090b6ce99be75715bd31304ef12c1912115b4ae917bc9a6f157
|
|
3
|
+
# To regenerate: alef generate
|
|
4
|
+
# To verify freshness: alef verify --exit-code
|
|
5
|
+
# Issues & docs: https://github.com/kreuzberg-dev/alef
|
|
6
|
+
|
|
7
|
+
module Liter_llm
|
|
8
|
+
|
|
9
|
+
VERSION: String
|
|
10
|
+
|
|
11
|
+
class LiterLlmError
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class SystemMessage
|
|
15
|
+
attr_accessor content: String
|
|
16
|
+
attr_accessor name: String
|
|
17
|
+
|
|
18
|
+
def initialize: (content: String, ?name: String) -> void
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class UserMessage
|
|
22
|
+
attr_accessor content: UserContent
|
|
23
|
+
attr_accessor name: String
|
|
24
|
+
|
|
25
|
+
def initialize: (content: UserContent, ?name: String) -> void
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
class ImageUrl
|
|
29
|
+
attr_accessor url: String
|
|
30
|
+
attr_accessor detail: ImageDetail
|
|
31
|
+
|
|
32
|
+
def initialize: (url: String, ?detail: ImageDetail) -> void
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
class DocumentContent
|
|
36
|
+
attr_accessor data: String
|
|
37
|
+
attr_accessor media_type: String
|
|
38
|
+
|
|
39
|
+
def initialize: (data: String, media_type: String) -> void
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
class AudioContent
|
|
43
|
+
attr_accessor data: String
|
|
44
|
+
attr_accessor format: String
|
|
45
|
+
|
|
46
|
+
def initialize: (data: String, format: String) -> void
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class AssistantMessage
|
|
50
|
+
attr_accessor content: String
|
|
51
|
+
attr_accessor name: String
|
|
52
|
+
attr_accessor tool_calls: Array[ToolCall]
|
|
53
|
+
attr_accessor refusal: String
|
|
54
|
+
attr_accessor function_call: FunctionCall
|
|
55
|
+
|
|
56
|
+
def initialize: (?content: String, ?name: String, ?tool_calls: Array[ToolCall], ?refusal: String, ?function_call: FunctionCall) -> void
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
class ToolMessage
|
|
60
|
+
attr_accessor content: String
|
|
61
|
+
attr_accessor tool_call_id: String
|
|
62
|
+
attr_accessor name: String
|
|
63
|
+
|
|
64
|
+
def initialize: (content: String, tool_call_id: String, ?name: String) -> void
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
class DeveloperMessage
|
|
68
|
+
attr_accessor content: String
|
|
69
|
+
attr_accessor name: String
|
|
70
|
+
|
|
71
|
+
def initialize: (content: String, ?name: String) -> void
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
class FunctionMessage
|
|
75
|
+
# Deprecated legacy function-role message body.
|
|
76
|
+
|
|
77
|
+
attr_accessor content: String
|
|
78
|
+
attr_accessor name: String
|
|
79
|
+
|
|
80
|
+
def initialize: (content: String, name: String) -> void
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
class ChatCompletionTool
|
|
84
|
+
attr_reader tool_type: ToolType
|
|
85
|
+
attr_reader function: FunctionDefinition
|
|
86
|
+
|
|
87
|
+
def initialize: (tool_type: ToolType, function: FunctionDefinition) -> void
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
class FunctionDefinition
|
|
91
|
+
attr_reader name: String
|
|
92
|
+
attr_reader description: String
|
|
93
|
+
attr_reader parameters: untyped
|
|
94
|
+
attr_reader strict: bool
|
|
95
|
+
|
|
96
|
+
def initialize: (name: String, ?description: String, ?parameters: untyped, ?strict: bool) -> void
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
class ToolCall
|
|
100
|
+
attr_reader id: String
|
|
101
|
+
attr_reader call_type: ToolType
|
|
102
|
+
attr_reader function: FunctionCall
|
|
103
|
+
|
|
104
|
+
def initialize: (id: String, call_type: ToolType, function: FunctionCall) -> void
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
class FunctionCall
|
|
108
|
+
attr_reader name: String
|
|
109
|
+
attr_reader arguments: String
|
|
110
|
+
|
|
111
|
+
def initialize: (name: String, arguments: String) -> void
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
class SpecificToolChoice
|
|
115
|
+
attr_accessor choice_type: ToolType
|
|
116
|
+
attr_accessor function: SpecificFunction
|
|
117
|
+
|
|
118
|
+
def initialize: (choice_type: ToolType, function: SpecificFunction) -> void
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
class SpecificFunction
|
|
122
|
+
attr_accessor name: String
|
|
123
|
+
|
|
124
|
+
def initialize: (name: String) -> void
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
class JsonSchemaFormat
|
|
128
|
+
attr_accessor name: String
|
|
129
|
+
attr_accessor description: String
|
|
130
|
+
attr_accessor schema: untyped
|
|
131
|
+
attr_accessor strict: bool
|
|
132
|
+
|
|
133
|
+
def initialize: (name: String, ?description: String, schema: untyped, ?strict: bool) -> void
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
class Usage
|
|
137
|
+
attr_accessor prompt_tokens: Integer
|
|
138
|
+
attr_accessor completion_tokens: Integer
|
|
139
|
+
attr_accessor total_tokens: Integer
|
|
140
|
+
|
|
141
|
+
def initialize: (prompt_tokens: Integer, completion_tokens: Integer, total_tokens: Integer) -> void
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
class ChatCompletionRequest
|
|
145
|
+
attr_accessor model: String
|
|
146
|
+
attr_accessor messages: Array[Message]
|
|
147
|
+
attr_accessor temperature: Float
|
|
148
|
+
attr_accessor top_p: Float
|
|
149
|
+
attr_accessor n: Integer
|
|
150
|
+
attr_accessor stream: bool
|
|
151
|
+
attr_accessor stop: StopSequence
|
|
152
|
+
attr_accessor max_tokens: Integer
|
|
153
|
+
attr_accessor presence_penalty: Float
|
|
154
|
+
attr_accessor frequency_penalty: Float
|
|
155
|
+
attr_accessor logit_bias: Hash[String, Float]
|
|
156
|
+
attr_accessor user: String
|
|
157
|
+
attr_accessor tools: Array[ChatCompletionTool]
|
|
158
|
+
attr_accessor tool_choice: ToolChoice
|
|
159
|
+
attr_accessor parallel_tool_calls: bool
|
|
160
|
+
attr_accessor response_format: ResponseFormat
|
|
161
|
+
attr_accessor stream_options: StreamOptions
|
|
162
|
+
attr_accessor seed: Integer
|
|
163
|
+
attr_accessor reasoning_effort: ReasoningEffort
|
|
164
|
+
attr_accessor extra_body: untyped
|
|
165
|
+
|
|
166
|
+
def initialize: (model: String, messages: Array[Message], ?temperature: Float, ?top_p: Float, ?n: Integer, ?stream: bool, ?stop: StopSequence, ?max_tokens: Integer, ?presence_penalty: Float, ?frequency_penalty: Float, ?logit_bias: Hash[String, Float], ?user: String, ?tools: Array[ChatCompletionTool], ?tool_choice: ToolChoice, ?parallel_tool_calls: bool, ?response_format: ResponseFormat, ?stream_options: StreamOptions, ?seed: Integer, ?reasoning_effort: ReasoningEffort, ?extra_body: untyped) -> void
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
class StreamOptions
|
|
170
|
+
attr_accessor include_usage: bool
|
|
171
|
+
|
|
172
|
+
def initialize: (?include_usage: bool) -> void
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
class ChatCompletionResponse
|
|
176
|
+
attr_accessor id: String
|
|
177
|
+
attr_accessor object: String
|
|
178
|
+
attr_accessor created: Integer
|
|
179
|
+
attr_accessor model: String
|
|
180
|
+
attr_accessor choices: Array[Choice]
|
|
181
|
+
attr_accessor usage: Usage
|
|
182
|
+
attr_accessor system_fingerprint: String
|
|
183
|
+
attr_accessor service_tier: String
|
|
184
|
+
|
|
185
|
+
def initialize: (id: String, object: String, created: Integer, model: String, choices: Array[Choice], ?usage: Usage, ?system_fingerprint: String, ?service_tier: String) -> void
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
class Choice
|
|
189
|
+
attr_accessor index: Integer
|
|
190
|
+
attr_accessor message: AssistantMessage
|
|
191
|
+
attr_accessor finish_reason: FinishReason
|
|
192
|
+
|
|
193
|
+
def initialize: (index: Integer, message: AssistantMessage, ?finish_reason: FinishReason) -> void
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
class ChatCompletionChunk
|
|
197
|
+
attr_accessor id: String
|
|
198
|
+
attr_accessor object: String
|
|
199
|
+
attr_accessor created: Integer
|
|
200
|
+
attr_accessor model: String
|
|
201
|
+
attr_accessor choices: Array[StreamChoice]
|
|
202
|
+
attr_accessor usage: Usage
|
|
203
|
+
attr_accessor system_fingerprint: String
|
|
204
|
+
attr_accessor service_tier: String
|
|
205
|
+
|
|
206
|
+
def initialize: (id: String, object: String, created: Integer, model: String, choices: Array[StreamChoice], ?usage: Usage, ?system_fingerprint: String, ?service_tier: String) -> void
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
class StreamChoice
|
|
210
|
+
attr_accessor index: Integer
|
|
211
|
+
attr_accessor delta: StreamDelta
|
|
212
|
+
attr_accessor finish_reason: FinishReason
|
|
213
|
+
|
|
214
|
+
def initialize: (index: Integer, delta: StreamDelta, ?finish_reason: FinishReason) -> void
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
class StreamDelta
|
|
218
|
+
attr_accessor role: String
|
|
219
|
+
attr_accessor content: String
|
|
220
|
+
attr_accessor tool_calls: Array[StreamToolCall]
|
|
221
|
+
attr_accessor function_call: StreamFunctionCall
|
|
222
|
+
attr_accessor refusal: String
|
|
223
|
+
|
|
224
|
+
def initialize: (?role: String, ?content: String, ?tool_calls: Array[StreamToolCall], ?function_call: StreamFunctionCall, ?refusal: String) -> void
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
class StreamToolCall
|
|
228
|
+
attr_accessor index: Integer
|
|
229
|
+
attr_accessor id: String
|
|
230
|
+
attr_accessor call_type: ToolType
|
|
231
|
+
attr_accessor function: StreamFunctionCall
|
|
232
|
+
|
|
233
|
+
def initialize: (index: Integer, ?id: String, ?call_type: ToolType, ?function: StreamFunctionCall) -> void
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
class StreamFunctionCall
|
|
237
|
+
attr_accessor name: String
|
|
238
|
+
attr_accessor arguments: String
|
|
239
|
+
|
|
240
|
+
def initialize: (?name: String, ?arguments: String) -> void
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
class EmbeddingRequest
|
|
244
|
+
attr_reader model: String
|
|
245
|
+
attr_reader input: EmbeddingInput
|
|
246
|
+
attr_reader encoding_format: EmbeddingFormat
|
|
247
|
+
attr_reader dimensions: Integer
|
|
248
|
+
attr_reader user: String
|
|
249
|
+
|
|
250
|
+
def initialize: (model: String, input: EmbeddingInput, ?encoding_format: EmbeddingFormat, ?dimensions: Integer, ?user: String) -> void
|
|
251
|
+
end
|
|
252
|
+
|
|
253
|
+
class EmbeddingResponse
|
|
254
|
+
attr_reader object: String
|
|
255
|
+
attr_reader data: Array[EmbeddingObject]
|
|
256
|
+
attr_reader model: String
|
|
257
|
+
attr_reader usage: Usage
|
|
258
|
+
|
|
259
|
+
def initialize: (object: String, data: Array[EmbeddingObject], model: String, ?usage: Usage) -> void
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
class EmbeddingObject
|
|
263
|
+
attr_reader object: String
|
|
264
|
+
attr_reader embedding: Array[Float]
|
|
265
|
+
attr_reader index: Integer
|
|
266
|
+
|
|
267
|
+
def initialize: (object: String, embedding: Array[Float], index: Integer) -> void
|
|
268
|
+
end
|
|
269
|
+
|
|
270
|
+
class CreateImageRequest
|
|
271
|
+
# Request to create images from a text prompt.
|
|
272
|
+
|
|
273
|
+
attr_accessor prompt: String
|
|
274
|
+
attr_accessor model: String
|
|
275
|
+
attr_accessor n: Integer
|
|
276
|
+
attr_accessor size: String
|
|
277
|
+
attr_accessor quality: String
|
|
278
|
+
attr_accessor style: String
|
|
279
|
+
attr_accessor response_format: String
|
|
280
|
+
attr_accessor user: String
|
|
281
|
+
|
|
282
|
+
def initialize: (prompt: String, ?model: String, ?n: Integer, ?size: String, ?quality: String, ?style: String, ?response_format: String, ?user: String) -> void
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
class ImagesResponse
|
|
286
|
+
# Response containing generated images.
|
|
287
|
+
|
|
288
|
+
attr_accessor created: Integer
|
|
289
|
+
attr_accessor data: Array[Image]
|
|
290
|
+
|
|
291
|
+
def initialize: (created: Integer, data: Array[Image]) -> void
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
class Image
|
|
295
|
+
# A single generated image, returned as either a URL or base64 data.
|
|
296
|
+
|
|
297
|
+
attr_accessor url: String
|
|
298
|
+
attr_accessor b64_json: String
|
|
299
|
+
attr_accessor revised_prompt: String
|
|
300
|
+
|
|
301
|
+
def initialize: (?url: String, ?b64_json: String, ?revised_prompt: String) -> void
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
class CreateSpeechRequest
|
|
305
|
+
# Request to generate speech audio from text.
|
|
306
|
+
|
|
307
|
+
attr_accessor model: String
|
|
308
|
+
attr_accessor input: String
|
|
309
|
+
attr_accessor voice: String
|
|
310
|
+
attr_accessor response_format: String
|
|
311
|
+
attr_accessor speed: Float
|
|
312
|
+
|
|
313
|
+
def initialize: (model: String, input: String, voice: String, ?response_format: String, ?speed: Float) -> void
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
class CreateTranscriptionRequest
|
|
317
|
+
# Request to transcribe audio into text.
|
|
318
|
+
|
|
319
|
+
attr_accessor model: String
|
|
320
|
+
attr_accessor file: String
|
|
321
|
+
attr_accessor language: String
|
|
322
|
+
attr_accessor prompt: String
|
|
323
|
+
attr_accessor response_format: String
|
|
324
|
+
attr_accessor temperature: Float
|
|
325
|
+
|
|
326
|
+
def initialize: (model: String, file: String, ?language: String, ?prompt: String, ?response_format: String, ?temperature: Float) -> void
|
|
327
|
+
end
|
|
328
|
+
|
|
329
|
+
class TranscriptionResponse
|
|
330
|
+
# Response from a transcription request.
|
|
331
|
+
|
|
332
|
+
attr_accessor text: String
|
|
333
|
+
attr_accessor language: String
|
|
334
|
+
attr_accessor duration: Float
|
|
335
|
+
attr_accessor segments: Array[TranscriptionSegment]
|
|
336
|
+
|
|
337
|
+
def initialize: (text: String, ?language: String, ?duration: Float, ?segments: Array[TranscriptionSegment]) -> void
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
class TranscriptionSegment
|
|
341
|
+
# A segment of transcribed audio with timing information.
|
|
342
|
+
|
|
343
|
+
attr_accessor id: Integer
|
|
344
|
+
attr_accessor start: Float
|
|
345
|
+
attr_accessor end: Float
|
|
346
|
+
attr_accessor text: String
|
|
347
|
+
|
|
348
|
+
def initialize: (id: Integer, start: Float, end: Float, text: String) -> void
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
class ModerationRequest
|
|
352
|
+
# Request to classify content for policy violations.
|
|
353
|
+
|
|
354
|
+
attr_reader input: ModerationInput
|
|
355
|
+
attr_reader model: String
|
|
356
|
+
|
|
357
|
+
def initialize: (input: ModerationInput, ?model: String) -> void
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
class ModerationResponse
|
|
361
|
+
# Response from the moderation endpoint.
|
|
362
|
+
|
|
363
|
+
attr_reader id: String
|
|
364
|
+
attr_reader model: String
|
|
365
|
+
attr_reader results: Array[ModerationResult]
|
|
366
|
+
|
|
367
|
+
def initialize: (id: String, model: String, results: Array[ModerationResult]) -> void
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
class ModerationResult
|
|
371
|
+
# A single moderation classification result.
|
|
372
|
+
|
|
373
|
+
attr_reader flagged: bool
|
|
374
|
+
attr_reader categories: ModerationCategories
|
|
375
|
+
attr_reader category_scores: ModerationCategoryScores
|
|
376
|
+
|
|
377
|
+
def initialize: (flagged: bool, categories: ModerationCategories, category_scores: ModerationCategoryScores) -> void
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
class ModerationCategories
|
|
381
|
+
# Boolean flags for each moderation category.
|
|
382
|
+
|
|
383
|
+
attr_reader sexual: bool
|
|
384
|
+
attr_reader hate: bool
|
|
385
|
+
attr_reader harassment: bool
|
|
386
|
+
attr_reader self_harm: bool
|
|
387
|
+
attr_reader sexual_minors: bool
|
|
388
|
+
attr_reader hate_threatening: bool
|
|
389
|
+
attr_reader violence_graphic: bool
|
|
390
|
+
attr_reader self_harm_intent: bool
|
|
391
|
+
attr_reader self_harm_instructions: bool
|
|
392
|
+
attr_reader harassment_threatening: bool
|
|
393
|
+
attr_reader violence: bool
|
|
394
|
+
|
|
395
|
+
def initialize: (sexual: bool, hate: bool, harassment: bool, self_harm: bool, sexual_minors: bool, hate_threatening: bool, violence_graphic: bool, self_harm_intent: bool, self_harm_instructions: bool, harassment_threatening: bool, violence: bool) -> void
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
class ModerationCategoryScores
|
|
399
|
+
# Confidence scores for each moderation category.
|
|
400
|
+
|
|
401
|
+
attr_reader sexual: Float
|
|
402
|
+
attr_reader hate: Float
|
|
403
|
+
attr_reader harassment: Float
|
|
404
|
+
attr_reader self_harm: Float
|
|
405
|
+
attr_reader sexual_minors: Float
|
|
406
|
+
attr_reader hate_threatening: Float
|
|
407
|
+
attr_reader violence_graphic: Float
|
|
408
|
+
attr_reader self_harm_intent: Float
|
|
409
|
+
attr_reader self_harm_instructions: Float
|
|
410
|
+
attr_reader harassment_threatening: Float
|
|
411
|
+
attr_reader violence: Float
|
|
412
|
+
|
|
413
|
+
def initialize: (sexual: Float, hate: Float, harassment: Float, self_harm: Float, sexual_minors: Float, hate_threatening: Float, violence_graphic: Float, self_harm_intent: Float, self_harm_instructions: Float, harassment_threatening: Float, violence: Float) -> void
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
class RerankRequest
|
|
417
|
+
# Request to rerank documents by relevance to a query.
|
|
418
|
+
|
|
419
|
+
attr_reader model: String
|
|
420
|
+
attr_reader query: String
|
|
421
|
+
attr_reader documents: Array[RerankDocument]
|
|
422
|
+
attr_reader top_n: Integer
|
|
423
|
+
attr_reader return_documents: bool
|
|
424
|
+
|
|
425
|
+
def initialize: (model: String, query: String, documents: Array[RerankDocument], ?top_n: Integer, ?return_documents: bool) -> void
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
class RerankResponse
|
|
429
|
+
# Response from the rerank endpoint.
|
|
430
|
+
|
|
431
|
+
attr_reader id: String
|
|
432
|
+
attr_reader results: Array[RerankResult]
|
|
433
|
+
attr_reader meta: untyped
|
|
434
|
+
|
|
435
|
+
def initialize: (?id: String, results: Array[RerankResult], ?meta: untyped) -> void
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
class RerankResult
|
|
439
|
+
# A single reranked document with its relevance score.
|
|
440
|
+
|
|
441
|
+
attr_reader index: Integer
|
|
442
|
+
attr_reader relevance_score: Float
|
|
443
|
+
attr_reader document: RerankResultDocument
|
|
444
|
+
|
|
445
|
+
def initialize: (index: Integer, relevance_score: Float, ?document: RerankResultDocument) -> void
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
class RerankResultDocument
|
|
449
|
+
# The text content of a reranked document, returned when `return_documents` is true.
|
|
450
|
+
|
|
451
|
+
attr_reader text: String
|
|
452
|
+
|
|
453
|
+
def initialize: (text: String) -> void
|
|
454
|
+
end
|
|
455
|
+
|
|
456
|
+
class SearchRequest
|
|
457
|
+
# A search request.
|
|
458
|
+
|
|
459
|
+
attr_accessor model: String
|
|
460
|
+
attr_accessor query: String
|
|
461
|
+
attr_accessor max_results: Integer
|
|
462
|
+
attr_accessor search_domain_filter: Array[String]
|
|
463
|
+
attr_accessor country: String
|
|
464
|
+
|
|
465
|
+
def initialize: (model: String, query: String, ?max_results: Integer, ?search_domain_filter: Array[String], ?country: String) -> void
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
class SearchResponse
|
|
469
|
+
# A search response.
|
|
470
|
+
|
|
471
|
+
attr_reader results: Array[SearchResult]
|
|
472
|
+
attr_reader model: String
|
|
473
|
+
|
|
474
|
+
def initialize: (results: Array[SearchResult], model: String) -> void
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
class SearchResult
|
|
478
|
+
# An individual search result.
|
|
479
|
+
|
|
480
|
+
attr_reader title: String
|
|
481
|
+
attr_reader url: String
|
|
482
|
+
attr_reader snippet: String
|
|
483
|
+
attr_reader date: String
|
|
484
|
+
|
|
485
|
+
def initialize: (title: String, url: String, snippet: String, ?date: String) -> void
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
class OcrRequest
|
|
489
|
+
# An OCR request.
|
|
490
|
+
|
|
491
|
+
attr_reader model: String
|
|
492
|
+
attr_reader document: OcrDocument
|
|
493
|
+
attr_reader pages: Array[Integer]
|
|
494
|
+
attr_reader include_image_base64: bool
|
|
495
|
+
|
|
496
|
+
def initialize: (model: String, document: OcrDocument, ?pages: Array[Integer], ?include_image_base64: bool) -> void
|
|
497
|
+
end
|
|
498
|
+
|
|
499
|
+
class OcrResponse
|
|
500
|
+
# An OCR response.
|
|
501
|
+
|
|
502
|
+
attr_reader pages: Array[OcrPage]
|
|
503
|
+
attr_reader model: String
|
|
504
|
+
attr_reader usage: Usage
|
|
505
|
+
|
|
506
|
+
def initialize: (pages: Array[OcrPage], model: String, ?usage: Usage) -> void
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
class OcrPage
|
|
510
|
+
# A single page of OCR output.
|
|
511
|
+
|
|
512
|
+
attr_reader index: Integer
|
|
513
|
+
attr_reader markdown: String
|
|
514
|
+
attr_reader images: Array[OcrImage]
|
|
515
|
+
attr_reader dimensions: PageDimensions
|
|
516
|
+
|
|
517
|
+
def initialize: (index: Integer, markdown: String, ?images: Array[OcrImage], ?dimensions: PageDimensions) -> void
|
|
518
|
+
end
|
|
519
|
+
|
|
520
|
+
class OcrImage
|
|
521
|
+
# An image extracted from an OCR page.
|
|
522
|
+
|
|
523
|
+
attr_reader id: String
|
|
524
|
+
attr_reader image_base64: String
|
|
525
|
+
|
|
526
|
+
def initialize: (id: String, ?image_base64: String) -> void
|
|
527
|
+
end
|
|
528
|
+
|
|
529
|
+
class PageDimensions
|
|
530
|
+
# Page dimensions in pixels.
|
|
531
|
+
|
|
532
|
+
attr_reader width: Integer
|
|
533
|
+
attr_reader height: Integer
|
|
534
|
+
|
|
535
|
+
def initialize: (width: Integer, height: Integer) -> void
|
|
536
|
+
end
|
|
537
|
+
|
|
538
|
+
class ModelsListResponse
|
|
539
|
+
attr_accessor object: String
|
|
540
|
+
attr_accessor data: Array[ModelObject]
|
|
541
|
+
|
|
542
|
+
def initialize: (object: String, data: Array[ModelObject]) -> void
|
|
543
|
+
end
|
|
544
|
+
|
|
545
|
+
class ModelObject
|
|
546
|
+
attr_accessor id: String
|
|
547
|
+
attr_accessor object: String
|
|
548
|
+
attr_accessor created: Integer
|
|
549
|
+
attr_accessor owned_by: String
|
|
550
|
+
|
|
551
|
+
def initialize: (id: String, object: String, created: Integer, owned_by: String) -> void
|
|
552
|
+
end
|
|
553
|
+
|
|
554
|
+
class DefaultClient
|
|
555
|
+
# Default client implementation backed by `reqwest`.
|
|
556
|
+
#
|
|
557
|
+
# The provider is resolved at construction time from `model_hint` (or
|
|
558
|
+
# defaults to OpenAI). However, individual requests can override the
|
|
559
|
+
# provider when their model string contains a prefix that clearly
|
|
560
|
+
# identifies a different provider (e.g. `"anthropic/claude-3"` will
|
|
561
|
+
# route to Anthropic even if the client was built without a hint).
|
|
562
|
+
#
|
|
563
|
+
# When the model prefix does not match any known provider, the
|
|
564
|
+
# construction-time provider is used as the fallback.
|
|
565
|
+
#
|
|
566
|
+
# The provider is stored behind an [`Arc`] so it can be shared cheaply into
|
|
567
|
+
# async closures and streaming tasks that must be `'static`.
|
|
568
|
+
|
|
569
|
+
def chat: (ChatCompletionRequest req) -> ChatCompletionResponse
|
|
570
|
+
def chat_stream: (ChatCompletionRequest req) -> String
|
|
571
|
+
def embed: (EmbeddingRequest req) -> EmbeddingResponse
|
|
572
|
+
def list_models: () -> ModelsListResponse
|
|
573
|
+
def image_generate: (CreateImageRequest req) -> ImagesResponse
|
|
574
|
+
def transcribe: (CreateTranscriptionRequest req) -> TranscriptionResponse
|
|
575
|
+
def moderate: (ModerationRequest req) -> ModerationResponse
|
|
576
|
+
def rerank: (RerankRequest req) -> RerankResponse
|
|
577
|
+
def search: (SearchRequest req) -> SearchResponse
|
|
578
|
+
end
|
|
579
|
+
|
|
580
|
+
class CustomProviderConfig
|
|
581
|
+
# Configuration for registering a custom LLM provider at runtime.
|
|
582
|
+
|
|
583
|
+
attr_reader name: String
|
|
584
|
+
attr_reader base_url: String
|
|
585
|
+
attr_reader auth_header: AuthHeaderFormat
|
|
586
|
+
attr_reader model_prefixes: Array[String]
|
|
587
|
+
|
|
588
|
+
def initialize: (name: String, base_url: String, auth_header: AuthHeaderFormat, model_prefixes: Array[String]) -> void
|
|
589
|
+
end
|
|
590
|
+
|
|
591
|
+
class Message
|
|
592
|
+
# A chat message in a conversation.
|
|
593
|
+
|
|
594
|
+
System: Integer
|
|
595
|
+
User: Integer
|
|
596
|
+
Assistant: Integer
|
|
597
|
+
Tool: Integer
|
|
598
|
+
Developer: Integer
|
|
599
|
+
Function: Integer
|
|
600
|
+
end
|
|
601
|
+
|
|
602
|
+
class UserContent
|
|
603
|
+
Text: Integer
|
|
604
|
+
Parts: Integer
|
|
605
|
+
end
|
|
606
|
+
|
|
607
|
+
class ContentPart
|
|
608
|
+
Text: Integer
|
|
609
|
+
ImageUrl: Integer
|
|
610
|
+
Document: Integer
|
|
611
|
+
InputAudio: Integer
|
|
612
|
+
end
|
|
613
|
+
|
|
614
|
+
class ImageDetail
|
|
615
|
+
Low: Integer
|
|
616
|
+
High: Integer
|
|
617
|
+
Auto: Integer
|
|
618
|
+
end
|
|
619
|
+
|
|
620
|
+
class ToolType
|
|
621
|
+
# The type discriminator for tool/tool-call objects.
|
|
622
|
+
#
|
|
623
|
+
# Per the OpenAI spec this is always `"function"`. Using an enum enforces
|
|
624
|
+
# that constraint at the type level and rejects any other value on
|
|
625
|
+
# deserialization.
|
|
626
|
+
|
|
627
|
+
Function: Integer
|
|
628
|
+
end
|
|
629
|
+
|
|
630
|
+
class ToolChoice
|
|
631
|
+
Mode: Integer
|
|
632
|
+
Specific: Integer
|
|
633
|
+
end
|
|
634
|
+
|
|
635
|
+
class ToolChoiceMode
|
|
636
|
+
Auto: Integer
|
|
637
|
+
Required: Integer
|
|
638
|
+
None: Integer
|
|
639
|
+
end
|
|
640
|
+
|
|
641
|
+
class ResponseFormat
|
|
642
|
+
Text: Integer
|
|
643
|
+
JsonObject: Integer
|
|
644
|
+
JsonSchema: Integer
|
|
645
|
+
end
|
|
646
|
+
|
|
647
|
+
class StopSequence
|
|
648
|
+
Single: Integer
|
|
649
|
+
Multiple: Integer
|
|
650
|
+
end
|
|
651
|
+
|
|
652
|
+
class FinishReason
|
|
653
|
+
# Why a choice stopped generating tokens.
|
|
654
|
+
|
|
655
|
+
Stop: Integer
|
|
656
|
+
Length: Integer
|
|
657
|
+
ToolCalls: Integer
|
|
658
|
+
ContentFilter: Integer
|
|
659
|
+
FunctionCall: Integer
|
|
660
|
+
Other: Integer
|
|
661
|
+
end
|
|
662
|
+
|
|
663
|
+
class ReasoningEffort
|
|
664
|
+
# Controls how much reasoning effort the model should use.
|
|
665
|
+
|
|
666
|
+
Low: Integer
|
|
667
|
+
Medium: Integer
|
|
668
|
+
High: Integer
|
|
669
|
+
end
|
|
670
|
+
|
|
671
|
+
class EmbeddingFormat
|
|
672
|
+
# The format in which the embedding vectors are returned.
|
|
673
|
+
|
|
674
|
+
Float: Integer
|
|
675
|
+
Base64: Integer
|
|
676
|
+
end
|
|
677
|
+
|
|
678
|
+
class EmbeddingInput
|
|
679
|
+
Single: Integer
|
|
680
|
+
Multiple: Integer
|
|
681
|
+
end
|
|
682
|
+
|
|
683
|
+
class ModerationInput
|
|
684
|
+
# Input to the moderation endpoint — a single string or multiple strings.
|
|
685
|
+
|
|
686
|
+
Single: Integer
|
|
687
|
+
Multiple: Integer
|
|
688
|
+
end
|
|
689
|
+
|
|
690
|
+
class RerankDocument
|
|
691
|
+
# A document to be reranked — either a plain string or an object with a text field.
|
|
692
|
+
|
|
693
|
+
Text: Integer
|
|
694
|
+
Object: Integer
|
|
695
|
+
end
|
|
696
|
+
|
|
697
|
+
class OcrDocument
|
|
698
|
+
# Document input for OCR — either a URL or inline base64 data.
|
|
699
|
+
|
|
700
|
+
Url: Integer
|
|
701
|
+
Base64: Integer
|
|
702
|
+
end
|
|
703
|
+
|
|
704
|
+
class AuthHeaderFormat
|
|
705
|
+
# How the API key is sent in the HTTP request.
|
|
706
|
+
|
|
707
|
+
Bearer: Integer
|
|
708
|
+
ApiKey: Integer
|
|
709
|
+
None: Integer
|
|
710
|
+
end
|
|
711
|
+
|
|
712
|
+
def self.create_client: (String api_key, ?String base_url, ?Integer timeout_secs, ?Integer max_retries, ?String model_hint) -> DefaultClient
|
|
713
|
+
|
|
714
|
+
def self.create_client_from_json: (String json) -> DefaultClient
|
|
715
|
+
|
|
716
|
+
def self.register_custom_provider: (CustomProviderConfig config) -> void
|
|
717
|
+
|
|
718
|
+
def self.unregister_custom_provider: (String name) -> bool
|
|
719
|
+
|
|
720
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: liter_llm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0.pre.rc.4
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Na'aman Hirschfeld
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
75
|
+
version: '4.0'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
82
|
+
version: '4.0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: rubocop
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -128,14 +128,14 @@ dependencies:
|
|
|
128
128
|
requirements:
|
|
129
129
|
- - "~>"
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '
|
|
131
|
+
version: '2.0'
|
|
132
132
|
type: :development
|
|
133
133
|
prerelease: false
|
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
|
136
136
|
- - "~>"
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '
|
|
138
|
+
version: '2.0'
|
|
139
139
|
- !ruby/object:Gem::Dependency
|
|
140
140
|
name: yard
|
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -161,9 +161,11 @@ extensions: []
|
|
|
161
161
|
extra_rdoc_files: []
|
|
162
162
|
files:
|
|
163
163
|
- README.md
|
|
164
|
+
- Steepfile
|
|
164
165
|
- lib/liter_llm.rb
|
|
165
166
|
- lib/liter_llm_rb.so
|
|
166
167
|
- sig/liter_llm.rbs
|
|
168
|
+
- sig/types.rbs
|
|
167
169
|
homepage: https://kreuzberg.dev
|
|
168
170
|
licenses:
|
|
169
171
|
- MIT
|