All URIs are relative to https://api.openai.com/v1
Method | HTTP request | Description |
---|---|---|
create_embedding | POST /embeddings | Creates an embedding vector representing the input text. |
create_embedding(create_embedding_request)
Creates an embedding vector representing the input text.
require 'time'
require 'openapi_client'
# setup authorization
OpenapiClient.configure do |config|
# Configure Bearer authorization: ApiKeyAuth
config.access_token = 'YOUR_BEARER_TOKEN'
end
api_instance = OpenapiClient::EmbeddingsApi.new
create_embedding_request = OpenapiClient::CreateEmbeddingRequest.new({input: nil, model: OpenapiClient::CreateEmbeddingRequestModel.new}) # CreateEmbeddingRequest |
begin
# Creates an embedding vector representing the input text.
result = api_instance.create_embedding(create_embedding_request)
p result
rescue OpenapiClient::ApiError => e
puts "Error when calling EmbeddingsApi->create_embedding: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> create_embedding_with_http_info(create_embedding_request)
begin
# Creates an embedding vector representing the input text.
data, status_code, headers = api_instance.create_embedding_with_http_info(create_embedding_request)
p status_code # => 2xx
p headers # => { ... }
p data # => <CreateEmbeddingResponse>
rescue OpenapiClient::ApiError => e
puts "Error when calling EmbeddingsApi->create_embedding_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
create_embedding_request | CreateEmbeddingRequest |
- Content-Type: application/json
- Accept: application/json