Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Latest commit

 

History

History
75 lines (52 loc) · 2.16 KB

EmbeddingsApi.md

File metadata and controls

75 lines (52 loc) · 2.16 KB

OpenapiClient::EmbeddingsApi

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(create_embedding_request)

Creates an embedding vector representing the input text.

Examples

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

Using the create_embedding_with_http_info variant

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

Parameters

Name Type Description Notes
create_embedding_request CreateEmbeddingRequest

Return type

CreateEmbeddingResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json