Class: OpenAI::Models::CustomToolInputFormat::Grammar

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/custom_tool_input_format.rb,
sig/openai/models/custom_tool_input_format.rbs

Defined Under Namespace

Modules: Syntax

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, fields, hash, #hash, inherited, #inspect, inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, coerce_cached, coerce_with_error, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, resolve_type, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(definition:, syntax:, type: :grammar) ⇒ Grammar

Returns a new instance of Grammar.

Parameters:

  • definition —

    The grammar definition.

  • syntax —

    The syntax of the grammar definition. One of lark or regex.

  • type (defaults to: :grammar) —

    Grammar format. Always grammar.

  • definition: (String)
  • syntax: (OpenAI::Models::CustomToolInputFormat::Grammar::syntax)
  • type: (:grammar) (defaults to: :grammar)


# File 'lib/openai/models/custom_tool_input_format.rb', line 50

Instance Attribute Details

#definition ⇒ String

The grammar definition.

Returns:

  • (String)


36
# File 'lib/openai/models/custom_tool_input_format.rb', line 36

required :definition, String

#syntax ⇒ OpenAI::Models::CustomToolInputFormat::Grammar::syntax

The syntax of the grammar definition. One of lark or regex.

Returns:

  • (OpenAI::Models::CustomToolInputFormat::Grammar::syntax)


42
# File 'lib/openai/models/custom_tool_input_format.rb', line 42

required :syntax, enum: -> { OpenAI::CustomToolInputFormat::Grammar::Syntax }

#type ⇒ :grammar

Grammar format. Always grammar.

Returns:

  • (:grammar)


48
# File 'lib/openai/models/custom_tool_input_format.rb', line 48

required :type, const: :grammar

Instance Method Details

#to_hash ⇒ { definition: String, syntax: OpenAI::Models::CustomToolInputFormat::Grammar::syntax, ?type: :grammar }

Returns:

  • ({ definition: String, syntax: OpenAI::Models::CustomToolInputFormat::Grammar::syntax, ?type: :grammar })


52
53
54
55
56
# File 'sig/openai/models/custom_tool_input_format.rbs', line 52

def to_hash: -> {
  definition: String,
  syntax: OpenAI::Models::CustomToolInputFormat::Grammar::syntax,
  ?type: :grammar
}