class

Memo::Providers::Bus

Inherits Memo::Providers::Base < Reference < Object

Bus-based embedding provider.

Routes embedding requests through the Arcana bus to a remote embedding service (e.g. openai:embed, voyage:embed).

Requires an Arcana::Client to be available — typically set once at process startup via Memo::Providers::Bus.client = ....

Bus responses don't include per-text token counts, only total_tokens. We distribute the total evenly across texts (same approach as Memo::Providers::OpenAI when the API doesn't itemize).

Constants

DEFAULT_TIMEOUT = 60.seconds

Constructors

new(target : String, model : String = "", from_address : String = "memo:rag", timeout : Time::Span = DEFAULT_TIMEOUT)
Source

Class methods

client

Process-wide Arcana::Client used by all Bus providers. Set once at process startup (e.g. in bin/memo-arcana.cr).

Source
client=(client : ::Arcana::Client | Nil)

Process-wide Arcana::Client used by all Bus providers. Set once at process startup (e.g. in bin/memo-arcana.cr).

Source

Instance methods

embed_text(text : String, input_type : String | Nil = nil) : Tuple(Array(Float64), Int32)

Embed a single text

Returns tuple of (embedding vector, token count) input_type: "query" or "document" (used by Voyage AI for optimized embeddings)

Source
embed_texts(texts : Array(String), input_type : String | Nil = nil) : EmbedResult

Embed multiple texts in a batch

Returns EmbedResult with embeddings and token counts input_type: "query" or "document" (used by Voyage AI for optimized embeddings)

Source
from_address
Source
model
Source
target
Source