Class: OpenAI::Resources::Embeddings
- Inherits:
-
Object
- Object
- OpenAI::Resources::Embeddings
- Defined in:
- lib/openai/resources/embeddings.rb,
sig/openai/resources/embeddings.rbs
Overview
Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
Instance Method Summary collapse
-
#create(input:, model:, dimensions: nil, encoding_format: nil, user: nil, request_options: {}) ⇒ OpenAI::Models::CreateEmbeddingResponse
Creates an embedding vector representing the input text.
-
#initialize(client:) ⇒ Embeddings
constructor
private
A new instance of Embeddings.
Constructor Details
#initialize(client:) ⇒ Embeddings
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Embeddings.
63 64 65 |
# File 'lib/openai/resources/embeddings.rb', line 63 def initialize(client:) @client = client end |
Instance Method Details
#create(input:, model:, dimensions: nil, encoding_format: nil, user: nil, request_options: {}) ⇒ OpenAI::Models::CreateEmbeddingResponse
Creates an embedding vector representing the input text.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/openai/resources/embeddings.rb', line 48 def create(params) parsed, = OpenAI::EmbeddingCreateParams.dump_request(params) @client.request( method: :post, path: "embeddings", body: parsed, model: OpenAI::CreateEmbeddingResponse, security: {bearer_auth: true}, options: ) end |