omniai-anthropic 3.2.1 → 3.3.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f0469c5f51808a40bc72eda49724929edf0b49a054cfd10fc9839e3ccd4e1c81
|
|
4
|
+
data.tar.gz: 054ccc97df3cbec835ae5b7f0803d93ef4b6b1b99d16de1644c9be1b9de77390
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 81094ace78463a087cb559b2250fba53c2c72b40dac089fd62725686c6860737b81b63b231f3d414d2ae956c6e8bbb2210b307180ff273dbd523dd36faa0208a
|
|
7
|
+
data.tar.gz: 88c5fa34c9c997e5f623266c04901227e39f6375d15ecc9cb1bae657283a18422184255e691cd2ed201be45cce2e6068f6d18ad563f2f58cbce68957f650257d
|
|
@@ -5,6 +5,16 @@ module OmniAI
|
|
|
5
5
|
class Chat
|
|
6
6
|
# Overrides choice serialize / deserialize.
|
|
7
7
|
module ChoiceSerializer
|
|
8
|
+
# Maps Anthropic `stop_reason` values onto the normalized OmniAI::Chat::FinishReason symbols. `pause_turn`
|
|
9
|
+
# is intentionally absent (a continuation signal, neither a stop nor a filter) — it falls through to `:other`.
|
|
10
|
+
FINISH_REASONS = {
|
|
11
|
+
"end_turn" => OmniAI::Chat::FinishReason::STOP,
|
|
12
|
+
"stop_sequence" => OmniAI::Chat::FinishReason::STOP,
|
|
13
|
+
"max_tokens" => OmniAI::Chat::FinishReason::LENGTH,
|
|
14
|
+
"tool_use" => OmniAI::Chat::FinishReason::TOOL_CALL,
|
|
15
|
+
"refusal" => OmniAI::Chat::FinishReason::FILTER,
|
|
16
|
+
}.freeze
|
|
17
|
+
|
|
8
18
|
# @param choice [OmniAI::Chat::Choice]
|
|
9
19
|
# @param context [Context]
|
|
10
20
|
# @return [Hash]
|
|
@@ -17,7 +27,8 @@ module OmniAI
|
|
|
17
27
|
# @return [OmniAI::Chat::Choice]
|
|
18
28
|
def self.deserialize(data, context:)
|
|
19
29
|
message = OmniAI::Chat::Message.deserialize(data, context:)
|
|
20
|
-
OmniAI::Chat::
|
|
30
|
+
finish_reason = OmniAI::Chat::FinishReason.deserialize(data["stop_reason"], table: FINISH_REASONS)
|
|
31
|
+
OmniAI::Chat::Choice.new(message:, finish_reason:)
|
|
21
32
|
end
|
|
22
33
|
end
|
|
23
34
|
end
|
|
@@ -33,8 +33,7 @@ module OmniAI
|
|
|
33
33
|
ContentSerializer.deserialize(content, context:)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
tool_call_parts = parts.
|
|
37
|
-
non_tool_call_parts = parts.reject { |part| part.is_a?(OmniAI::Chat::ToolCall) }
|
|
36
|
+
tool_call_parts, non_tool_call_parts = parts.partition { |part| part.is_a?(OmniAI::Chat::ToolCall) }
|
|
38
37
|
|
|
39
38
|
tool_call_list = OmniAI::Chat::ToolCallList.new(entries: tool_call_parts) if tool_call_parts.any?
|
|
40
39
|
content = non_tool_call_parts if non_tool_call_parts.any?
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniai-anthropic
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kevin Sylvestre
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - "~>"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '3.
|
|
32
|
+
version: '3.7'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '3.
|
|
39
|
+
version: '3.7'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: openssl
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|