ruby_conversations 1.1.26 → 1.1.28
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: 0c42d08c544fa112491d5de540359bb2db85c0ea0f94999305b8a6bd9a76e337
|
|
4
|
+
data.tar.gz: b3d7ca190f6d84da60754f07a67114d27d21d345bf1a6f606b8aa2ab999c69b9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 82b105029c7f3580c2f7feab4ec3412e3566c1a1b486e062b4be5368d5fd35e0dd93c67f4b8d46aa1a37e43172af38ee8ffcdabab3016d8b332fa41af31dcf35
|
|
7
|
+
data.tar.gz: be066e59065b7f75160ce17937a73bf77ba38436d0eeaf6bfeec18c9fd31409800b13468002a893b8c55f11519e1510166040af26a052dd3b1015293e1e2810c
|
|
@@ -18,14 +18,13 @@ module RubyConversations
|
|
|
18
18
|
def initialize(attributes = {})
|
|
19
19
|
setup_attributes(attributes)
|
|
20
20
|
configure_llm_credentials
|
|
21
|
-
configure_prompt_caching
|
|
22
21
|
end
|
|
23
22
|
|
|
24
23
|
def chat
|
|
25
|
-
@chat ||=
|
|
24
|
+
@chat ||= build_chat_with_caching
|
|
26
25
|
rescue RubyLLM::ModelNotFoundError
|
|
27
26
|
RubyLLM.models.refresh!
|
|
28
|
-
@chat ||=
|
|
27
|
+
@chat ||= build_chat_with_caching
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
def model_identifier
|
|
@@ -79,10 +78,16 @@ module RubyConversations
|
|
|
79
78
|
end
|
|
80
79
|
end
|
|
81
80
|
|
|
81
|
+
def build_chat_with_caching
|
|
82
|
+
chat_instance = build_chat
|
|
83
|
+
chat_instance.cache_prompts(system: true, tools: true, user: true)
|
|
84
|
+
chat_instance
|
|
85
|
+
end
|
|
86
|
+
|
|
82
87
|
def build_chat
|
|
83
88
|
chat_instance = RubyLLM.chat(model: llm, provider: provider).with_temperature(0.0)
|
|
84
89
|
headers = guardrail_headers
|
|
85
|
-
chat_instance.
|
|
90
|
+
chat_instance.instance_variable_set(:@headers, headers) if headers.any?
|
|
86
91
|
chat_instance
|
|
87
92
|
end
|
|
88
93
|
|
|
@@ -96,9 +101,5 @@ module RubyConversations
|
|
|
96
101
|
'X-Amzn-Bedrock-GuardrailVersion' => config.bedrock_guardrail_version || 'DRAFT'
|
|
97
102
|
}
|
|
98
103
|
end
|
|
99
|
-
|
|
100
|
-
def configure_prompt_caching
|
|
101
|
-
chat.cache_prompts(system: true, tools: true, user: true)
|
|
102
|
-
end
|
|
103
104
|
end
|
|
104
105
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_conversations
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.28
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Paul Shippy
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-04-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|