Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_url(request_options: nil, environment:)
end
# @return [Hash{String => String}]
def get_headers
headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '1.10.1' }
headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '0.3.3' }
headers["X-API-KEY"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
headers
end
Expand Down Expand Up @@ -107,7 +107,7 @@ def get_url(request_options: nil, environment:)
end
# @return [Hash{String => String}]
def get_headers
headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '1.10.1' }
headers = { "X-Fern-Language": 'Ruby', "X-Fern-SDK-Name": 'vellum_ai', "X-Fern-SDK-Version": '0.3.3' }
headers["X-API-KEY"] = ((@api_key.is_a? Method) ? @api_key.call : @api_key) unless @api_key.nil?
headers
end
Expand Down
12 changes: 6 additions & 6 deletions lib/vellum_ai.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def initialize(base_url: nil, environment: Vellum::Environment::PRODUCTION, max_
@workspaces = Vellum::WorkspacesClient.new(request_client: @request_client)
end
# @param url [String]
# @param method [Vellum::MethodEnum]
# @param method_ [Vellum::MethodEnum]
# @param body [String, Array<Object>, Hash{String => Object}]
# @param headers [Hash{String => Vellum::ExecuteApiRequestHeadersValue}]
# @param bearer_token [String, Vellum::VellumSecret]
Expand All @@ -159,7 +159,7 @@ def initialize(base_url: nil, environment: Vellum::Environment::PRODUCTION, max_
# api_key: "YOUR_API_KEY"
# )
# api.execute_api(url: "x")
def execute_api(url:, method: nil, body: nil, headers: nil, bearer_token: nil, request_options: nil)
def execute_api(url:, method_: nil, body: nil, headers: nil, bearer_token: nil, request_options: nil)
Comment on lines 159 to +162

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve execute_api keyword name

Vellum::Client#execute_api now takes a keyword method_ instead of the previously released method. Existing callers invoking execute_api(url: ..., method: "GET") will start raising ArgumentError: unknown keyword :method after upgrading. Unless you are planning a breaking major release, keep the method: keyword (or alias it) and map it internally to avoid breaking current integrations; the async version of this method has the same issue.

Useful? React with 👍 / 👎.

response = @request_client.conn.post do | req |
unless request_options&.timeout_in_seconds.nil?
req.options.timeout = request_options.timeout_in_seconds
Expand All @@ -176,7 +176,7 @@ def execute_api(url:, method: nil, body: nil, headers: nil, bearer_token: nil, r
unless request_options.nil? || request_options&.additional_query_parameters.nil?
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
end
req.body = { **(request_options&.additional_body_parameters || {}), url: url, method: method, body: body, headers: headers, bearer_token: bearer_token }.compact
req.body = { **(request_options&.additional_body_parameters || {}), url: url, method: method_, body: body, headers: headers, bearer_token: bearer_token }.compact
req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/execute-api"
end
Vellum::ExecuteApiResponse.from_json(json_object: response.body)
Expand Down Expand Up @@ -615,7 +615,7 @@ def initialize(base_url: nil, environment: Vellum::Environment::PRODUCTION, max_
@workspaces = Vellum::AsyncWorkspacesClient.new(request_client: @async_request_client)
end
# @param url [String]
# @param method [Vellum::MethodEnum]
# @param method_ [Vellum::MethodEnum]
# @param body [String, Array<Object>, Hash{String => Object}]
# @param headers [Hash{String => Vellum::ExecuteApiRequestHeadersValue}]
# @param bearer_token [String, Vellum::VellumSecret]
Expand All @@ -628,7 +628,7 @@ def initialize(base_url: nil, environment: Vellum::Environment::PRODUCTION, max_
# api_key: "YOUR_API_KEY"
# )
# api.execute_api(url: "x")
def execute_api(url:, method: nil, body: nil, headers: nil, bearer_token: nil, request_options: nil)
def execute_api(url:, method_: nil, body: nil, headers: nil, bearer_token: nil, request_options: nil)
response = @async_request_client.conn.post do | req |
unless request_options&.timeout_in_seconds.nil?
req.options.timeout = request_options.timeout_in_seconds
Expand All @@ -645,7 +645,7 @@ def execute_api(url:, method: nil, body: nil, headers: nil, bearer_token: nil, r
unless request_options.nil? || request_options&.additional_query_parameters.nil?
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
end
req.body = { **(request_options&.additional_body_parameters || {}), url: url, method: method, body: body, headers: headers, bearer_token: bearer_token }.compact
req.body = { **(request_options&.additional_body_parameters || {}), url: url, method: method_, body: body, headers: headers, bearer_token: bearer_token }.compact
req.url "#{@async_request_client.get_url(environment: Default, request_options: request_options)}/v1/execute-api"
end
Vellum::ExecuteApiResponse.from_json(json_object: response.body)
Expand Down
16 changes: 8 additions & 8 deletions lib/vellum_ai/deployments/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ def retrieve(id:, request_options: nil)
# Please use the
# `retrieve_prompt_deployment_release` xendpoint instead.
#
# @param id [String] Either the Prompt Deployment's ID or its unique name
# @param history_id_or_release_tag [String] Either the UUID of Deployment History Item you'd like to retrieve, or the name
# of a Release Tag that's pointing to the Deployment History Item you'd like to
# retrieve.
# @param id [String] Either the Prompt Deployment's ID or its unique name
# @param request_options [Vellum::RequestOptions]
# @return [Vellum::DeploymentHistoryItem]
# @example
Expand All @@ -121,8 +121,8 @@ def retrieve(id:, request_options: nil)
# environment: Vellum::Environment::PRODUCTION,
# api_key: "YOUR_API_KEY"
# )
# api.deployments.deployment_history_item_retrieve(history_id_or_release_tag: "history_id_or_release_tag", id: "id")
def deployment_history_item_retrieve(history_id_or_release_tag:, id:, request_options: nil)
# api.deployments.deployment_history_item_retrieve(id: "id", history_id_or_release_tag: "history_id_or_release_tag")
def deployment_history_item_retrieve(id:, history_id_or_release_tag:, request_options: nil)
response = @request_client.conn.get do | req |
unless request_options&.timeout_in_seconds.nil?
req.options.timeout = request_options.timeout_in_seconds
Expand All @@ -142,7 +142,7 @@ def deployment_history_item_retrieve(history_id_or_release_tag:, id:, request_op
unless request_options.nil? || request_options&.additional_body_parameters.nil?
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
end
req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/deployments/#{history_id_or_release_tag}/history/#{id}"
req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/deployments/#{id}/history/#{history_id_or_release_tag}"
end
Vellum::DeploymentHistoryItem.from_json(json_object: response.body)
end
Expand Down Expand Up @@ -449,10 +449,10 @@ def retrieve(id:, request_options: nil)
# Please use the
# `retrieve_prompt_deployment_release` xendpoint instead.
#
# @param id [String] Either the Prompt Deployment's ID or its unique name
# @param history_id_or_release_tag [String] Either the UUID of Deployment History Item you'd like to retrieve, or the name
# of a Release Tag that's pointing to the Deployment History Item you'd like to
# retrieve.
# @param id [String] Either the Prompt Deployment's ID or its unique name
# @param request_options [Vellum::RequestOptions]
# @return [Vellum::DeploymentHistoryItem]
# @example
Expand All @@ -461,8 +461,8 @@ def retrieve(id:, request_options: nil)
# environment: Vellum::Environment::PRODUCTION,
# api_key: "YOUR_API_KEY"
# )
# api.deployments.deployment_history_item_retrieve(history_id_or_release_tag: "history_id_or_release_tag", id: "id")
def deployment_history_item_retrieve(history_id_or_release_tag:, id:, request_options: nil)
# api.deployments.deployment_history_item_retrieve(id: "id", history_id_or_release_tag: "history_id_or_release_tag")
def deployment_history_item_retrieve(id:, history_id_or_release_tag:, request_options: nil)
Async do
response = @request_client.conn.get do | req |
unless request_options&.timeout_in_seconds.nil?
Expand All @@ -483,7 +483,7 @@ def deployment_history_item_retrieve(history_id_or_release_tag:, id:, request_op
unless request_options.nil? || request_options&.additional_body_parameters.nil?
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
end
req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/deployments/#{history_id_or_release_tag}/history/#{id}"
req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/deployments/#{id}/history/#{history_id_or_release_tag}"
end
Vellum::DeploymentHistoryItem.from_json(json_object: response.body)
end
Expand Down
40 changes: 20 additions & 20 deletions lib/vellum_ai/document_indexes/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ def partial_update(id:, label: nil, status: nil, request_options: nil)
end
# Adds a previously uploaded Document to the specified Document Index.
#
# @param document_id [String] Either the Vellum-generated ID or the originally supplied external_id that
# uniquely identifies the Document you'd like to add.
# @param id [String] Either the Vellum-generated ID or the originally specified name that uniquely
# identifies the Document Index to which you'd like to add the Document.
# @param document_id [String] Either the Vellum-generated ID or the originally supplied external_id that
# uniquely identifies the Document you'd like to add.
# @param request_options [Vellum::RequestOptions]
# @return [Void]
# @example
Expand All @@ -274,8 +274,8 @@ def partial_update(id:, label: nil, status: nil, request_options: nil)
# environment: Vellum::Environment::PRODUCTION,
# api_key: "YOUR_API_KEY"
# )
# api.document_indexes.add_document(document_id: "document_id", id: "id")
def add_document(document_id:, id:, request_options: nil)
# api.document_indexes.add_document(id: "id", document_id: "document_id")
def add_document(id:, document_id:, request_options: nil)
response = @request_client.conn.post do | req |
unless request_options&.timeout_in_seconds.nil?
req.options.timeout = request_options.timeout_in_seconds
Expand All @@ -295,15 +295,15 @@ def add_document(document_id:, id:, request_options: nil)
unless request_options.nil? || request_options&.additional_body_parameters.nil?
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
end
req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/document-indexes/#{document_id}/documents/#{id}"
req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/document-indexes/#{id}/documents/#{document_id}"
end
end
# Removes a Document from a Document Index without deleting the Document itself.
#
# @param document_id [String] Either the Vellum-generated ID or the originally supplied external_id that
# uniquely identifies the Document you'd like to remove.
# @param id [String] Either the Vellum-generated ID or the originally specified name that uniquely
# identifies the Document Index from which you'd like to remove a Document.
# @param document_id [String] Either the Vellum-generated ID or the originally supplied external_id that
# uniquely identifies the Document you'd like to remove.
# @param request_options [Vellum::RequestOptions]
# @return [Void]
# @example
Expand All @@ -312,8 +312,8 @@ def add_document(document_id:, id:, request_options: nil)
# environment: Vellum::Environment::PRODUCTION,
# api_key: "YOUR_API_KEY"
# )
# api.document_indexes.remove_document(document_id: "document_id", id: "id")
def remove_document(document_id:, id:, request_options: nil)
# api.document_indexes.remove_document(id: "id", document_id: "document_id")
def remove_document(id:, document_id:, request_options: nil)
response = @request_client.conn.delete do | req |
unless request_options&.timeout_in_seconds.nil?
req.options.timeout = request_options.timeout_in_seconds
Expand All @@ -333,7 +333,7 @@ def remove_document(document_id:, id:, request_options: nil)
unless request_options.nil? || request_options&.additional_body_parameters.nil?
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
end
req.url "#{@request_client.get_url(environment: Documents, request_options: request_options)}/v1/document-indexes/#{document_id}/documents/#{id}"
req.url "#{@request_client.get_url(environment: Documents, request_options: request_options)}/v1/document-indexes/#{id}/documents/#{document_id}"
end
end
end
Expand Down Expand Up @@ -595,10 +595,10 @@ def partial_update(id:, label: nil, status: nil, request_options: nil)
end
# Adds a previously uploaded Document to the specified Document Index.
#
# @param document_id [String] Either the Vellum-generated ID or the originally supplied external_id that
# uniquely identifies the Document you'd like to add.
# @param id [String] Either the Vellum-generated ID or the originally specified name that uniquely
# identifies the Document Index to which you'd like to add the Document.
# @param document_id [String] Either the Vellum-generated ID or the originally supplied external_id that
# uniquely identifies the Document you'd like to add.
# @param request_options [Vellum::RequestOptions]
# @return [Void]
# @example
Expand All @@ -607,8 +607,8 @@ def partial_update(id:, label: nil, status: nil, request_options: nil)
# environment: Vellum::Environment::PRODUCTION,
# api_key: "YOUR_API_KEY"
# )
# api.document_indexes.add_document(document_id: "document_id", id: "id")
def add_document(document_id:, id:, request_options: nil)
# api.document_indexes.add_document(id: "id", document_id: "document_id")
def add_document(id:, document_id:, request_options: nil)
Async do
response = @request_client.conn.post do | req |
unless request_options&.timeout_in_seconds.nil?
Expand All @@ -629,16 +629,16 @@ def add_document(document_id:, id:, request_options: nil)
unless request_options.nil? || request_options&.additional_body_parameters.nil?
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
end
req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/document-indexes/#{document_id}/documents/#{id}"
req.url "#{@request_client.get_url(environment: Default, request_options: request_options)}/v1/document-indexes/#{id}/documents/#{document_id}"
end
end
end
# Removes a Document from a Document Index without deleting the Document itself.
#
# @param document_id [String] Either the Vellum-generated ID or the originally supplied external_id that
# uniquely identifies the Document you'd like to remove.
# @param id [String] Either the Vellum-generated ID or the originally specified name that uniquely
# identifies the Document Index from which you'd like to remove a Document.
# @param document_id [String] Either the Vellum-generated ID or the originally supplied external_id that
# uniquely identifies the Document you'd like to remove.
# @param request_options [Vellum::RequestOptions]
# @return [Void]
# @example
Expand All @@ -647,8 +647,8 @@ def add_document(document_id:, id:, request_options: nil)
# environment: Vellum::Environment::PRODUCTION,
# api_key: "YOUR_API_KEY"
# )
# api.document_indexes.remove_document(document_id: "document_id", id: "id")
def remove_document(document_id:, id:, request_options: nil)
# api.document_indexes.remove_document(id: "id", document_id: "document_id")
def remove_document(id:, document_id:, request_options: nil)
Async do
response = @request_client.conn.delete do | req |
unless request_options&.timeout_in_seconds.nil?
Expand All @@ -669,7 +669,7 @@ def remove_document(document_id:, id:, request_options: nil)
unless request_options.nil? || request_options&.additional_body_parameters.nil?
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
end
req.url "#{@request_client.get_url(environment: Documents, request_options: request_options)}/v1/document-indexes/#{document_id}/documents/#{id}"
req.url "#{@request_client.get_url(environment: Documents, request_options: request_options)}/v1/document-indexes/#{id}/documents/#{document_id}"
end
end
end
Expand Down
Loading