Class: Vellum::RegisterPromptResponse
- Inherits:
-
Object
- Object
- Vellum::RegisterPromptResponse
- Defined in:
- lib/vellum_ai/types/register_prompt_response.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#deployment ⇒ Object
readonly
Returns the value of attribute deployment.
-
#model_version ⇒ Object
readonly
Returns the value of attribute model_version.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
-
#prompt_version_id ⇒ Object
readonly
Returns the value of attribute prompt_version_id.
-
#sandbox ⇒ Object
readonly
Returns the value of attribute sandbox.
-
#sandbox_snapshot ⇒ Object
readonly
Returns the value of attribute sandbox_snapshot.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ RegisterPromptResponse
Deserialize a JSON object to an instance of RegisterPromptResponse.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(prompt:, sandbox_snapshot:, sandbox:, model_version:, prompt_version_id:, deployment:, additional_properties: nil) ⇒ RegisterPromptResponse constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of RegisterPromptResponse to a JSON object.
Constructor Details
#initialize(prompt:, sandbox_snapshot:, sandbox:, model_version:, prompt_version_id:, deployment:, additional_properties: nil) ⇒ RegisterPromptResponse
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vellum_ai/types/register_prompt_response.rb', line 23 def initialize(prompt:, sandbox_snapshot:, sandbox:, model_version:, prompt_version_id:, deployment:, additional_properties: nil) # @type [RegisterPromptPrompt] Information about the generated prompt @prompt = prompt # @type [RegisteredPromptSandboxSnapshot] Information about the generated sandbox snapshot @sandbox_snapshot = sandbox_snapshot # @type [RegisteredPromptSandbox] Information about the generated sandbox @sandbox = sandbox # @type [RegisteredPromptModelVersion] Information about the generated model version @model_version = model_version # @type [String] The ID of the generated prompt version @prompt_version_id = prompt_version_id # @type [RegisteredPromptDeployment] Information about the generated deployment @deployment = deployment # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
12 13 14 |
# File 'lib/vellum_ai/types/register_prompt_response.rb', line 12 def additional_properties @additional_properties end |
#deployment ⇒ Object (readonly)
Returns the value of attribute deployment.
12 13 14 |
# File 'lib/vellum_ai/types/register_prompt_response.rb', line 12 def deployment @deployment end |
#model_version ⇒ Object (readonly)
Returns the value of attribute model_version.
12 13 14 |
# File 'lib/vellum_ai/types/register_prompt_response.rb', line 12 def model_version @model_version end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
12 13 14 |
# File 'lib/vellum_ai/types/register_prompt_response.rb', line 12 def prompt @prompt end |
#prompt_version_id ⇒ Object (readonly)
Returns the value of attribute prompt_version_id.
12 13 14 |
# File 'lib/vellum_ai/types/register_prompt_response.rb', line 12 def prompt_version_id @prompt_version_id end |
#sandbox ⇒ Object (readonly)
Returns the value of attribute sandbox.
12 13 14 |
# File 'lib/vellum_ai/types/register_prompt_response.rb', line 12 def sandbox @sandbox end |
#sandbox_snapshot ⇒ Object (readonly)
Returns the value of attribute sandbox_snapshot.
12 13 14 |
# File 'lib/vellum_ai/types/register_prompt_response.rb', line 12 def sandbox_snapshot @sandbox_snapshot end |
Class Method Details
.from_json(json_object:) ⇒ RegisterPromptResponse
Deserialize a JSON object to an instance of RegisterPromptResponse
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/vellum_ai/types/register_prompt_response.rb', line 45 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["prompt"].nil? prompt = nil else prompt = parsed_json["prompt"].to_json prompt = RegisterPromptPrompt.from_json(json_object: prompt) end if parsed_json["sandbox_snapshot"].nil? sandbox_snapshot = nil else sandbox_snapshot = parsed_json["sandbox_snapshot"].to_json sandbox_snapshot = RegisteredPromptSandboxSnapshot.from_json(json_object: sandbox_snapshot) end if parsed_json["sandbox"].nil? sandbox = nil else sandbox = parsed_json["sandbox"].to_json sandbox = RegisteredPromptSandbox.from_json(json_object: sandbox) end if parsed_json["model_version"].nil? model_version = nil else model_version = parsed_json["model_version"].to_json model_version = RegisteredPromptModelVersion.from_json(json_object: model_version) end prompt_version_id = struct.prompt_version_id if parsed_json["deployment"].nil? deployment = nil else deployment = parsed_json["deployment"].to_json deployment = RegisteredPromptDeployment.from_json(json_object: deployment) end new(prompt: prompt, sandbox_snapshot: sandbox_snapshot, sandbox: sandbox, model_version: model_version, prompt_version_id: prompt_version_id, deployment: deployment, additional_properties: struct) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
101 102 103 104 105 106 107 108 |
# File 'lib/vellum_ai/types/register_prompt_response.rb', line 101 def self.validate_raw(obj:) RegisterPromptPrompt.validate_raw(obj: obj.prompt) RegisteredPromptSandboxSnapshot.validate_raw(obj: obj.sandbox_snapshot) RegisteredPromptSandbox.validate_raw(obj: obj.sandbox) RegisteredPromptModelVersion.validate_raw(obj: obj.model_version) obj.prompt_version_id.is_a?(String) != false || raise("Passed value for field obj.prompt_version_id is not the expected type, validation failed.") RegisteredPromptDeployment.validate_raw(obj: obj.deployment) end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of RegisterPromptResponse to a JSON object
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/vellum_ai/types/register_prompt_response.rb', line 86 def to_json(*_args) { "prompt": @prompt, "sandbox_snapshot": @sandbox_snapshot, "sandbox": @sandbox, "model_version": @model_version, "prompt_version_id": @prompt_version_id, "deployment": @deployment }.to_json end |