package at.procon.dip.embedding.support;

public final class EmbeddingVectorCodec {

    private EmbeddingVectorCodec() {
    }

    public static String toPgVector(float[] vector) {
        if (vector == null || vector.length == 0) {
            throw new IllegalArgumentException("Embedding vector must not be null or empty");
        }
        StringBuilder builder = new StringBuilder();
        builder.append('[');
        for (int i = 0; i < vector.length; i++) {
            if (i > 0) {
                builder.append(',');
            }
            builder.append(Float.toString(vector[i]));
        }
        builder.append(']');
        return builder.toString();
    }
}
