Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 the original author or authors.
* Copyright 2023-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,7 +32,7 @@
*/
public abstract class AbstractEmbeddingModel implements EmbeddingModel {

private static Map<String, Integer> KNOWN_EMBEDDING_DIMENSIONS = loadKnownModelDimensions();
private static final Map<String, Integer> KNOWN_EMBEDDING_DIMENSIONS = loadKnownModelDimensions();

/**
* Default constructor.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 the original author or authors.
* Copyright 2023-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,7 @@

package org.springframework.ai.embedding;

import java.util.Arrays;
import java.util.Objects;

import org.springframework.ai.model.ModelResult;
Expand All @@ -25,11 +26,11 @@
*/
public class Embedding implements ModelResult<float[]> {

private float[] embedding;
private final float[] embedding;

private Integer index;
private final Integer index;

private EmbeddingResultMetadata metadata;
private final EmbeddingResultMetadata metadata;

/**
* Creates a new {@link Embedding} instance.
Expand Down Expand Up @@ -83,12 +84,12 @@ public boolean equals(Object o) {
return false;
}
Embedding other = (Embedding) o;
return Objects.equals(this.embedding, other.embedding) && Objects.equals(this.index, other.index);
return Arrays.equals(this.embedding, other.embedding) && Objects.equals(this.index, other.index);
}

@Override
public int hashCode() {
return Objects.hash(this.embedding, this.index);
return Objects.hash(Arrays.hashCode(this.embedding), this.index);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2024 the original author or authors.
* Copyright 2023-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -81,13 +81,13 @@ public enum ModalityType {

public static class ModalityUtils {

private static MimeType TEXT_MIME_TYPE = MimeTypeUtils.parseMimeType("text/*");
private static final MimeType TEXT_MIME_TYPE = MimeTypeUtils.parseMimeType("text/*");

private static MimeType IMAGE_MIME_TYPE = MimeTypeUtils.parseMimeType("image/*");
private static final MimeType IMAGE_MIME_TYPE = MimeTypeUtils.parseMimeType("image/*");

private static MimeType VIDEO_MIME_TYPE = MimeTypeUtils.parseMimeType("video/*");
private static final MimeType VIDEO_MIME_TYPE = MimeTypeUtils.parseMimeType("video/*");

private static MimeType AUDIO_MIME_TYPE = MimeTypeUtils.parseMimeType("audio/*");
private static final MimeType AUDIO_MIME_TYPE = MimeTypeUtils.parseMimeType("audio/*");

/**
* Infers the {@link ModalityType} of the source data used to generate the
Expand Down