class Memo::Providers::Bus

Overview

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).

Included Modules

Defined in:

memo/providers/bus.cr

Constant Summary

DEFAULT_TIMEOUT = 60.seconds

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Memo::Providers::Base

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

Constructor Detail

def self.new(target : String, model : String = "", from_address : String = "memo:rag", timeout : Time::Span = DEFAULT_TIMEOUT) #

[View source]

Class Method Detail

def self.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).


[View source]
def self.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).


[View source]

Instance Method Detail

def embed_text(text : String, input_type : String | Nil = nil) : Tuple(Array(Float64), Int32) #
Description copied from module Memo::Providers::Base

Embed a single text

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


[View source]
def embed_texts(texts : Array(String), input_type : String | Nil = nil) : EmbedResult #
Description copied from module Memo::Providers::Base

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)


[View source]
def from_address : String #

[View source]
def model : String #

[View source]
def target : String #

[View source]