liter_llm 1.6.4-arm64-darwin → 1.7.1-arm64-darwin
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/lib/liter_llm/native.rb +137 -2
- data/lib/liter_llm/version.rb +2 -2
- data/lib/liter_llm.rb +1 -1
- data/lib/liter_llm_rb.bundle +0 -0
- data/sig/types.rbs +32 -6
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8a2b9ed8fc19c69fe2aacde9b8cab8432a3258a82e272da0ddc417074e837467
|
|
4
|
+
data.tar.gz: f2ec079bfcb60156446d84e8690b6a734526ada7702b15a8ad0c28f88749265c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 18bbc36d9f3e402a036331375a7c4d7a6164c1abc4321eb07a3e23fb7acc745883d181052b00b8acad60778d751aef68ee354c352fc166b8724b0421e961be66
|
|
7
|
+
data.tar.gz: 1decbb6f551484411487a3786eef9404a7817d581215d4be58f5faf5c7cfe8b1c662cab2033cb11531c032e642f9dd51637b6929308b9bcd4190e2deb68935ca
|
data/lib/liter_llm/native.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:fec9b44a56d9714b7b12931bb48e1e8f6d57ef2d0ccaad1f9ac6046ce01a89af
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
|
@@ -314,7 +314,142 @@ module LiterLlm
|
|
|
314
314
|
end
|
|
315
315
|
|
|
316
316
|
module LiterLlm
|
|
317
|
-
#
|
|
317
|
+
# One part of a structured assistant response.
|
|
318
|
+
#
|
|
319
|
+
# `#[serde(tag = "type", rename_all = "snake_case")]` matches OpenAI's
|
|
320
|
+
# parts-spec discriminator (`"type": "text"`, `"type": "output_image"`, …).
|
|
321
|
+
module AssistantPart
|
|
322
|
+
extend T::Helpers
|
|
323
|
+
extend T::Sig
|
|
324
|
+
|
|
325
|
+
interface!
|
|
326
|
+
|
|
327
|
+
# Dispatch from a Hash to the appropriate variant constructor.
|
|
328
|
+
# @param hash [Hash] with discriminator field and variant-specific fields
|
|
329
|
+
# @return [variant_class] an instance of the appropriate variant
|
|
330
|
+
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.untyped) }
|
|
331
|
+
def self.from_hash(hash)
|
|
332
|
+
discriminator = hash[:type] || hash["type"]
|
|
333
|
+
case discriminator
|
|
334
|
+
when "text" then AssistantPartText.from_hash(hash)
|
|
335
|
+
when "refusal" then AssistantPartRefusal.from_hash(hash)
|
|
336
|
+
when "output_image" then AssistantPartOutputImage.from_hash(hash)
|
|
337
|
+
when "output_audio" then AssistantPartOutputAudio.from_hash(hash)
|
|
338
|
+
else raise "Unknown discriminator: #{discriminator}"
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
end
|
|
342
|
+
## A text segment of the response.
|
|
343
|
+
AssistantPartText = Data.define(:text) do
|
|
344
|
+
include AssistantPart
|
|
345
|
+
extend T::Sig
|
|
346
|
+
|
|
347
|
+
# The text content of this part.
|
|
348
|
+
sig { returns(String) }
|
|
349
|
+
def text = super # rubocop:disable Lint/UselessMethodDefinition
|
|
350
|
+
sig { returns(T::Boolean) }
|
|
351
|
+
def text? = true
|
|
352
|
+
sig { returns(T::Boolean) }
|
|
353
|
+
def refusal? = false
|
|
354
|
+
sig { returns(T::Boolean) }
|
|
355
|
+
def output_image? = false
|
|
356
|
+
sig { returns(T::Boolean) }
|
|
357
|
+
def output_audio? = false
|
|
358
|
+
# @param hash [Hash] deserialized from the native extension
|
|
359
|
+
# @return [self]
|
|
360
|
+
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
361
|
+
def self.from_hash(hash)
|
|
362
|
+
new(text: hash[:text] || hash["text"])
|
|
363
|
+
end
|
|
364
|
+
end
|
|
365
|
+
## A refusal — the model declined to respond.
|
|
366
|
+
AssistantPartRefusal = Data.define(:refusal) do
|
|
367
|
+
include AssistantPart
|
|
368
|
+
extend T::Sig
|
|
369
|
+
|
|
370
|
+
# The refusal reason.
|
|
371
|
+
sig { returns(String) }
|
|
372
|
+
def refusal = super # rubocop:disable Lint/UselessMethodDefinition
|
|
373
|
+
sig { returns(T::Boolean) }
|
|
374
|
+
def text? = false
|
|
375
|
+
sig { returns(T::Boolean) }
|
|
376
|
+
def refusal? = true
|
|
377
|
+
sig { returns(T::Boolean) }
|
|
378
|
+
def output_image? = false
|
|
379
|
+
sig { returns(T::Boolean) }
|
|
380
|
+
def output_audio? = false
|
|
381
|
+
# @param hash [Hash] deserialized from the native extension
|
|
382
|
+
# @return [self]
|
|
383
|
+
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
384
|
+
def self.from_hash(hash)
|
|
385
|
+
new(refusal: hash[:refusal] || hash["refusal"])
|
|
386
|
+
end
|
|
387
|
+
end
|
|
388
|
+
## An image produced by the model (e.g. `gpt-image-1`, Gemini Imagen).
|
|
389
|
+
AssistantPartOutputImage = Data.define(:image_url) do
|
|
390
|
+
include AssistantPart
|
|
391
|
+
extend T::Sig
|
|
392
|
+
|
|
393
|
+
# Image URL or data URI referencing the generated image.
|
|
394
|
+
sig { returns(ImageUrl) }
|
|
395
|
+
def image_url = super # rubocop:disable Lint/UselessMethodDefinition
|
|
396
|
+
sig { returns(T::Boolean) }
|
|
397
|
+
def text? = false
|
|
398
|
+
sig { returns(T::Boolean) }
|
|
399
|
+
def refusal? = false
|
|
400
|
+
sig { returns(T::Boolean) }
|
|
401
|
+
def output_image? = true
|
|
402
|
+
sig { returns(T::Boolean) }
|
|
403
|
+
def output_audio? = false
|
|
404
|
+
# @param hash [Hash] deserialized from the native extension
|
|
405
|
+
# @return [self]
|
|
406
|
+
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
407
|
+
def self.from_hash(hash)
|
|
408
|
+
new(image_url: hash[:image_url] || hash["image_url"])
|
|
409
|
+
end
|
|
410
|
+
end
|
|
411
|
+
## Audio produced by the model (e.g. `gpt-4o-audio-preview`).
|
|
412
|
+
AssistantPartOutputAudio = Data.define(:audio) do
|
|
413
|
+
include AssistantPart
|
|
414
|
+
extend T::Sig
|
|
415
|
+
|
|
416
|
+
# Base64-encoded audio data and its format.
|
|
417
|
+
sig { returns(AudioContent) }
|
|
418
|
+
def audio = super # rubocop:disable Lint/UselessMethodDefinition
|
|
419
|
+
sig { returns(T::Boolean) }
|
|
420
|
+
def text? = false
|
|
421
|
+
sig { returns(T::Boolean) }
|
|
422
|
+
def refusal? = false
|
|
423
|
+
sig { returns(T::Boolean) }
|
|
424
|
+
def output_image? = false
|
|
425
|
+
sig { returns(T::Boolean) }
|
|
426
|
+
def output_audio? = true
|
|
427
|
+
# @param hash [Hash] deserialized from the native extension
|
|
428
|
+
# @return [self]
|
|
429
|
+
sig { params(hash: T::Hash[T.untyped, T.untyped]).returns(T.attached_class) }
|
|
430
|
+
def self.from_hash(hash)
|
|
431
|
+
new(audio: hash[:audio] || hash["audio"])
|
|
432
|
+
end
|
|
433
|
+
end
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
module LiterLlm
|
|
437
|
+
# Wire format for the chat completions `response_format` field.
|
|
438
|
+
#
|
|
439
|
+
# # Provider mapping
|
|
440
|
+
#
|
|
441
|
+
# - **OpenAI** (and OpenAI-compatible providers): emitted verbatim as
|
|
442
|
+
# `{"type": "json_schema", "json_schema": {...}}` per the
|
|
443
|
+
# chat-completions spec.
|
|
444
|
+
# - **Gemini / Vertex AI**: translated to
|
|
445
|
+
# `generationConfig.responseMimeType = "application/json"` and
|
|
446
|
+
# `generationConfig.responseSchema = <schema>`. The `name`,
|
|
447
|
+
# `description`, and `strict` fields are dropped — Gemini's
|
|
448
|
+
# structured-output API does not consume them.
|
|
449
|
+
# - **Anthropic**: no native JSON mode. A system instruction is
|
|
450
|
+
# prepended asking the model to respond with valid JSON.
|
|
451
|
+
# `strict` is advisory only; callers should still validate the
|
|
452
|
+
# returned JSON if the schema is load-bearing.
|
|
318
453
|
module ResponseFormat
|
|
319
454
|
extend T::Helpers
|
|
320
455
|
extend T::Sig
|
data/lib/liter_llm/version.rb
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:fec9b44a56d9714b7b12931bb48e1e8f6d57ef2d0ccaad1f9ac6046ce01a89af
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
|
6
6
|
|
|
7
7
|
module LiterLlm
|
|
8
8
|
## The version string for this package.
|
|
9
|
-
VERSION = "1.
|
|
9
|
+
VERSION = "1.7.1"
|
|
10
10
|
end
|
data/lib/liter_llm.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:fec9b44a56d9714b7b12931bb48e1e8f6d57ef2d0ccaad1f9ac6046ce01a89af
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
# frozen_string_literal: true
|
data/lib/liter_llm_rb.bundle
CHANGED
|
Binary file
|
data/sig/types.rbs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# This file is auto-generated by alef — DO NOT EDIT.
|
|
2
|
-
# alef:hash:
|
|
2
|
+
# alef:hash:fec9b44a56d9714b7b12931bb48e1e8f6d57ef2d0ccaad1f9ac6046ce01a89af
|
|
3
3
|
# To regenerate: alef generate
|
|
4
4
|
# To verify freshness: alef verify --exit-code
|
|
5
5
|
|
|
@@ -10,10 +10,10 @@ module LiterLlm
|
|
|
10
10
|
type json_value = Hash[String, untyped] | Array[untyped] | String | Integer | Float | bool | nil
|
|
11
11
|
|
|
12
12
|
class SystemMessage
|
|
13
|
-
attr_accessor content:
|
|
13
|
+
attr_accessor content: UserContent?
|
|
14
14
|
attr_accessor name: String?
|
|
15
15
|
|
|
16
|
-
def initialize: (?content:
|
|
16
|
+
def initialize: (?content: UserContent, ?name: String) -> void
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
class UserMessage
|
|
@@ -45,13 +45,17 @@ module LiterLlm
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
class AssistantMessage
|
|
48
|
-
attr_accessor content:
|
|
48
|
+
attr_accessor content: AssistantContent?
|
|
49
49
|
attr_accessor name: String?
|
|
50
50
|
attr_accessor tool_calls: Array[ToolCall]?
|
|
51
51
|
attr_accessor refusal: String?
|
|
52
52
|
attr_accessor function_call: FunctionCall?
|
|
53
53
|
|
|
54
|
-
def initialize: (?content:
|
|
54
|
+
def initialize: (?content: AssistantContent, ?name: String, ?tool_calls: Array[ToolCall], ?refusal: String, ?function_call: FunctionCall) -> void
|
|
55
|
+
def text: () -> String?
|
|
56
|
+
def refusal_text: () -> String?
|
|
57
|
+
def output_images: () -> Array[ImageUrl]
|
|
58
|
+
def output_audio: () -> Array[AudioContent]
|
|
55
59
|
end
|
|
56
60
|
|
|
57
61
|
class ToolMessage
|
|
@@ -165,9 +169,10 @@ module LiterLlm
|
|
|
165
169
|
attr_accessor stream_options: StreamOptions?
|
|
166
170
|
attr_accessor seed: Integer?
|
|
167
171
|
attr_accessor reasoning_effort: ReasoningEffort?
|
|
172
|
+
attr_accessor modalities: Array[Modality]?
|
|
168
173
|
attr_accessor extra_body: json_value?
|
|
169
174
|
|
|
170
|
-
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: json_value) -> void
|
|
175
|
+
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, ?modalities: Array[Modality], ?extra_body: json_value) -> void
|
|
171
176
|
end
|
|
172
177
|
|
|
173
178
|
class StreamOptions
|
|
@@ -299,6 +304,13 @@ module LiterLlm
|
|
|
299
304
|
def initialize: (?url: String, ?b64_json: String, ?revised_prompt: String) -> void
|
|
300
305
|
end
|
|
301
306
|
|
|
307
|
+
class DecodedDataUrl
|
|
308
|
+
attr_accessor mime: String?
|
|
309
|
+
attr_accessor data: String?
|
|
310
|
+
|
|
311
|
+
def initialize: (?mime: String, ?data: String) -> void
|
|
312
|
+
end
|
|
313
|
+
|
|
302
314
|
class CreateSpeechRequest
|
|
303
315
|
attr_accessor model: String?
|
|
304
316
|
attr_accessor input: String?
|
|
@@ -780,6 +792,12 @@ module LiterLlm
|
|
|
780
792
|
type value = :low | :high | :auto
|
|
781
793
|
end
|
|
782
794
|
|
|
795
|
+
class AssistantContent
|
|
796
|
+
end
|
|
797
|
+
|
|
798
|
+
class AssistantPart
|
|
799
|
+
end
|
|
800
|
+
|
|
783
801
|
class ToolType
|
|
784
802
|
type value = :function
|
|
785
803
|
end
|
|
@@ -797,6 +815,10 @@ module LiterLlm
|
|
|
797
815
|
class StopSequence
|
|
798
816
|
end
|
|
799
817
|
|
|
818
|
+
class Modality
|
|
819
|
+
type value = :text | :audio | :image
|
|
820
|
+
end
|
|
821
|
+
|
|
800
822
|
class FinishReason
|
|
801
823
|
type value = :stop | :length | :tool_calls | :content_filter | :function_call | :other
|
|
802
824
|
end
|
|
@@ -859,6 +881,10 @@ module LiterLlm
|
|
|
859
881
|
|
|
860
882
|
def self.create_client_from_json: (String json) -> DefaultClient
|
|
861
883
|
|
|
884
|
+
def self.encode_data_url: (String bytes, ?String mime) -> String
|
|
885
|
+
|
|
886
|
+
def self.decode_data_url: (String url) -> DecodedDataUrl?
|
|
887
|
+
|
|
862
888
|
def self.register_custom_provider: (CustomProviderConfig config) -> void
|
|
863
889
|
|
|
864
890
|
def self.unregister_custom_provider: (String name) -> bool
|
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.7.1
|
|
5
5
|
platform: arm64-darwin
|
|
6
6
|
authors:
|
|
7
7
|
- Na'aman Hirschfeld
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: sorbet-runtime
|