Class: OpenAI::Models::Beta::BetaCustomTool::Format::Grammar

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/beta/beta_custom_tool.rb,
sig/openai/models/beta/beta_custom_tool.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::Beta::BetaCustomTool::Format::Grammar::syntax)
  • type: (:grammar) (defaults to: :grammar)


# File 'lib/openai/models/beta/beta_custom_tool.rb', line 136

Instance Attribute Details

#definition ⇒ String

The grammar definition.

Returns:

  • (String)


122
# File 'lib/openai/models/beta/beta_custom_tool.rb', line 122

required :definition, String

#syntax ⇒ OpenAI::Models::Beta::BetaCustomTool::Format::Grammar::syntax

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

Returns:

  • (OpenAI::Models::Beta::BetaCustomTool::Format::Grammar::syntax)


128
# File 'lib/openai/models/beta/beta_custom_tool.rb', line 128

required :syntax, enum: -> { OpenAI::Beta::BetaCustomTool::Format::Grammar::Syntax }

#type ⇒ :grammar

Grammar format. Always grammar.

Returns:

  • (:grammar)


134
# File 'lib/openai/models/beta/beta_custom_tool.rb', line 134

required :type, const: :grammar

Instance Method Details

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

Returns:

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


150
151
152
153
154
# File 'sig/openai/models/beta/beta_custom_tool.rbs', line 150

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