Class: Rager::Chat::Options
- Inherits:
-
T::Struct
- Object
- T::Struct
- Rager::Chat::Options
- Extended by:
- T::Sig
- Includes:
- Options
- Defined in:
- lib/rager/chat/options.rb
Instance Method Summary collapse
Instance Method Details
#serialize_safe ⇒ Object
28 29 30 31 32 33 |
# File 'lib/rager/chat/options.rb', line 28 def serialize_safe result = serialize result["api_key"] = "[REDACTED]" if result.key?("api_key") result["schema"] = Rager::Chat::Schema.dry_schema_to_json_schema(result["schema"]) if result.key?("schema") result end |
#validate ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/rager/chat/options.rb', line 36 def validate if stream && schema raise Rager::Errors::OptionsError.new( self, ["stream", "schema"], details: "You cannot use streaming with structured outputs" ) end if schema && schema_name.nil? raise Rager::Errors::OptionsError.new( self, ["schema", "schema_name"], details: "You must provide a schema name when using structured outputs" ) end end |