Class: OpenAI::Models::EmbeddingCreateParams

Inherits:
Internal::Type::BaseModel show all
Extended by:
Internal::Type::RequestParameters::Converter
Includes:
Internal::Type::RequestParameters
Defined in:
lib/openai/models/embedding_create_params.rb

Overview

Defined Under Namespace

Modules: EncodingFormat, Input, Model

Instance Attribute Summary collapse

Attributes included from Internal::Type::RequestParameters

#request_options

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Internal::Type::RequestParameters::Converter

dump_request

Methods included from Internal::Type::RequestParameters

included

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(input: , model: , dimensions: nil, encoding_format: nil, user: nil, request_options: {}) ⇒ Object

Some parameter documentations has been truncated, see OpenAI::Models::EmbeddingCreateParams for more details.

Parameters:

  • input (String, Array<String>, Array<Integer>, Array<Array<Integer>>) (defaults to: )

    Input text to embed, encoded as a string or array of tokens. To embed multiple i

  • model (String, Symbol, OpenAI::Models::EmbeddingModel) (defaults to: )

    ID of the model to use. You can use the [List models](platform.openai.co

  • dimensions (Integer) (defaults to: nil)

    The number of dimensions the resulting output embeddings should have. Only suppo

  • encoding_format (Symbol, OpenAI::Models::EmbeddingCreateParams::EncodingFormat) (defaults to: nil)

    The format to return the embeddings in. Can be either ‘float` or [`base64`](http

  • user (String) (defaults to: nil)

    A unique identifier representing your end-user, which can help OpenAI to monitor

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}) (defaults to: {})


# File 'lib/openai/models/embedding_create_params.rb', line 56

Instance Attribute Details

#dimensionsInteger?

The number of dimensions the resulting output embeddings should have. Only supported in ‘text-embedding-3` and later models.

Returns:

  • (Integer, nil)


39
# File 'lib/openai/models/embedding_create_params.rb', line 39

optional :dimensions, Integer

#encoding_formatSymbol, ...

The format to return the embeddings in. Can be either ‘float` or [`base64`](pypi.org/project/pybase64/).



46
# File 'lib/openai/models/embedding_create_params.rb', line 46

optional :encoding_format, enum: -> { OpenAI::EmbeddingCreateParams::EncodingFormat }

#inputString, ...

Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for all embedding models), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. In addition to the per-input token limit, all embedding models enforce a maximum of 300,000 tokens summed across all inputs in a single request.

Returns:

  • (String, Array<String>, Array<Integer>, Array<Array<Integer>>)


22
# File 'lib/openai/models/embedding_create_params.rb', line 22

required :input, union: -> { OpenAI::EmbeddingCreateParams::Input }

#modelString, ...

ID of the model to use. You can use the [List models](platform.openai.com/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](platform.openai.com/docs/models) for descriptions of them.

Returns:



32
# File 'lib/openai/models/embedding_create_params.rb', line 32

required :model, union: -> { OpenAI::EmbeddingCreateParams::Model }

#userString?

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](platform.openai.com/docs/guides/safety-best-practices#end-user-ids).

Returns:

  • (String, nil)


54
# File 'lib/openai/models/embedding_create_params.rb', line 54

optional :user, String

Class Method Details

.variantsArray(String, Symbol, OpenAI::Models::EmbeddingModel)

Returns:



# File 'lib/openai/models/embedding_create_params.rb', line 122