Class: Vellum::FunctionCallPromptBlock
- Inherits:
-
Object
- Object
- Vellum::FunctionCallPromptBlock
- Defined in:
- lib/vellum_ai/types/function_call_prompt_block.rb
Overview
A block that represents a function call in a prompt template.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #arguments ⇒ Hash{String => Object} readonly
- #block_type ⇒ String readonly
- #cache_config ⇒ Vellum::EphemeralPromptCacheConfig readonly
- #id ⇒ String readonly
- #name ⇒ String readonly
- #state ⇒ Vellum::PromptBlockState readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(block_type:, state: OMIT, cache_config: OMIT, id: OMIT, name:, arguments:, additional_properties: nil) ⇒ Vellum::FunctionCallPromptBlock constructor
- #to_json ⇒ String
Constructor Details
#initialize(block_type:, state: OMIT, cache_config: OMIT, id: OMIT, name:, arguments:, additional_properties: nil) ⇒ Vellum::FunctionCallPromptBlock
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vellum_ai/types/function_call_prompt_block.rb', line 38 def initialize(block_type:, state: OMIT, cache_config: OMIT, id: OMIT, name:, arguments:, additional_properties: nil) @block_type = block_type @state = state if state != OMIT @cache_config = cache_config if cache_config != OMIT @id = id if id != OMIT @name = name @arguments = arguments @additional_properties = additional_properties @_field_set = { "block_type": block_type, "state": state, "cache_config": cache_config, "id": id, "name": name, "arguments": arguments }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
23 24 25 |
# File 'lib/vellum_ai/types/function_call_prompt_block.rb', line 23 def additional_properties @additional_properties end |
#arguments ⇒ Hash{String => Object} (readonly)
21 22 23 |
# File 'lib/vellum_ai/types/function_call_prompt_block.rb', line 21 def arguments @arguments end |
#block_type ⇒ String (readonly)
11 12 13 |
# File 'lib/vellum_ai/types/function_call_prompt_block.rb', line 11 def block_type @block_type end |
#cache_config ⇒ Vellum::EphemeralPromptCacheConfig (readonly)
15 16 17 |
# File 'lib/vellum_ai/types/function_call_prompt_block.rb', line 15 def cache_config @cache_config end |
#id ⇒ String (readonly)
17 18 19 |
# File 'lib/vellum_ai/types/function_call_prompt_block.rb', line 17 def id @id end |
#name ⇒ String (readonly)
19 20 21 |
# File 'lib/vellum_ai/types/function_call_prompt_block.rb', line 19 def name @name end |
#state ⇒ Vellum::PromptBlockState (readonly)
13 14 15 |
# File 'lib/vellum_ai/types/function_call_prompt_block.rb', line 13 def state @state end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::FunctionCallPromptBlock
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/vellum_ai/types/function_call_prompt_block.rb', line 54 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) block_type = parsed_json["block_type"] state = parsed_json["state"] unless parsed_json["cache_config"].nil? cache_config = parsed_json["cache_config"].to_json cache_config = Vellum::EphemeralPromptCacheConfig.from_json(json_object: cache_config) else cache_config = nil end id = parsed_json["id"] name = parsed_json["name"] arguments = parsed_json["arguments"] new( block_type: block_type, state: state, cache_config: cache_config, id: id, name: name, arguments: arguments, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
90 91 92 93 94 95 96 97 |
# File 'lib/vellum_ai/types/function_call_prompt_block.rb', line 90 def self.validate_raw(obj:) obj.block_type.is_a?(String) != false || raise("Passed value for field obj.block_type is not the expected type, validation failed.") obj.state&.is_a?(Vellum::PromptBlockState) != false || raise("Passed value for field obj.state is not the expected type, validation failed.") obj.cache_config.nil? || Vellum::EphemeralPromptCacheConfig.validate_raw(obj: obj.cache_config) obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.") obj.arguments.is_a?(Hash) != false || raise("Passed value for field obj.arguments is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
81 82 83 |
# File 'lib/vellum_ai/types/function_call_prompt_block.rb', line 81 def to_json @_field_set&.to_json end |