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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 533dd085c62bb70b08d71d16025423b981d96cbffe7a1280072908f175800d28
4
- data.tar.gz: c40684be74123a132c11ecc70a620ee49d4b6e949daf08f91c8f5a360d0ea56f
3
+ metadata.gz: fa413fef0dde3e12d5adf76d46c2b070732ee717f96dc7860cc9134707244c6c
4
+ data.tar.gz: 9c86421d06542561150a6036b111c9aa1a3383c23a09d8b38838d10bb046f4a0
5
5
  SHA512:
6
- metadata.gz: 355abe067bdc6a6156300ea305b441a14388239506565a753f12dfc7824fe2d1a7acee4772fe8556fec5dbee2a9a3a9e25506ddb9faa7d78d3838bf647d17424
7
- data.tar.gz: 03d292f24d8345c4f4043f185b4c5e01ce09894afc7e9cd72e81f251cd9c394c8af2165f2c054bcb0cff60f50f75498efb90f4eb79e724e829b86561420819ff
6
+ metadata.gz: 91a81d8663e6ef025c935a7227c91eab12974eb36a66af0c7833ecf9939dac3256f4f0b4c236416958b65ff8ec8f52bfc77aa4f7d3ee42a7c70281982037188e
7
+ data.tar.gz: 82caec300fd331fb0bd8cfefa3f13cadcac6f937bdc12cb9c2be0944c8263b717575989b8d9a05ca6c240da929a694cab320bb102dd2b4079449e01fa4b8b9b0
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OmniAI
4
- VERSION = "2.8.4"
4
+ VERSION = "2.9.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniai
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.4
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Sylvestre