org.llm4s.rag.embed
Members list
Type members
Classlikes
How many texts, and how many characters, one embedding request may carry (#3001). Providers cap a request's inputs (Cohere 96, Voyage 128, OpenAI 2,048) and its tokens (OpenAI 300,000), and reject a larger one outright, so a document of a few thousand chunks failed to ingest as a whole. The pipeline splits the texts into requests within both bounds; the defaults are below every provider llm4s ships.
How many texts, and how many characters, one embedding request may carry (#3001). Providers cap a request's inputs (Cohere 96, Voyage 128, OpenAI 2,048) and its tokens (OpenAI 300,000), and reject a larger one outright, so a document of a few thousand chunks failed to ingest as a whole. The pipeline splits the texts into requests within both bounds; the defaults are below every provider llm4s ships.
Value parameters
- maxChars
-
the most characters in one request, summed over its texts: a token budget, at roughly four characters a token. A single text longer than this goes alone in its request
- maxInputs
-
the most texts in one request; at least 1
Attributes
- Companion
- object
- Source
- EmbeddingBatching.scala
- Supertypes
Attributes
- Companion
- class
- Source
- EmbeddingBatching.scala
- Supertypes
- Self type
-
EmbeddingBatching.type
FileEmbedder handles extracting content from various file types and passing it to the appropriate embedding models.
FileEmbedder handles extracting content from various file types and passing it to the appropriate embedding models.
Encodes files of arbitrary MIME types into embedding vector sequences.
MIME type is detected automatically via Apache Tika. Dispatch then depends on the media type:
-
Text-like files (plain text, HTML, PDF, source code, …): text is extracted by org.llm4s.extract.TikaDocumentExtractor, optionally chunked, then embedded via the supplied
EmbeddingClient. Real embeddings are always produced. -
Image / Audio / Video: behaviour depends on
config.experimentalStubs. Whenfalse, the file bytes are read (bounded byconfig.maxMediaFileSize) and forwarded to theMultimodalEmbeddingProviderpassed toencodeFromPath; without one the call fails. Whentrue, a deterministic L2-normalised stub vector is returned instead; the vector is seeded from the file name, size, and last-modified time, so the same file always produces the same stub vector.
== Stub dimensions ==
Stub vectors are capped at MAX_STUB_DIMENSION (8 192) regardless of the configured model dimension, to prevent OOM errors during testing.
== Modality disambiguation ==
Each modality (image, audio, video) uses a different XOR seed constant when generating stub vectors, so stubs for the same file differ across modalities.
Attributes
- Source
- FileEmbedder.scala
- Supertypes
- Self type
-
FileEmbedder.type
Everything FileEmbedder needs beyond the file itself and the client that embeds it.
Everything FileEmbedder needs beyond the file itself and the client that embeds it.
Grouping these means a caller configures the embedder once rather than repeating five arguments - including a stubs toggle that is a deployment decision, not a call-site one - at every call.
Value parameters
- chunking
-
Text chunking settings; if enabled, extracted text is split before embedding.
- experimentalStubs
-
When
false, image/audio/video files are read and forwarded to theMultimodalEmbeddingProvidergiven toencodeFromPath. Whentrue, deterministic stub vectors are returned instead. - localModels
-
Model configurations for the image, audio and video modalities.
- maxMediaFileSize
-
Maximum allowed media file size in bytes. Files exceeding this limit are rejected with an error. Defaults to 50 MB.
- textModel
-
Model configuration (name + dimensions) used for text-like files.
Attributes
- Source
- FileEmbedder.scala
- Supertypes
Controls how extracted text is split before embedding.
Controls how extracted text is split before embedding.
Value parameters
- enabled
-
When
false, the full extracted text is embedded as a single unit. - overlap
-
Number of characters shared between adjacent chunks, to preserve context at chunk boundaries.
- size
-
Target chunk size in characters.
Attributes
- Companion
- object
- Source
- FileEmbedder.scala
- Supertypes
Attributes
- Companion
- class
- Source
- FileEmbedder.scala
- Supertypes
- Self type
-
TextChunkingConfig.type
