Skip to content

v2: Sparse and multimodal embedding function interfaces #106

@oss-amikos

Description

@oss-amikos

Context

The Go client defines separate interfaces for sparse and multimodal embedding functions, beyond the standard dense EmbeddingFunction. The Java client only has the basic EmbeddingFunction interface.

Missing interfaces

SparseEmbeddingFunction

public interface SparseEmbeddingFunction {
    List<SparseVector> embedDocuments(List<String> texts);
    SparseVector embedQuery(String text);
    String name();
}

public final class SparseVector {
    private final int[] indices;
    private final float[] values;
}

Providers: BM25, Chroma Cloud Splade

MultimodalEmbeddingFunction

public interface MultimodalEmbeddingFunction extends EmbeddingFunction {
    List<float[]> embedImages(List<ImageInput> images);
    float[] embedImage(ImageInput image);
}

public final class ImageInput {
    public static ImageInput fromBase64(String base64) { ... }
    public static ImageInput fromUrl(String url) { ... }
    public static ImageInput fromFile(Path path) { ... }
}

Providers: Roboflow CLIP

Reference

  • Go client: SparseEmbeddingFunction, MultimodalEmbeddingFunction interfaces
  • Go sparse: bm25, chromacloudsplade packages
  • Go multimodal: roboflow package

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-designAPI shape and design decisionsenhancementNew feature or requestv2v2 API support

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions