omniai 2.8.4 → 2.9.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 +4 -4
- data/lib/omniai/schema/format.rb +16 -0
- data/lib/omniai/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fa413fef0dde3e12d5adf76d46c2b070732ee717f96dc7860cc9134707244c6c
|
|
4
|
+
data.tar.gz: 9c86421d06542561150a6036b111c9aa1a3383c23a09d8b38838d10bb046f4a0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91a81d8663e6ef025c935a7227c91eab12974eb36a66af0c7833ecf9939dac3256f4f0b4c236416958b65ff8ec8f52bfc77aa4f7d3ee42a7c70281982037188e
|
|
7
|
+
data.tar.gz: 82caec300fd331fb0bd8cfefa3f13cadcac6f937bdc12cb9c2be0944c8263b717575989b8d9a05ca6c240da929a694cab320bb102dd2b4079449e01fa4b8b9b0
|
data/lib/omniai/schema/format.rb
CHANGED
|
@@ -70,6 +70,22 @@ module OmniAI
|
|
|
70
70
|
rescue JSON::ParserError => e
|
|
71
71
|
raise OmniAI::ParseError, "Unable to parse JSON text=#{text.inspect} message=#{e.message.inspect}."
|
|
72
72
|
end
|
|
73
|
+
|
|
74
|
+
# A helper used for LLMs that do not support passing in a schema using a dedicated argument.
|
|
75
|
+
#
|
|
76
|
+
# @example
|
|
77
|
+
# format.prompt #=> "Your response must match the following schema: ..."
|
|
78
|
+
#
|
|
79
|
+
# @return [String]
|
|
80
|
+
def prompt
|
|
81
|
+
<<~TEXT
|
|
82
|
+
Your must respond with ONLY valid JSON matching this exact schema:
|
|
83
|
+
|
|
84
|
+
#{JSON.generate(schema.serialize)}
|
|
85
|
+
|
|
86
|
+
Do not include any preamble, explanation, heredocs, etc. Return only the JSON.
|
|
87
|
+
TEXT
|
|
88
|
+
end
|
|
73
89
|
end
|
|
74
90
|
end
|
|
75
91
|
end
|
data/lib/omniai/version.rb
CHANGED