baml 0.1.3-arm64-darwin → 0.1.6-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/baml/2.7/ruby_ffi.bundle +0 -0
- data/lib/baml/3.0/ruby_ffi.bundle +0 -0
- data/lib/baml/3.1/ruby_ffi.bundle +0 -0
- data/lib/baml/3.2/ruby_ffi.bundle +0 -0
- data/lib/baml.rb +44 -1
- metadata +8 -4
- /data/lib/baml/{ruby_ffi.bundle → 3.3/ruby_ffi.bundle} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: def04f8e7bf733750d69b434a558f9d786fb84c1bb8813899acdb1ceee8ea7b6
|
4
|
+
data.tar.gz: 9c97ddb7f4387d40896072979008317dd859951ae222ed6f5719afb0f28137ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0ab8a1dfa01fb6d3a29e3e9e19ce88e24e10ded5b9db9597289a59578c9b77db9430b3a043f121dcc6acb3456ada36e7211075e2ecafac62507906130c53775
|
7
|
+
data.tar.gz: d6954b716b85423aded263c987d1525026a665b6b86124401c3cb4b9b59c8b6133c8036531b41db104367a5011f90e341b5f9e1258224f8f4e52fc9c316081ca
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/lib/baml.rb
CHANGED
@@ -1,6 +1,49 @@
|
|
1
1
|
begin
|
2
2
|
ruby_version = /(\d+\.\d+)/.match(RUBY_VERSION)
|
3
|
-
require_relative "
|
3
|
+
require_relative "baml/#{ruby_version}/ruby_ffi"
|
4
4
|
rescue LoadError
|
5
5
|
require_relative "baml/ruby_ffi"
|
6
|
+
end
|
7
|
+
|
8
|
+
module Baml
|
9
|
+
# Dynamically + idempotently define Baml::TypeConverter
|
10
|
+
# NB: this does not respect raise_coercion_error = false
|
11
|
+
def self.convert_to(type)
|
12
|
+
if !Baml.const_defined?(:TypeConverter)
|
13
|
+
Baml.const_set(:TypeConverter, Class.new(TypeCoerce::Converter) do
|
14
|
+
def initialize(type)
|
15
|
+
super(type)
|
16
|
+
end
|
17
|
+
|
18
|
+
def _convert(value, type, raise_coercion_error, coerce_empty_to_nil)
|
19
|
+
# make string handling more strict
|
20
|
+
if type == String
|
21
|
+
if value.is_a?(String)
|
22
|
+
return value
|
23
|
+
end
|
24
|
+
|
25
|
+
raise TypeCoerce::CoercionError.new(value, type)
|
26
|
+
end
|
27
|
+
|
28
|
+
# add unions
|
29
|
+
if type.is_a?(T::Types::Union)
|
30
|
+
type.types.each do |t|
|
31
|
+
# require raise_coercion_error on the recursive union call,
|
32
|
+
# so that we can suppress the error if it fails
|
33
|
+
converted = _convert(value, t, true, coerce_empty_to_nil)
|
34
|
+
return converted
|
35
|
+
rescue
|
36
|
+
# do nothing - try every instance of the union
|
37
|
+
end
|
38
|
+
|
39
|
+
raise TypeCoerce::CoercionError.new(value, type)
|
40
|
+
end
|
41
|
+
|
42
|
+
super(value, type, raise_coercion_error, coerce_empty_to_nil)
|
43
|
+
end
|
44
|
+
end)
|
45
|
+
end
|
46
|
+
|
47
|
+
Baml.const_get(:TypeConverter).new(type)
|
48
|
+
end
|
6
49
|
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.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: arm64-darwin
|
6
6
|
authors:
|
7
7
|
- BoundaryML
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-30 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.
|
@@ -19,7 +19,11 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- lib/baml.rb
|
22
|
-
- lib/baml/ruby_ffi.bundle
|
22
|
+
- lib/baml/2.7/ruby_ffi.bundle
|
23
|
+
- lib/baml/3.0/ruby_ffi.bundle
|
24
|
+
- lib/baml/3.1/ruby_ffi.bundle
|
25
|
+
- lib/baml/3.2/ruby_ffi.bundle
|
26
|
+
- lib/baml/3.3/ruby_ffi.bundle
|
23
27
|
homepage: https://github.com/BoundaryML/baml
|
24
28
|
licenses:
|
25
29
|
- MIT
|
@@ -32,7 +36,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
32
36
|
requirements:
|
33
37
|
- - ">="
|
34
38
|
- !ruby/object:Gem::Version
|
35
|
-
version: '
|
39
|
+
version: '2.7'
|
36
40
|
- - "<"
|
37
41
|
- !ruby/object:Gem::Version
|
38
42
|
version: 3.4.dev
|
File without changes
|