Class: Vellum::RegisteredPromptsClient
- Inherits:
-
Object
- Object
- Vellum::RegisteredPromptsClient
- Defined in:
- lib/vellum_ai/registered_prompts/client.rb
Instance Attribute Summary collapse
-
#request_client ⇒ Object
readonly
Returns the value of attribute request_client.
Instance Method Summary collapse
- #initialize(request_client:) ⇒ RegisteredPromptsClient constructor
-
#register_prompt(label:, name:, prompt:, model:, parameters:, provider: nil, meta: nil, request_options: nil) ⇒ RegisterPromptResponse
Registers a prompt within Vellum and creates associated Vellum entities.
Constructor Details
#initialize(request_client:) ⇒ RegisteredPromptsClient
16 17 18 19 |
# File 'lib/vellum_ai/registered_prompts/client.rb', line 16 def initialize(request_client:) # @type [RequestClient] @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Object (readonly)
Returns the value of attribute request_client.
12 13 14 |
# File 'lib/vellum_ai/registered_prompts/client.rb', line 12 def request_client @request_client end |
Instance Method Details
#register_prompt(label:, name:, prompt:, model:, parameters:, provider: nil, meta: nil, request_options: nil) ⇒ RegisterPromptResponse
Registers a prompt within Vellum and creates associated Vellum entities. Intended to be used by integration partners, not directly by Vellum users.
Under the hood, this endpoint creates a new sandbox, a new model version, and a new deployment.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/vellum_ai/registered_prompts/client.rb', line 61 def register_prompt(label:, name:, prompt:, model:, parameters:, provider: nil, meta: nil, request_options: nil) response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["X_API_KEY"] = .api_key unless &.api_key.nil? req.headers = { **req.headers, **(&.additional_headers || {}) }.compact req.body = { **(&.additional_body_parameters || {}), label: label, name: name, prompt: prompt, provider: provider, model: model, parameters: parameters, meta: }.compact req.url "#{@request_client.default_environment[:Default]}/v1/registered-prompts/register" end RegisterPromptResponse.from_json(json_object: response.body) end |