class
Memo::Providers::OpenAI
- Memo::Providers::OpenAI
- Reference
- Object
Overview
OpenAI embedding provider
Generates embeddings using OpenAI's embeddings API. Compatible with OpenAI, Azure OpenAI, and other OpenAI-compatible APIs.
Included Modules
Defined in:
memo/providers/openai.crConstant Summary
-
DEFAULT_BASE_URL =
"https://api.openai.com/v1"
Constructors
Instance Method Summary
- #api_key : String
- #base_url : String
-
#embed_text(text : String) : Tuple(Array(Float64), Int32)
Embed a single text
-
#embed_texts(texts : Array(String)) : EmbedResult
Embed multiple texts in a batch
- #model : String
Instance methods inherited from module Memo::Providers::Base
embed_text(text : String) : Tuple(Array(Float64), Int32)
embed_text,
embed_texts(texts : Array(String)) : EmbedResult
embed_texts
Constructor Detail
def self.new(api_key : String, model : String = "text-embedding-3-small", base_url : String = DEFAULT_BASE_URL)
#
Instance Method Detail
def embed_text(text : String) : Tuple(Array(Float64), Int32)
#
Description copied from module Memo::Providers::Base
Embed a single text
Returns tuple of (embedding vector, token count)
def embed_texts(texts : Array(String)) : EmbedResult
#
Description copied from module Memo::Providers::Base
Embed multiple texts in a batch
Returns EmbedResult with embeddings and token counts