Skip to content
Closed
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,13 +32,14 @@ public enum DocumentMetadata {
* The lower the distance, the more they are similar.
* It's the opposite of the similarity score.
*/
DISTANCE();
DISTANCE("distance");

private final String value;

DocumentMetadata() {
this.value = "distance";
DocumentMetadata(String value) {
this.value = value;
}

public String value() {
return this.value;
}
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 @@ -33,12 +33,12 @@ public enum AiObservationMetricAttributes {
/**
* The type of token being counted (input, output, total).
*/
TOKEN_TYPE();
TOKEN_TYPE("gen_ai.token.type");

private final String value;

AiObservationMetricAttributes() {
this.value = "gen_ai.token.type";
AiObservationMetricAttributes(String value) {
this.value = value;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public enum AiOperationType {

// @formatter:off

// Please, keep the alphabetical sorting.
/**
* AI operation type for chat.
*/
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 @@ -30,7 +30,6 @@ public enum AiProvider {

// @formatter:off

// Please, keep the alphabetical sorting.
/**
* AI system provided by Anthropic.
*/
Expand All @@ -47,41 +46,44 @@ public enum AiProvider {
BEDROCK_CONVERSE("bedrock_converse"),

/**
* AI system provided by Mistral.
* AI system provided by DeepSeek.
*/
MISTRAL_AI("mistral_ai"),
DEEPSEEK("deepseek"),

/**
* AI system provided by Oracle OCI.
* AI system provided by Vertex AI.
*/
OCI_GENAI("oci_genai"),
GOOGLE_GENAI_AI("google_genai"),

/**
* AI system provided by Ollama.
* AI system provided by Minimax.
*/
OLLAMA("ollama"),
MINIMAX("minimax"),

/**
* AI system provided by OpenAI.
* AI system provided by Mistral.
*/
OPENAI("openai"),
MISTRAL_AI("mistral_ai"),

/**
* AI system provided by Minimax.
* AI system provided by Oracle OCI.
*/
MINIMAX("minimax"),

OCI_GENAI("oci_genai"),

/**
* AI system provided by Ollama.
*/
OLLAMA("ollama"),

/**
* AI system provided by Zhipuai.
* AI system provided by ONNX.
*/
ZHIPUAI("zhipuai"),
ONNX("onnx"),

/**
* AI system provided by DeepSeek.
* AI system provided by OpenAI.
*/
DEEPSEEK("deepseek"),
OPENAI("openai"),

/**
* AI system provided by Spring AI.
Expand All @@ -94,14 +96,9 @@ public enum AiProvider {
VERTEX_AI("vertex_ai"),

/**
* AI system provided by Vertex AI.
*/
GOOGLE_GENAI_AI("google_genai"),

/**
* AI system provided by ONNX.
* AI system provided by Zhipuai.
*/
ONNX("onnx");
ZHIPUAI("zhipuai");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public enum SpringAiKind {

// @formatter:off

// Please, keep the alphabetical sorting.
/**
* Spring AI kind for advisor.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.ai.observation.conventions;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
* Unit tests for {@link AiOperationType}.
*
* @author Thomas Vitale
*/
class AiOperationTypeTests {

@Test
void enumValuesShouldBeSortedAlphabetically() {
List<String> actualNames = Arrays.stream(AiOperationType.values()).map(Enum::name).collect(Collectors.toList());

List<String> sortedNames = actualNames.stream().sorted().collect(Collectors.toList());

assertThat(actualNames).as("Enum values should be sorted alphabetically").isEqualTo(sortedNames);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.ai.observation.conventions;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
* Unit tests for {@link AiProvider}.
*
* @author Thomas Vitale
*/
class AiProviderTests {

@Test
void enumValuesShouldBeSortedAlphabetically() {
List<String> actualNames = Arrays.stream(AiProvider.values()).map(Enum::name).collect(Collectors.toList());

List<String> sortedNames = actualNames.stream().sorted().collect(Collectors.toList());

assertThat(actualNames).as("Enum values should be sorted alphabetically").isEqualTo(sortedNames);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.ai.observation.conventions;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
* Unit tests for {@link SpringAiKind}.
*
* @author Thomas Vitale
*/
class SpringAiKindTests {

@Test
void enumValuesShouldBeSortedAlphabetically() {
List<String> actualNames = Arrays.stream(SpringAiKind.values()).map(Enum::name).collect(Collectors.toList());

List<String> sortedNames = actualNames.stream().sorted().collect(Collectors.toList());

assertThat(actualNames).as("Enum values should be sorted alphabetically").isEqualTo(sortedNames);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.springframework.ai.observation.conventions;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
* Unit tests for {@link VectorStoreProvider}.
*
* @author Thomas Vitale
*/
class VectorStoreProviderTests {

@Test
void enumValuesShouldBeSortedAlphabetically() {
List<String> actualNames = Arrays.stream(VectorStoreProvider.values())
.map(Enum::name)
.collect(Collectors.toList());

List<String> sortedNames = actualNames.stream().sorted().collect(Collectors.toList());

assertThat(actualNames).as("Enum values should be sorted alphabetically").isEqualTo(sortedNames);
}

}