baml 0.52.1-x86_64-linux → 0.53.0-x86_64-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c3a081bb36632beb995437ccdf5cfd9d32f201e2583ee6776b2c2a2a5a49e6d
4
- data.tar.gz: 35f10940f1b2984bfb610a8033faee4c00560cc31097b7474d674618a807300d
3
+ metadata.gz: 5405a78093a2852182e5abc20e15c4196db0c9a1d4e4800c599487bc4e25964b
4
+ data.tar.gz: 25f219e11f0679b726d00aaa3c611539bf8f26e5fc55f1758f7f855d3617af64
5
5
  SHA512:
6
- metadata.gz: 82112a2d9a571b988cc4635e3d5da0fe387a63e4df5d8bcb4d3283d0a31d5428ec42d44712d2a41aba0d1f909252bc144c9dcdfd540e15cfe80464fbef6c9eb0
7
- data.tar.gz: aafef129096cec585622bc626fcfbdf54413ec55f0273f8de877d705108ebbdf0203876ecfab9ef0cdfc10de7ef6ed7370f732a1ea669aef026ab5f8a246195d
6
+ metadata.gz: 8333bc15ecf4ad3433cfeadbb5645825a0cdd9580e20dc8dc2fed12519a388a30baec1b572efacee6b9ce19d95ed0c01e0e5e0c6853a26ce9f063b79f0dcc920
7
+ data.tar.gz: f476d28191542ec7b7c428e047dab92d5db4baa1dfee64fc2b9bfec60a54b59377c3650594ae4718b6d91384dbe75f064a290faca2a8446455bfc873def6a3ed
Binary file
Binary file
Binary file
data/lib/baml.rb CHANGED
@@ -4,11 +4,14 @@ begin
4
4
  rescue LoadError
5
5
  require_relative "baml/ruby_ffi"
6
6
  end
7
+ # require_relative "baml/ruby_ffi"
7
8
  require_relative "stream"
9
+ require_relative "struct"
8
10
 
9
11
  module Baml
10
- # TODO: implement image support
11
- class Image; end
12
+ ClientRegistry = Baml::Ffi::ClientRegistry
13
+ Image = Baml::Ffi::Image
14
+ Audio = Baml::Ffi::Audio
12
15
 
13
16
  # Dynamically + idempotently define Baml::TypeConverter
14
17
  # NB: this does not respect raise_coercion_error = false
data/lib/struct.rb ADDED
@@ -0,0 +1,66 @@
1
+ # This file should NOT be imported from baml.rb; we don't want
2
+ # to introduce a hard dependency on Sorbet for the baml gem.
3
+ require "ostruct"
4
+ #require "pp"
5
+
6
+ module Baml
7
+ module Sorbet
8
+ # Provides dynamic properties on statically defined classes
9
+ module Struct
10
+ # Needed to allow accessing dynamic types
11
+ def method_missing(symbol)
12
+ @props[symbol]
13
+ end
14
+
15
+ def eql?(other)
16
+ self.class == other.class &&
17
+ @props.eql?(other.instance_variable_get(:@args))
18
+ end
19
+
20
+ def hash
21
+ [self.class, @props].hash
22
+ end
23
+
24
+ def [](key)
25
+ key = key.to_sym if key.is_a?(String)
26
+ @props[key]
27
+ end
28
+
29
+ def inspect
30
+ PP.pp(self, +"", 79)
31
+ end
32
+
33
+ # https://docs.ruby-lang.org/en/master/PP.html
34
+ def pretty_print(pp)
35
+ pp.object_group(self) do
36
+ pp.breakable
37
+ @props.each do |key, value|
38
+ pp.text "#{key}="
39
+ pp.pp value
40
+ pp.comma_breakable unless key == @props.keys.last
41
+ end
42
+ end
43
+ end
44
+
45
+ # From the ostruct implementation
46
+ def to_h(&block)
47
+ if block
48
+ @props.map(&block).to_h
49
+ else
50
+ @props.dup
51
+ end
52
+ end
53
+
54
+ def to_json(*args)
55
+ @props.to_json(*args)
56
+ end
57
+ end
58
+ end
59
+
60
+ # Dynamically defined output classes are instantiated using this class
61
+ class DynamicStruct < OpenStruct
62
+ def to_json(*args)
63
+ @table.to_json(*args)
64
+ end
65
+ end
66
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.52.1
4
+ version: 0.53.0
5
5
  platform: x86_64-linux
6
6
  authors:
7
7
  - BoundaryML
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-24 00:00:00.000000000 Z
11
+ date: 2024-08-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A gem for users to interact with BoundaryML's Language Model clients
14
14
  (LLM) in Ruby.
@@ -25,6 +25,7 @@ files:
25
25
  - lib/baml/3.2/ruby_ffi.so
26
26
  - lib/baml/3.3/ruby_ffi.so
27
27
  - lib/stream.rb
28
+ - lib/struct.rb
28
29
  homepage: https://github.com/BoundaryML/baml
29
30
  licenses:
30
31
  - MIT