Skip to content

Fix annotation package #3716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
Expand Up @@ -20,8 +20,7 @@
import java.util.List;
import java.util.Map;

import org.jetbrains.annotations.NotNull;

import org.springframework.lang.NonNull;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.MultiValueMap;
Expand All @@ -33,7 +32,7 @@ private OpenAIAutoConfigurationUtil() {
// Avoids instantiation
}

public static @NotNull ResolvedConnectionProperties resolveConnectionProperties(
public static @NonNull ResolvedConnectionProperties resolveConnectionProperties(
OpenAiParentProperties commonProperties, OpenAiParentProperties modelProperties, String modelType) {

String baseUrl = StringUtils.hasText(modelProperties.getBaseUrl()) ? modelProperties.getBaseUrl()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2025-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.
*/

@NonNullApi
@NonNullFields
package org.springframework.ai.model.openai.autoconfigure;

import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;
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 @@ -26,7 +26,6 @@
import com.google.cloud.vertexai.Transport;
import com.google.cloud.vertexai.VertexAI;
import io.micrometer.observation.ObservationRegistry;
import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable;
Expand Down Expand Up @@ -56,6 +55,7 @@
import org.springframework.core.convert.support.DefaultConversionService;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.lang.NonNull;
import org.springframework.util.MimeType;
import org.springframework.util.MimeTypeUtils;

Expand Down Expand Up @@ -130,7 +130,7 @@ void testSafetySettings() {
assertThat(response.getResult().getMetadata().getFinishReason()).isEqualTo("SAFETY");
}

@NotNull
@NonNull
private Prompt createPrompt(VertexAiGeminiChatOptions chatOptions) {
String request = "Tell me about 3 famous pirates from the Golden Age of Piracy and why they did.";
String name = "Bob";
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 @@ -21,8 +21,8 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import io.micrometer.common.lang.NonNull;
import io.micrometer.common.lang.Nullable;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

public class AbstractResponseMetadata {

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 @@ -22,8 +22,8 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;

import io.micrometer.common.lang.NonNull;
import io.micrometer.common.lang.Nullable;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

public class MutableResponseMetadata implements ResponseMetadata {

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 @@ -20,8 +20,8 @@
import java.util.Set;
import java.util.function.Supplier;

import io.micrometer.common.lang.NonNull;
import io.micrometer.common.lang.Nullable;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

/**
* Interface representing metadata associated with an AI model's response.
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 @@ -25,4 +25,9 @@
*
*/

@NonNullApi
@NonNullFields
package org.springframework.ai.model;

import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;
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 @@ -20,7 +20,6 @@
import java.util.Map;
import java.util.UUID;

import org.jetbrains.annotations.NotNull;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
Expand All @@ -45,6 +44,7 @@
import org.springframework.ai.embedding.EmbeddingModel;
import org.springframework.ai.vectorstore.SearchRequest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.lang.NonNull;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
Expand All @@ -68,7 +68,7 @@ class PgVectorStoreWithChatMemoryAdvisorIT {

float[] embed = { 0.003961659F, -0.0073295482F, 0.02663665F };

private static @NotNull ChatModel chatModelAlwaysReturnsTheSameReply() {
private static @NonNull ChatModel chatModelAlwaysReturnsTheSameReply() {
ChatModel chatModel = mock(ChatModel.class);
ArgumentCaptor<Prompt> argumentCaptor = ArgumentCaptor.forClass(Prompt.class);
ChatResponse chatResponse = new ChatResponse(List.of(new Generation(new AssistantMessage("""
Expand All @@ -95,7 +95,7 @@ private static PgVectorStore createPgVectorStoreUsingTestcontainer(EmbeddingMode
.build();
}

private static @NotNull JdbcTemplate createJdbcTemplateWithConnectionToTestcontainer() {
private static @NonNull JdbcTemplate createJdbcTemplateWithConnectionToTestcontainer() {
PGSimpleDataSource ds = new PGSimpleDataSource();
ds.setUrl("jdbc:postgresql://localhost:" + postgresContainer.getMappedPort(5432) + "/postgres");
ds.setUser(postgresContainer.getUsername());
Expand Down Expand Up @@ -123,7 +123,7 @@ private static void verifyRequestHasBeenAdvisedWithMessagesFromVectorStore(ChatM
* Create a mock ChatModel that supports streaming responses for testing.
* @return A mock ChatModel that returns a predefined streaming response
*/
private static @NotNull ChatModel chatModelWithStreamingSupport() {
private static @NonNull ChatModel chatModelWithStreamingSupport() {
ChatModel chatModel = mock(ChatModel.class);

// Mock the regular call method
Expand Down Expand Up @@ -158,7 +158,7 @@ private static void verifyRequestHasBeenAdvisedWithMessagesFromVectorStore(ChatM
* VectorStoreChatMemoryAdvisor.
* @return A mock ChatModel that returns a problematic streaming response
*/
private static @NotNull ChatModel chatModelWithProblematicStreamingBehavior() {
private static @NonNull ChatModel chatModelWithProblematicStreamingBehavior() {
ChatModel chatModel = mock(ChatModel.class);

// Mock the regular call method
Expand Down Expand Up @@ -390,7 +390,7 @@ private Throwable getRootCause(Throwable throwable) {
}

@SuppressWarnings("unchecked")
private @NotNull EmbeddingModel embeddingNModelShouldAlwaysReturnFakedEmbed() {
private @NonNull EmbeddingModel embeddingNModelShouldAlwaysReturnFakedEmbed() {
EmbeddingModel embeddingModel = mock(EmbeddingModel.class);

Mockito.doAnswer(invocationOnMock -> List.of(this.embed, this.embed))
Expand Down