Remove deprecated classes and methods in spring-ai-core

* Remove use of Document.getContext method from spring-ai-core, use getText
* Remove deprecated ChatOptionsBuilder class
* Remove deprecated FunctionCallingOptionsBuilder class
This commit is contained in:
Ilayaperumal Gopinathan
2025-01-03 13:12:52 +00:00
committed by Mark Pollack
parent 0738122318
commit 977500f7a1
88 changed files with 160 additions and 1706 deletions

View File

@@ -105,7 +105,7 @@ class MarkdownDocumentReaderTest {
Document documentsFirst = documents.get(0);
assertThat(documentsFirst.getMetadata()).isEmpty();
assertThat(documentsFirst.getContent()).startsWith("Lorem ipsum dolor sit amet, consectetur adipiscing elit")
assertThat(documentsFirst.getText()).startsWith("Lorem ipsum dolor sit amet, consectetur adipiscing elit")
.endsWith("Phasellus eget tellus sed nibh ornare interdum eu eu mi.");
}
@@ -119,7 +119,7 @@ class MarkdownDocumentReaderTest {
Document documentsFirst = documents.get(0);
assertThat(documentsFirst.getMetadata()).isEmpty();
assertThat(documentsFirst.getContent()).isEqualTo(
assertThat(documentsFirst.getText()).isEqualTo(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tincidunt velit non bibendum gravida. Cras accumsan tincidunt ornare. Donec hendrerit consequat tellus blandit accumsan. Aenean aliquam metus at arcu elementum dignissim.Nullam nisi dui, egestas nec sem nec, interdum lobortis enim. Pellentesque odio orci, faucibus eu luctus nec, venenatis et magna. Vestibulum nec eros non felis fermentum posuere eget ac risus.Aenean eu leo eu nibh tristique posuere quis quis massa. Nullam lacinia luctus sem ut vehicula.");
}
@@ -135,22 +135,22 @@ class MarkdownDocumentReaderTest {
assertThat(documents).satisfiesExactly(document -> {
assertThat(document.getMetadata()).isEqualTo(Map.of());
assertThat(document.getContent()).isEqualTo("This is a Java sample application:");
assertThat(document.getText()).isEqualTo("This is a Java sample application:");
}, document -> {
assertThat(document.getMetadata()).isEqualTo(Map.of("lang", "java", "category", "code_block"));
assertThat(document.getContent()).startsWith("package com.example.demo;")
assertThat(document.getText()).startsWith("package com.example.demo;")
.contains("SpringApplication.run(DemoApplication.class, args);");
}, document -> {
assertThat(document.getMetadata()).isEqualTo(Map.of("category", "code_inline"));
assertThat(document.getContent()).isEqualTo(
assertThat(document.getText()).isEqualTo(
"Markdown also provides the possibility to use inline code formatting throughout the entire sentence.");
}, document -> {
assertThat(document.getMetadata()).isEqualTo(Map.of());
assertThat(document.getContent())
assertThat(document.getText())
.isEqualTo("Another possibility is to set block code without specific highlighting:");
}, document -> {
assertThat(document.getMetadata()).isEqualTo(Map.of("lang", "", "category", "code_block"));
assertThat(document.getContent()).isEqualTo("./mvnw spring-javaformat:apply\n");
assertThat(document.getText()).isEqualTo("./mvnw spring-javaformat:apply\n");
});
}
@@ -167,15 +167,15 @@ class MarkdownDocumentReaderTest {
assertThat(documents).satisfiesExactly(document -> {
assertThat(document.getMetadata()).isEqualTo(Map.of("lang", "java", "category", "code_block"));
assertThat(document.getContent()).startsWith("This is a Java sample application: package com.example.demo")
assertThat(document.getText()).startsWith("This is a Java sample application: package com.example.demo")
.contains("SpringApplication.run(DemoApplication.class, args);");
}, document -> {
assertThat(document.getMetadata()).isEqualTo(Map.of("category", "code_inline"));
assertThat(document.getContent()).isEqualTo(
assertThat(document.getText()).isEqualTo(
"Markdown also provides the possibility to use inline code formatting throughout the entire sentence.");
}, document -> {
assertThat(document.getMetadata()).isEqualTo(Map.of("lang", "", "category", "code_block"));
assertThat(document.getContent()).isEqualTo(
assertThat(document.getText()).isEqualTo(
"Another possibility is to set block code without specific highlighting: ./mvnw spring-javaformat:apply\n");
});
}
@@ -208,7 +208,7 @@ class MarkdownDocumentReaderTest {
Document documentsFirst = documents.get(0);
assertThat(documentsFirst.getMetadata()).isEqualTo(Map.of("category", "blockquote"));
assertThat(documentsFirst.getContent()).isEqualTo(
assertThat(documentsFirst.getText()).isEqualTo(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur diam eros, laoreet sit amet cursus vitae, varius sed nisi. Cras sit amet quam quis velit commodo porta consectetur id nisi. Phasellus tincidunt pulvinar augue. Proin vel laoreet leo, sed luctus augue. Sed et ligula commodo, commodo lacus at, consequat turpis. Maecenas eget sapien odio. Maecenas urna lectus, pellentesque in accumsan aliquam, congue eu libero. Ut rhoncus nec justo a porttitor. Pellentesque auctor pharetra eros, viverra sodales lorem aliquet id. Curabitur semper nisi vel sem interdum suscipit.");
}
@@ -241,7 +241,7 @@ class MarkdownDocumentReaderTest {
Document documentsFirst = documents.get(0);
assertThat(documentsFirst.getMetadata()).isEqualTo(Map.of("service", "some-service-name", "env", "prod"));
assertThat(documentsFirst.getContent()).startsWith("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
assertThat(documentsFirst.getText()).startsWith("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
}
}

View File

@@ -145,7 +145,7 @@ public class ParagraphPdfDocumentReader implements DocumentReader {
while (itr.hasNext()) {
var next = itr.next();
Document document = toDocument(current, next);
if (document != null && StringUtils.hasText(document.getContent())) {
if (document != null && StringUtils.hasText(document.getText())) {
documents.add(toDocument(current, next));
}
current = next;

View File

@@ -43,7 +43,7 @@ public class TikaDocumentReaderTests {
assertThat(doc.getMetadata()).containsKeys(TikaDocumentReader.METADATA_SOURCE);
assertThat(doc.getMetadata().get(TikaDocumentReader.METADATA_SOURCE)).isEqualTo(resourceName);
assertThat(doc.getContent()).contains(contentSnipped);
assertThat(doc.getText()).contains(contentSnipped);
}
}

View File

@@ -45,7 +45,7 @@ public final class BedrockConverseChatModelMain2 {
String modelId = "anthropic.claude-3-5-sonnet-20240620-v1:0";
// var prompt = new Prompt("Tell me a joke?",
// ChatOptionsBuilder.builder().withModel(modelId).build());
// ChatOptions.builder().model(modelId).build();
var prompt = new Prompt(
// "What's the weather like in San Francisco, Tokyo, and Paris? Return the
// temperature in Celsius.",

View File

@@ -43,7 +43,7 @@ public final class BedrockConverseChatModelMain3 {
String modelId = "anthropic.claude-3-5-sonnet-20240620-v1:0";
// var prompt = new Prompt("Tell me a joke?",
// ChatOptionsBuilder.builder().withModel(modelId).build());
// ChatOptions.builder().model(modelId).build();
var prompt = new Prompt(
// "What's the weather like in San Francisco, Tokyo, and Paris? Return the
// temperature in Celsius.",

View File

@@ -73,7 +73,7 @@ public class BedrockCohereEmbeddingModel extends AbstractEmbeddingModel {
@Override
public float[] embed(Document document) {
return embed(document.getContent());
return embed(document.getText());
}
@Override

View File

@@ -71,7 +71,7 @@ public class BedrockTitanEmbeddingModel extends AbstractEmbeddingModel {
@Override
public float[] embed(Document document) {
return embed(document.getContent());
return embed(document.getText());
}
@Override

View File

@@ -100,7 +100,7 @@ public class OCIEmbeddingModel extends AbstractEmbeddingModel {
@Override
public float[] embed(Document document) {
return embed(document.getContent());
return embed(document.getText());
}
private EmbeddingResponse embedAllWithContext(List<EmbedTextRequest> embedTextRequests,

View File

@@ -96,7 +96,7 @@ public class OllamaEmbeddingModel extends AbstractEmbeddingModel {
@Override
public float[] embed(Document document) {
return embed(document.getContent());
return embed(document.getText());
}
@Override

View File

@@ -117,7 +117,7 @@ public class AcmeIT extends AbstractIT {
private Message getSystemMessage(List<Document> similarDocuments) {
String documents = similarDocuments.stream()
.map(entry -> entry.getContent())
.map(entry -> entry.getText())
.collect(Collectors.joining(System.lineSeparator()));
SystemPromptTemplate systemPromptTemplate = new SystemPromptTemplate(this.systemBikePrompt);

View File

@@ -141,10 +141,10 @@ public class VertexAiMultimodalEmbeddingModel implements DocumentEmbeddingModel
}
// optional text parameter
if (StringUtils.hasText(document.getContent())) {
instanceBuilder.text(document.getContent());
if (StringUtils.hasText(document.getText())) {
instanceBuilder.text(document.getText());
documentMetadata.put(ModalityType.TEXT,
new DocumentMetadata(document.getId(), MimeTypeUtils.TEXT_PLAIN, document.getContent()));
new DocumentMetadata(document.getId(), MimeTypeUtils.TEXT_PLAIN, document.getText()));
}
Media media = document.getMedia();
@@ -153,7 +153,7 @@ public class VertexAiMultimodalEmbeddingModel implements DocumentEmbeddingModel
instanceBuilder.text(media.getData().toString());
documentMetadata.put(ModalityType.TEXT,
new DocumentMetadata(document.getId(), MimeTypeUtils.TEXT_PLAIN, media.getData()));
if (StringUtils.hasText(document.getContent())) {
if (StringUtils.hasText(document.getText())) {
logger.warn("Media type String overrides the Document text content!");
}
}

View File

@@ -72,7 +72,7 @@ public class WatsonxAiEmbeddingModel extends AbstractEmbeddingModel {
@Override
public float[] embed(Document document) {
return embed(document.getContent());
return embed(document.getText());
}
@Override

View File

@@ -274,42 +274,6 @@ public abstract class AbstractChatMemoryAdvisor<T> implements CallAroundAdvisor,
return this;
}
/**
* @deprecated use {@link #conversationId( String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public AbstractBuilder withConversationId(String conversationId) {
this.conversationId = conversationId;
return this;
}
/**
* @deprecated use {@link #chatMemoryRetrieveSize(int)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public AbstractBuilder withChatMemoryRetrieveSize(int chatMemoryRetrieveSize) {
this.chatMemoryRetrieveSize = chatMemoryRetrieveSize;
return this;
}
/**
* @deprecated use {@link #protectFromBlocking(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public AbstractBuilder withProtectFromBlocking(boolean protectFromBlocking) {
this.protectFromBlocking = protectFromBlocking;
return this;
}
/**
* @deprecated use {@link #order(int)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public AbstractBuilder withOrder(int order) {
this.order = order;
return this;
}
/**
* Build the advisor.
* @return the advisor

View File

@@ -157,15 +157,6 @@ public class PromptChatMemoryAdvisor extends AbstractChatMemoryAdvisor<ChatMemor
return this;
}
/**
* @deprecated use {@link #systemTextAdvise(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSystemTextAdvise(String systemTextAdvise) {
this.systemTextAdvise = systemTextAdvise;
return this;
}
public PromptChatMemoryAdvisor build() {
return new PromptChatMemoryAdvisor(this.chatMemory, this.conversationId, this.chatMemoryRetrieveSize,
this.systemTextAdvise, this.order);

View File

@@ -309,44 +309,6 @@ public class QuestionAnswerAdvisor implements CallAroundAdvisor, StreamAroundAdv
return this;
}
/**
* @deprecated use {@link #searchRequest(SearchRequest)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSearchRequest(SearchRequest searchRequest) {
Assert.notNull(searchRequest, "The searchRequest must not be null!");
this.searchRequest = searchRequest;
return this;
}
/**
* @deprecated use {@link #userTextAdvise(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withUserTextAdvise(String userTextAdvise) {
Assert.hasText(userTextAdvise, "The userTextAdvise must not be empty!");
this.userTextAdvise = userTextAdvise;
return this;
}
/**
* @deprecated use {@link #protectFromBlocking(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withProtectFromBlocking(boolean protectFromBlocking) {
this.protectFromBlocking = protectFromBlocking;
return this;
}
/**
* @deprecated use {@link #order(int)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withOrder(int order) {
this.order = order;
return this;
}
public QuestionAnswerAdvisor build() {
return new QuestionAnswerAdvisor(this.vectorStore, this.searchRequest, this.userTextAdvise,
this.protectFromBlocking, this.order);

View File

@@ -132,33 +132,6 @@ public class SafeGuardAdvisor implements CallAroundAdvisor, StreamAroundAdvisor
return this;
}
/**
* @deprecated use {@link #sensitiveWords(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSensitiveWords(List<String> sensitiveWords) {
this.sensitiveWords = sensitiveWords;
return this;
}
/**
* @deprecated use {@link #failureResponse(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withFailureResponse(String failureResponse) {
this.failureResponse = failureResponse;
return this;
}
/**
* @deprecated use {@link #order(int)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withOrder(int order) {
this.order = order;
return this;
}
public SafeGuardAdvisor build() {
return new SafeGuardAdvisor(this.sensitiveWords, this.failureResponse, this.order);
}

View File

@@ -219,15 +219,6 @@ public class VectorStoreChatMemoryAdvisor extends AbstractChatMemoryAdvisor<Vect
return this;
}
/**
* @deprecated use {@link #systemTextAdvise(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSystemTextAdvise(String systemTextAdvise) {
this.systemTextAdvise = systemTextAdvise;
return this;
}
@Override
public VectorStoreChatMemoryAdvisor build() {
return new VectorStoreChatMemoryAdvisor(this.chatMemory, this.conversationId, this.chatMemoryRetrieveSize,

View File

@@ -364,132 +364,6 @@ public record AdvisedRequest(
return this;
}
/**
* @deprecated use {@link #chatModel(ChatModel)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withChatModel(ChatModel chatModel) {
this.chatModel = chatModel;
return this;
}
/**
* @deprecated use {@link #userText(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withUserText(String userText) {
this.userText = userText;
return this;
}
/**
* @deprecated use {@link #systemText(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSystemText(String systemText) {
this.systemText = systemText;
return this;
}
/**
* @deprecated use {@link #chatOptions(ChatOptions)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withChatOptions(ChatOptions chatOptions) {
this.chatOptions = chatOptions;
return this;
}
/**
* @deprecated use {@link #media(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withMedia(List<Media> media) {
this.media = media;
return this;
}
/**
* @deprecated use {@link #functionNames(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withFunctionNames(List<String> functionNames) {
this.functionNames = functionNames;
return this;
}
/**
* @deprecated use {@link #functionCallbacks(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withFunctionCallbacks(List<FunctionCallback> functionCallbacks) {
this.functionCallbacks = functionCallbacks;
return this;
}
/**
* @deprecated use {@link #messages(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withMessages(List<Message> messages) {
this.messages = messages;
return this;
}
/**
* @deprecated use {@link #userParams(Map)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withUserParams(Map<String, Object> userParams) {
this.userParams = userParams;
return this;
}
/**
* @deprecated use {@link #systemParams(Map)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSystemParams(Map<String, Object> systemParams) {
this.systemParams = systemParams;
return this;
}
/**
* @deprecated use {@link #advisors(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withAdvisors(List<Advisor> advisors) {
this.advisors = advisors;
return this;
}
/**
* @deprecated use {@link #advisorParams(Map)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withAdvisorParams(Map<String, Object> advisorParams) {
this.advisorParams = advisorParams;
return this;
}
/**
* @deprecated use {@link #adviseContext(Map)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withAdviseContext(Map<String, Object> adviseContext) {
this.adviseContext = adviseContext;
return this;
}
/**
* @deprecated use {@link #toolContext(Map)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withToolContext(Map<String, Object> toolContext) {
this.toolContext = toolContext;
return this;
}
/**
* Build the {@link AdvisedRequest} instance.
* @return a new {@link AdvisedRequest} instance

View File

@@ -110,24 +110,6 @@ public record AdvisedResponse(@Nullable ChatResponse response, Map<String, Objec
return this;
}
/**
* @deprecated use {@link #response(ChatResponse)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withResponse(@Nullable ChatResponse response) {
this.response = response;
return this;
}
/**
* @deprecated use {@link #adviseContext(Map)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withAdviseContext(Map<String, Object> adviseContext) {
this.adviseContext = adviseContext;
return this;
}
/**
* Build the {@link AdvisedResponse}.
* @return the advised response

View File

@@ -276,60 +276,6 @@ public class AdvisorObservationContext extends Observation.Context {
return this;
}
/**
* @deprecated use {@link #advisorName(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withAdvisorName(String advisorName) {
this.advisorName = advisorName;
return this;
}
/**
* @deprecated use {@link #advisorType(Type)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withAdvisorType(Type advisorType) {
this.advisorType = advisorType;
return this;
}
/**
* @deprecated use {@link #advisedRequest(AdvisedRequest)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withAdvisedRequest(AdvisedRequest advisedRequest) {
this.advisorRequest = advisedRequest;
return this;
}
/**
* @deprecated use {@link #advisorRequestContext(Map)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withAdvisorRequestContext(Map<String, Object> advisorRequestContext) {
this.advisorRequestContext = advisorRequestContext;
return this;
}
/**
* @deprecated use {@link #advisorResponseContext(Map)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withAdvisorResponseContext(Map<String, Object> advisorResponseContext) {
this.advisorResponseContext = advisorResponseContext;
return this;
}
/**
* @deprecated use {@link #order(int)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withOrder(int order) {
this.order = order;
return this;
}
/**
* Build the {@link AdvisorObservationContext}.
* @return the {@link AdvisorObservationContext}

View File

@@ -170,62 +170,6 @@ public class ChatResponseMetadata extends AbstractResponseMetadata implements Re
return this;
}
/**
* @deprecated use {@link #metadata(Map)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder wihtMetadata(Map<String, Object> mapToCopy) {
return metadata(mapToCopy);
}
/**
* @deprecated use {@link #keyValue(String, Object)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withKeyValue(String key, Object value) {
return keyValue(key, value);
}
/**
* @deprecated use {@link #id(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withId(String id) {
return id(id);
}
/**
* @deprecated use {@link #model(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withModel(String model) {
return model(model);
}
/**
* @deprecated use {@link #rateLimit(RateLimit)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withRateLimit(RateLimit rateLimit) {
return rateLimit(rateLimit);
}
/**
* @deprecated use {@link #usage(Usage)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withUsage(Usage usage) {
return usage(usage);
}
/**
* @deprecated use {@link #promptMetadata(PromptMetadata)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withPromptMetadata(PromptMetadata promptMetadata) {
return promptMetadata(promptMetadata);
}
public ChatResponseMetadata build() {
return this.chatResponseMetadata;
}

View File

@@ -1,185 +0,0 @@
/*
* Copyright 2023-2024 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.chat.prompt;
import java.util.List;
/**
* @deprecated Use {@link ChatOptions.Builder} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public final class ChatOptionsBuilder {
private final DefaultChatOptions options = new DefaultChatOptions();
private ChatOptionsBuilder() {
}
public static ChatOptionsBuilder builder() {
return new ChatOptionsBuilder();
}
public ChatOptionsBuilder withModel(String model) {
this.options.setModel(model);
return this;
}
public ChatOptionsBuilder withFrequencyPenalty(Double frequencyPenalty) {
this.options.setFrequencyPenalty(frequencyPenalty);
return this;
}
public ChatOptionsBuilder withMaxTokens(Integer maxTokens) {
this.options.setMaxTokens(maxTokens);
return this;
}
public ChatOptionsBuilder withPresencePenalty(Double presencePenalty) {
this.options.setPresencePenalty(presencePenalty);
return this;
}
public ChatOptionsBuilder withStopSequences(List<String> stop) {
this.options.setStopSequences(stop);
return this;
}
public ChatOptionsBuilder withTemperature(Double temperature) {
this.options.setTemperature(temperature);
return this;
}
public ChatOptionsBuilder withTopK(Integer topK) {
this.options.setTopK(topK);
return this;
}
public ChatOptionsBuilder withTopP(Double topP) {
this.options.setTopP(topP);
return this;
}
public ChatOptions build() {
return this.options;
}
private final static class DefaultChatOptions implements ChatOptions {
private String model;
private Double frequencyPenalty;
private Integer maxTokens;
private Double presencePenalty;
private List<String> stopSequences;
private Double temperature;
private Integer topK;
private Double topP;
@Override
public String getModel() {
return this.model;
}
public void setModel(String model) {
this.model = model;
}
@Override
public Double getFrequencyPenalty() {
return this.frequencyPenalty;
}
public void setFrequencyPenalty(Double frequencyPenalty) {
this.frequencyPenalty = frequencyPenalty;
}
@Override
public Integer getMaxTokens() {
return this.maxTokens;
}
public void setMaxTokens(Integer maxTokens) {
this.maxTokens = maxTokens;
}
@Override
public Double getPresencePenalty() {
return this.presencePenalty;
}
public void setPresencePenalty(Double presencePenalty) {
this.presencePenalty = presencePenalty;
}
@Override
public List<String> getStopSequences() {
return this.stopSequences;
}
public void setStopSequences(List<String> stopSequences) {
this.stopSequences = stopSequences;
}
@Override
public Double getTemperature() {
return this.temperature;
}
public void setTemperature(Double temperature) {
this.temperature = temperature;
}
@Override
public Integer getTopK() {
return this.topK;
}
public void setTopK(Integer topK) {
this.topK = topK;
}
@Override
public Double getTopP() {
return this.topP;
}
public void setTopP(Double topP) {
this.topP = topP;
}
@Override
public ChatOptions copy() {
return builder().withModel(this.model)
.withFrequencyPenalty(this.frequencyPenalty)
.withMaxTokens(this.maxTokens)
.withPresencePenalty(this.presencePenalty)
.withStopSequences(this.stopSequences != null ? List.copyOf(this.stopSequences) : null)
.withTemperature(this.temperature)
.withTopK(this.topK)
.withTopP(this.topP)
.build();
}
}
}

View File

@@ -113,7 +113,7 @@ public final class DefaultContentFormatter implements ContentFormatter {
.collect(Collectors.joining(this.metadataSeparator));
return this.textTemplate.replace(TEMPLATE_METADATA_STRING_PLACEHOLDER, metadataText)
.replace(TEMPLATE_CONTENT_PLACEHOLDER, document.getContent());
.replace(TEMPLATE_CONTENT_PLACEHOLDER, document.getText());
}
/**

View File

@@ -178,14 +178,6 @@ public class Document {
return this.id;
}
/**
* @deprecated Use getText() instead as it more accurately reflects the content type
*/
@Deprecated
public String getContent() {
return this.getText();
}
/**
* Returns the document's text content, if any.
* @return the text content if {@link #isText()} is true, null otherwise

View File

@@ -58,60 +58,6 @@ public final class ImageOptionsBuilder {
return this;
}
/**
* @deprecated use {@link #N(Integer)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public ImageOptionsBuilder withN(Integer n) {
this.options.setN(n);
return this;
}
/**
* @deprecated use {@link #model(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public ImageOptionsBuilder withModel(String model) {
this.options.setModel(model);
return this;
}
/**
* @deprecated use {@link #responseFormat(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public ImageOptionsBuilder withResponseFormat(String responseFormat) {
this.options.setResponseFormat(responseFormat);
return this;
}
/**
* @deprecated use {@link #width(Integer)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public ImageOptionsBuilder withWidth(Integer width) {
this.options.setWidth(width);
return this;
}
/**
* @deprecated use {@link #height(Integer)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public ImageOptionsBuilder withHeight(Integer height) {
this.options.setHeight(height);
return this;
}
/**
* @deprecated use {@link #style(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public ImageOptionsBuilder withStyle(String style) {
this.options.setStyle(style);
return this;
}
public ImageOptions build() {
return this.options;
}

View File

@@ -172,86 +172,6 @@ public interface FunctionCallingOptions extends ChatOptions {
@Override
Builder topP(Double topP);
/**
* @deprecated Use {@link #model(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withModel(String model) {
return model(model);
}
/**
* @deprecated Use {@link #frequencyPenalty(Double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withFrequencyPenalty(Double frequencyPenalty) {
return frequencyPenalty(frequencyPenalty);
}
/**
* @deprecated Use {@link #maxTokens(Integer)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withMaxTokens(Integer maxTokens) {
return maxTokens(maxTokens);
}
/**
* @deprecated Use {@link #presencePenalty(Double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withPresencePenalty(Double presencePenalty) {
return presencePenalty(presencePenalty);
}
/**
* @deprecated Use {@link #stopSequences(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withStopSequences(List<String> stopSequences) {
return stopSequences(stopSequences);
}
/**
* @deprecated Use {@link #temperature(Double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withTemperature(Double temperature) {
return temperature(temperature);
}
/**
* @deprecated Use {@link #functionCallbacks(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withFunctionCallbacks(List<FunctionCallback> functionCallbacks) {
return functionCallbacks(functionCallbacks);
}
/**
* @deprecated Use {@link #functionCallbacks(FunctionCallback...)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withFunctionCallbacks(FunctionCallback... functionCallbacks) {
return functionCallbacks(functionCallbacks);
}
/**
* @deprecated Use {@link #functions(Set)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withFunctions(Set<String> functions) {
return functions(functions);
}
/**
* @deprecated Use {@link #function(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
default Builder withFunction(String function) {
return function(function);
}
}
}

View File

@@ -1,367 +0,0 @@
/*
* Copyright 2023-2024 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.model.function;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.springframework.ai.chat.prompt.ChatOptions;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* Builder for {@link FunctionCallingOptions}. Using the {@link FunctionCallingOptions}
* permits options portability between different AI providers that support
* function-calling.
*
* @deprecated Use {@link FunctionCallingOptions.Builder} instead.
* @author Christian Tzolov
* @author Thomas Vitale
* @since 0.8.1
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public class FunctionCallingOptionsBuilder {
private final PortableFunctionCallingOptions options;
public FunctionCallingOptionsBuilder() {
this.options = new PortableFunctionCallingOptions();
}
public FunctionCallingOptionsBuilder withFunctionCallbacks(List<FunctionCallback> functionCallbacks) {
this.options.setFunctionCallbacks(functionCallbacks);
return this;
}
public FunctionCallingOptionsBuilder withFunctionCallbacks(FunctionCallback... functionCallbacks) {
Assert.notNull(functionCallbacks, "FunctionCallbacks must not be null");
this.options.setFunctionCallbacks(List.of(functionCallbacks));
return this;
}
public FunctionCallingOptionsBuilder withFunctions(Set<String> functions) {
this.options.setFunctions(functions);
return this;
}
public FunctionCallingOptionsBuilder withFunction(String function) {
Assert.notNull(function, "Function must not be null");
var set = new HashSet<>(this.options.getFunctions());
set.add(function);
this.options.setFunctions(set);
return this;
}
public FunctionCallingOptionsBuilder withModel(String model) {
this.options.setModel(model);
return this;
}
public FunctionCallingOptionsBuilder withFrequencyPenalty(Double frequencyPenalty) {
this.options.setFrequencyPenalty(frequencyPenalty);
return this;
}
public FunctionCallingOptionsBuilder withMaxTokens(Integer maxTokens) {
this.options.setMaxTokens(maxTokens);
return this;
}
public FunctionCallingOptionsBuilder withPresencePenalty(Double presencePenalty) {
this.options.setPresencePenalty(presencePenalty);
return this;
}
public FunctionCallingOptionsBuilder withStopSequences(List<String> stopSequences) {
this.options.setStopSequences(stopSequences);
return this;
}
public FunctionCallingOptionsBuilder withTemperature(Double temperature) {
this.options.setTemperature(temperature);
return this;
}
public FunctionCallingOptionsBuilder withTopK(Integer topK) {
this.options.setTopK(topK);
return this;
}
public FunctionCallingOptionsBuilder withTopP(Double topP) {
this.options.setTopP(topP);
return this;
}
public FunctionCallingOptionsBuilder withProxyToolCalls(Boolean proxyToolCalls) {
this.options.setProxyToolCalls(proxyToolCalls);
return this;
}
public FunctionCallingOptionsBuilder withToolContext(Map<String, Object> context) {
Assert.notNull(context, "Tool context must not be null");
Map<String, Object> newContext = new HashMap<>(this.options.getToolContext());
newContext.putAll(context);
this.options.setToolContext(newContext);
return this;
}
public FunctionCallingOptionsBuilder withToolContext(String key, Object value) {
Assert.notNull(key, "Key must not be null");
Assert.notNull(value, "Value must not be null");
Map<String, Object> newContext = new HashMap<>(this.options.getToolContext());
newContext.put(key, value);
this.options.setToolContext(newContext);
return this;
}
public PortableFunctionCallingOptions build() {
return this.options;
}
/**
* @deprecated use {@link DefaultFunctionCallingOptions} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public static class PortableFunctionCallingOptions implements FunctionCallingOptions {
private List<FunctionCallback> functionCallbacks = new ArrayList<>();
private Set<String> functions = new HashSet<>();
private String model;
private Double frequencyPenalty;
private Integer maxTokens;
private Double presencePenalty;
private List<String> stopSequences;
private Double temperature;
private Integer topK;
private Double topP;
private Boolean proxyToolCalls = false;
private Map<String, Object> context = new HashMap<>();
public static FunctionCallingOptionsBuilder builder() {
return new FunctionCallingOptionsBuilder();
}
@Override
public List<FunctionCallback> getFunctionCallbacks() {
return Collections.unmodifiableList(this.functionCallbacks);
}
public void setFunctionCallbacks(List<FunctionCallback> functionCallbacks) {
Assert.notNull(functionCallbacks, "FunctionCallbacks must not be null");
this.functionCallbacks = new ArrayList<>(functionCallbacks);
}
@Override
public Set<String> getFunctions() {
return Collections.unmodifiableSet(this.functions);
}
public void setFunctions(Set<String> functions) {
Assert.notNull(functions, "Functions must not be null");
this.functions = new HashSet<>(functions);
}
@Override
public String getModel() {
return this.model;
}
public void setModel(String model) {
this.model = model;
}
@Override
public Double getFrequencyPenalty() {
return this.frequencyPenalty;
}
public void setFrequencyPenalty(Double frequencyPenalty) {
this.frequencyPenalty = frequencyPenalty;
}
@Override
public Integer getMaxTokens() {
return this.maxTokens;
}
public void setMaxTokens(Integer maxTokens) {
this.maxTokens = maxTokens;
}
@Override
public Double getPresencePenalty() {
return this.presencePenalty;
}
public void setPresencePenalty(Double presencePenalty) {
this.presencePenalty = presencePenalty;
}
@Override
public List<String> getStopSequences() {
return this.stopSequences;
}
public void setStopSequences(List<String> stopSequences) {
this.stopSequences = stopSequences;
}
@Override
public Double getTemperature() {
return this.temperature;
}
public void setTemperature(Double temperature) {
this.temperature = temperature;
}
@Override
public Integer getTopK() {
return this.topK;
}
public void setTopK(Integer topK) {
this.topK = topK;
}
@Override
public Double getTopP() {
return this.topP;
}
public void setTopP(Double topP) {
this.topP = topP;
}
@Override
public Boolean getProxyToolCalls() {
return this.proxyToolCalls;
}
public void setProxyToolCalls(Boolean proxyToolCalls) {
this.proxyToolCalls = proxyToolCalls;
}
public Map<String, Object> getToolContext() {
return Collections.unmodifiableMap(this.context);
}
public void setToolContext(Map<String, Object> context) {
Assert.notNull(context, "Context must not be null");
this.context = new HashMap<>(context);
}
@Override
public ChatOptions copy() {
return new FunctionCallingOptionsBuilder().withModel(this.model)
.withFrequencyPenalty(this.frequencyPenalty)
.withMaxTokens(this.maxTokens)
.withPresencePenalty(this.presencePenalty)
.withStopSequences(this.stopSequences != null ? new ArrayList<>(this.stopSequences) : null)
.withTemperature(this.temperature)
.withTopK(this.topK)
.withTopP(this.topP)
.withFunctions(new HashSet<>(this.functions))
.withFunctionCallbacks(new ArrayList<>(this.functionCallbacks))
.withProxyToolCalls(this.proxyToolCalls)
.withToolContext(new HashMap<>(this.getToolContext()))
.build();
}
public PortableFunctionCallingOptions merge(FunctionCallingOptions options) {
var builder = PortableFunctionCallingOptions.builder()
.withModel(StringUtils.hasText(options.getModel()) ? options.getModel() : this.model)
.withFrequencyPenalty(
options.getFrequencyPenalty() != null ? options.getFrequencyPenalty() : this.frequencyPenalty)
.withMaxTokens(options.getMaxTokens() != null ? options.getMaxTokens() : this.maxTokens)
.withPresencePenalty(
options.getPresencePenalty() != null ? options.getPresencePenalty() : this.presencePenalty)
.withStopSequences(options.getStopSequences() != null ? options.getStopSequences() : this.stopSequences)
.withTemperature(options.getTemperature() != null ? options.getTemperature() : this.temperature)
.withTopK(options.getTopK() != null ? options.getTopK() : this.topK)
.withTopP(options.getTopP() != null ? options.getTopP() : this.topP)
.withProxyToolCalls(
options.getProxyToolCalls() != null ? options.getProxyToolCalls() : this.proxyToolCalls);
Set<String> functions = new HashSet<>();
if (!CollectionUtils.isEmpty(this.functions)) {
functions.addAll(this.functions);
}
if (!CollectionUtils.isEmpty(options.getFunctions())) {
functions.addAll(options.getFunctions());
}
builder.withFunctions(functions);
List<FunctionCallback> functionCallbacks = new ArrayList<>();
if (!CollectionUtils.isEmpty(this.functionCallbacks)) {
functionCallbacks.addAll(this.functionCallbacks);
}
if (!CollectionUtils.isEmpty(options.getFunctionCallbacks())) {
functionCallbacks.addAll(options.getFunctionCallbacks());
}
builder.withFunctionCallbacks(functionCallbacks);
Map<String, Object> context = new HashMap<>();
if (!CollectionUtils.isEmpty(this.context)) {
context.putAll(this.context);
}
if (!CollectionUtils.isEmpty(options.getToolContext())) {
context.putAll(options.getToolContext());
}
builder.withToolContext(context);
return builder.build();
}
public PortableFunctionCallingOptions merge(ChatOptions options) {
var builder = PortableFunctionCallingOptions.builder()
.withModel(StringUtils.hasText(options.getModel()) ? options.getModel() : this.model)
.withFrequencyPenalty(
options.getFrequencyPenalty() != null ? options.getFrequencyPenalty() : this.frequencyPenalty)
.withMaxTokens(options.getMaxTokens() != null ? options.getMaxTokens() : this.maxTokens)
.withPresencePenalty(
options.getPresencePenalty() != null ? options.getPresencePenalty() : this.presencePenalty)
.withStopSequences(options.getStopSequences() != null ? options.getStopSequences() : this.stopSequences)
.withTemperature(options.getTemperature() != null ? options.getTemperature() : this.temperature)
.withTopK(options.getTopK() != null ? options.getTopK() : this.topK)
.withTopP(options.getTopP() != null ? options.getTopP() : this.topP);
return builder.build();
}
}
}

View File

@@ -224,105 +224,6 @@ public final class Categories {
return this;
}
/**
* @deprecated use {@link #sexual(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSexual(boolean sexual) {
this.sexual = sexual;
return this;
}
/**
* @deprecated use {@link #hate(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withHate(boolean hate) {
this.hate = hate;
return this;
}
/**
* @deprecated use {@link #harassment(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withHarassment(boolean harassment) {
this.harassment = harassment;
return this;
}
/**
* @deprecated use {@link #selfHarm(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSelfHarm(boolean selfHarm) {
this.selfHarm = selfHarm;
return this;
}
/**
* @deprecated use {@link #sexualMinors(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSexualMinors(boolean sexualMinors) {
this.sexualMinors = sexualMinors;
return this;
}
/**
* @deprecated use {@link #hateThreatening(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withHateThreatening(boolean hateThreatening) {
this.hateThreatening = hateThreatening;
return this;
}
/**
* @deprecated use {@link #violenceGraphic(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withViolenceGraphic(boolean violenceGraphic) {
this.violenceGraphic = violenceGraphic;
return this;
}
/**
* @deprecated use {@link #selfHarmIntent(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSelfHarmIntent(boolean selfHarmIntent) {
this.selfHarmIntent = selfHarmIntent;
return this;
}
/**
* @deprecated use {@link #selfHarmInstructions(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSelfHarmInstructions(boolean selfHarmInstructions) {
this.selfHarmInstructions = selfHarmInstructions;
return this;
}
/**
* @deprecated use {@link #harassmentThreatening(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withHarassmentThreatening(boolean harassmentThreatening) {
this.harassmentThreatening = harassmentThreatening;
return this;
}
/**
* @deprecated use {@link #violence(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withViolence(boolean violence) {
this.violence = violence;
return this;
}
public Categories build() {
return new Categories(this);
}

View File

@@ -229,105 +229,6 @@ public final class CategoryScores {
return this;
}
/**
* @deprecated use {@link #sexual(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSexual(double sexual) {
this.sexual = sexual;
return this;
}
/**
* @deprecated use {@link #hate(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withHate(double hate) {
this.hate = hate;
return this;
}
/**
* @deprecated use {@link #harassment(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withHarassment(double harassment) {
this.harassment = harassment;
return this;
}
/**
* @deprecated use {@link #selfHarm(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSelfHarm(double selfHarm) {
this.selfHarm = selfHarm;
return this;
}
/**
* @deprecated use {@link #sexualMinors(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSexualMinors(double sexualMinors) {
this.sexualMinors = sexualMinors;
return this;
}
/**
* @deprecated use {@link #hateThreatening(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withHateThreatening(double hateThreatening) {
this.hateThreatening = hateThreatening;
return this;
}
/**
* @deprecated use {@link #violenceGraphic(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withViolenceGraphic(double violenceGraphic) {
this.violenceGraphic = violenceGraphic;
return this;
}
/**
* @deprecated use {@link #selfHarmIntent(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSelfHarmIntent(double selfHarmIntent) {
this.selfHarmIntent = selfHarmIntent;
return this;
}
/**
* @deprecated use {@link #selfHarmInstructions(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSelfHarmInstructions(double selfHarmInstructions) {
this.selfHarmInstructions = selfHarmInstructions;
return this;
}
/**
* @deprecated use {@link #harassmentThreatening(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withHarassmentThreatening(double harassmentThreatening) {
this.harassmentThreatening = harassmentThreatening;
return this;
}
/**
* @deprecated use {@link #violence(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withViolence(double violence) {
this.violence = violence;
return this;
}
public CategoryScores build() {
return new CategoryScores(this);
}

View File

@@ -50,15 +50,6 @@ public class Generation implements ModelResult<Moderation> {
return this;
}
/**
* @deprecated use {@link #generationMetadata(ModerationGenerationMetadata)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Generation withGenerationMetadata(@Nullable ModerationGenerationMetadata moderationGenerationMetadata) {
this.moderationGenerationMetadata = moderationGenerationMetadata;
return this;
}
@Override
public Moderation getOutput() {
return this.moderation;

View File

@@ -106,33 +106,6 @@ public final class Moderation {
return this;
}
/**
* @deprecated use {@link #id(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withId(String id) {
this.id = id;
return this;
}
/**
* @deprecated use {@link #model(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withModel(String model) {
this.model = model;
return this;
}
/**
* @deprecated use {@link #results(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withResults(List<ModerationResult> results) {
this.moderationResultList = results;
return this;
}
public Moderation build() {
return new Moderation(this);
}

View File

@@ -42,15 +42,6 @@ public final class ModerationOptionsBuilder {
return this;
}
/**
* @deprecated use {@link #model(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public ModerationOptionsBuilder withModel(String model) {
this.options.setModel(model);
return this;
}
public ModerationOptions build() {
return this.options;
}

View File

@@ -115,33 +115,6 @@ public final class ModerationResult {
return this;
}
/**
* @deprecated use {@link #flagged(boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withFlagged(boolean flagged) {
this.flagged = flagged;
return this;
}
/**
* @deprecated use {@link #categories(Categories)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withCategories(Categories categories) {
this.categories = categories;
return this;
}
/**
* @deprecated use {@link #categoryScores(CategoryScores)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withCategoryScores(CategoryScores categoryScores) {
this.categoryScores = categoryScores;
return this;
}
public ModerationResult build() {
return new ModerationResult(this);
}

View File

@@ -95,18 +95,6 @@ public final class ExtractedTextFormatter {
return pageText.replaceAll("(?m)(^ *| +(?= |$))", "").replaceAll("(?m)^$( ?)(^$[\r\n]+?^)+", "$1");
}
/**
* Removes the specified number of lines from the bottom part of the text.
* @param pageText Text to remove lines from.
* @param numberOfLines Number of lines to remove.
* @return Returns the text striped from last lines.
* @deprecated use {@link #deleteTopTextLines(String, int, String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public static String deleteBottomTextLines(String pageText, int numberOfLines) {
return deleteBottomTextLines(pageText, numberOfLines, System.lineSeparator());
}
/**
* Removes the specified number of lines from the bottom part of the text.
* @param pageText Text to remove lines from.
@@ -130,33 +118,6 @@ public final class ExtractedTextFormatter {
return pageText.substring(0, truncateIndex);
}
/**
* Removes a specified number of lines from the top part of the given text.
*
* <p>
* This method takes a text and trims it by removing a certain number of lines from
* the top. If the provided text is null or contains only whitespace, it will be
* returned as is. If the number of lines to remove exceeds the actual number of lines
* in the text, the result will be an empty string.
* </p>
*
* <p>
* The method identifies lines based on the system's line separator, making it
* compatible with different platforms.
* </p>
* @param pageText The text from which the top lines need to be removed. If this is
* null, empty, or consists only of whitespace, it will be returned unchanged.
* @param numberOfLines The number of lines to remove from the top of the text. If
* this exceeds the actual number of lines in the text, an empty string will be
* returned.
* @return The text with the specified number of lines removed from the top.
* @deprecated use {@link #deleteTopTextLines(String, int, String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public static String deleteTopTextLines(String pageText, int numberOfLines) {
return deleteTopTextLines(pageText, numberOfLines, System.lineSeparator());
}
/**
* Removes a specified number of lines from the top part of the given text.
*

View File

@@ -64,7 +64,7 @@ public class KeywordMetadataEnricher implements DocumentTransformer {
for (Document document : documents) {
var template = new PromptTemplate(String.format(KEYWORDS_TEMPLATE, this.keywordCount));
Prompt prompt = template.create(Map.of(CONTEXT_STR_PLACEHOLDER, document.getContent()));
Prompt prompt = template.create(Map.of(CONTEXT_STR_PLACEHOLDER, document.getText()));
String keywords = this.chatModel.call(prompt).getResult().getOutput().getText();
document.getMetadata().putAll(Map.of(EXCERPT_KEYWORDS_METADATA_KEY, keywords));
}

View File

@@ -65,7 +65,7 @@ public abstract class TextSplitter implements DocumentTransformer {
List<ContentFormatter> formatters = new ArrayList<>();
for (Document doc : documents) {
texts.add(doc.getContent());
texts.add(doc.getText());
metadataList.add(doc.getMetadata());
formatters.add(doc.getContentFormatter());
}

View File

@@ -71,84 +71,6 @@ public final class SearchRequest {
.filterExpression(originalSearchRequest.getFilterExpression());
}
/**
* @deprecated use {@link SearchRequest.Builder#query(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public static SearchRequest query(String query) {
Assert.notNull(query, "Query can not be null.");
return builder().query(query).build();
}
/**
* Create a new {@link SearchRequest} builder instance with an empty embedding query
* string. Use the {@link Builder#query(String query)} to set/update the embedding
* query text.
* @return Returns new {@link SearchRequest} builder instance.
* @deprecated use {@link Builder#builder()} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public static Builder defaults() {
return new Builder().topK(DEFAULT_TOP_K).similarityThresholdAll();
}
/**
* @deprecated use {@link Builder#query(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public SearchRequest withQuery(String query) {
Assert.notNull(query, "Query can not be null.");
this.query = query;
return this;
}
/**
* @deprecated use {@link Builder#topK(int)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public SearchRequest withTopK(int topK) {
Assert.isTrue(topK >= 0, "TopK should be positive.");
this.topK = topK;
return this;
}
/**
* @deprecated use {@link Builder#similarityThreshold(double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public SearchRequest withSimilarityThreshold(double threshold) {
Assert.isTrue(threshold >= 0 && threshold <= 1, "Similarity threshold must be in [0,1] range.");
this.similarityThreshold = threshold;
return this;
}
/**
* @deprecated use {@link Builder#similarityThresholdAll()} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public SearchRequest withSimilarityThresholdAll() {
return withSimilarityThreshold(SIMILARITY_THRESHOLD_ACCEPT_ALL);
}
/**
* @deprecated use {@link Builder#filterExpression(Filter.Expression)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public SearchRequest withFilterExpression(@Nullable Filter.Expression expression) {
this.filterExpression = expression;
return this;
}
/**
* @deprecated use {@link Builder#filterExpression(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public SearchRequest withFilterExpression(@Nullable String textExpression) {
this.filterExpression = (textExpression != null) ? new FilterExpressionTextParser().parse(textExpression)
: null;
return this;
}
public String getQuery() {
return this.query;
}

View File

@@ -78,24 +78,6 @@ public class SimpleVectorStore extends AbstractObservationVectorStore {
protected Map<String, SimpleVectorStoreContent> store = new ConcurrentHashMap<>();
/**
* use {@link #SimpleVectorStore(SimpleVectorStoreBuilder)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public SimpleVectorStore(EmbeddingModel embeddingModel) {
this(embeddingModel, ObservationRegistry.NOOP, null);
}
/**
* use {@link #SimpleVectorStore(SimpleVectorStoreBuilder)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public SimpleVectorStore(EmbeddingModel embeddingModel, ObservationRegistry observationRegistry,
VectorStoreObservationConvention customObservationConvention) {
this(builder(embeddingModel).observationRegistry(observationRegistry)
.customObservationConvention(customObservationConvention));
}
protected SimpleVectorStore(SimpleVectorStoreBuilder builder) {
super(builder);
this.objectMapper = JsonMapper.builder().addModules(JacksonUtils.instantiateAvailableModules()).build();
@@ -119,8 +101,8 @@ public class SimpleVectorStore extends AbstractObservationVectorStore {
for (Document document : documents) {
logger.info("Calling EmbeddingModel for document id = {}", document.getId());
float[] embedding = this.embeddingModel.embed(document);
SimpleVectorStoreContent storeContent = new SimpleVectorStoreContent(document.getId(),
document.getContent(), document.getMetadata(), embedding);
SimpleVectorStoreContent storeContent = new SimpleVectorStoreContent(document.getId(), document.getText(),
document.getMetadata(), embedding);
this.store.put(document.getId(), storeContent);
}
}

View File

@@ -47,17 +47,6 @@ public abstract class AbstractObservationVectorStore implements VectorStore {
protected final EmbeddingModel embeddingModel;
/**
* Create a new {@link AbstractObservationVectorStore} instance.
* @param observationRegistry the observation registry to use
* @param customObservationConvention the custom observation convention to use
*/
@Deprecated(since = "1.0.0-M5", forRemoval = true)
public AbstractObservationVectorStore(ObservationRegistry observationRegistry,
@Nullable VectorStoreObservationConvention customObservationConvention) {
this(null, observationRegistry, customObservationConvention);
}
private AbstractObservationVectorStore(EmbeddingModel embeddingModel, ObservationRegistry observationRegistry,
@Nullable VectorStoreObservationConvention customObservationConvention) {
this.embeddingModel = embeddingModel;

View File

@@ -220,69 +220,6 @@ public class VectorStoreObservationContext extends Observation.Context {
return this;
}
/**
* @deprecated use {@link #collectionName(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withCollectionName(String collectionName) {
this.context.setCollectionName(collectionName);
return this;
}
/**
* @deprecated use {@link #dimensions(Integer)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withDimensions(Integer dimensions) {
this.context.setDimensions(dimensions);
return this;
}
/**
* @deprecated use {@link #fieldName(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withFieldName(@Nullable String fieldName) {
this.context.setFieldName(fieldName);
return this;
}
/**
* @deprecated use {@link #namespace(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withNamespace(String namespace) {
this.context.setNamespace(namespace);
return this;
}
/**
* @deprecated use {@link #queryRequest(SearchRequest)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withQueryRequest(SearchRequest request) {
this.context.setQueryRequest(request);
return this;
}
/**
* @deprecated use {@link #queryResponse(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withQueryResponse(List<Document> documents) {
this.context.setQueryResponse(documents);
return this;
}
/**
* @deprecated use {@link #similarityMetric(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withSimilarityMetric(String similarityMetric) {
this.context.setSimilarityMetric(similarityMetric);
return this;
}
public VectorStoreObservationContext build() {
return this.context;
}

View File

@@ -32,7 +32,7 @@ public class ContentFormatterTests {
@Test
public void noExplicitlySetFormatter() {
assertThat(this.document.getContent()).isEqualTo("""
assertThat(this.document.getText()).isEqualTo("""
The World is Big and Salvation Lurks Around the Corner""");
assertThat(this.document.getFormattedContent()).isEqualTo(this.document.getFormattedContent(MetadataMode.ALL));

View File

@@ -93,7 +93,7 @@ public class DocumentBuilderTests {
Document.Builder result = this.builder.text("Test content");
assertThat(result).isSameAs(this.builder);
assertThat(result.build().getContent()).isEqualTo("Test content");
assertThat(result.build().getText()).isEqualTo("Test content");
}
@Test
@@ -152,7 +152,7 @@ public class DocumentBuilderTests {
Document document = this.builder.text("text").text("Test content").build();
assertThat(document.getId()).isNotNull().isNotEmpty();
assertThat(document.getContent()).isEqualTo("Test content");
assertThat(document.getText()).isEqualTo("Test content");
}
@Test

View File

@@ -46,7 +46,7 @@ public class JsonReaderTests {
List<Document> documents = jsonReader.get();
assertThat(documents).isNotEmpty();
for (Document document : documents) {
assertThat(document.getContent()).isNotEmpty();
assertThat(document.getText()).isNotEmpty();
}
}
@@ -57,7 +57,7 @@ public class JsonReaderTests {
List<Document> documents = jsonReader.get();
assertThat(documents).isNotEmpty();
for (Document document : documents) {
assertThat(document.getContent()).isNotEmpty();
assertThat(document.getText()).isNotEmpty();
}
}
@@ -68,8 +68,8 @@ public class JsonReaderTests {
List<Document> documents = jsonReader.get("/0/sessions");
assertThat(documents).isNotEmpty();
for (Document document : documents) {
assertThat(document.getContent()).isNotEmpty();
assertThat(document.getContent()).contains("Session");
assertThat(document.getText()).isNotEmpty();
assertThat(document.getText()).contains("Session");
}
}
@@ -80,7 +80,7 @@ public class JsonReaderTests {
List<Document> documents = jsonReader.get("/store");
assertThat(documents).isNotEmpty();
assertThat(documents.size()).isEqualTo(1);
assertThat(documents.get(0).getContent()).contains("name: Bike Shop");
assertThat(documents.get(0).getText()).contains("name: Bike Shop");
}
}

View File

@@ -52,7 +52,7 @@ public class TextReaderTests {
assertThat(document.getMetadata().get("customKey")).isEqualTo("Value");
assertThat(document.getMetadata().get(TextReader.SOURCE_METADATA)).isEqualTo("text_source.txt");
assertThat(document.getMetadata().get(TextReader.CHARSET_METADATA)).isEqualTo("UTF-8");
assertThat(document.getContent()).isNotEmpty();
assertThat(document.getText()).isNotEmpty();
}
}
@@ -76,7 +76,7 @@ public class TextReaderTests {
assertThat(defaultDocument.getMetadata().get(TextReader.SOURCE_METADATA))
.isEqualTo("Byte array resource [resource loaded from byte array]");
assertThat(defaultDocument.getContent()).isEqualTo("Test content");
assertThat(defaultDocument.getText()).isEqualTo("Test content");
// Test with custom description constructor
String customDescription = "Custom byte array resource";
@@ -98,7 +98,7 @@ public class TextReaderTests {
assertThat(customDocument.getMetadata().get(TextReader.SOURCE_METADATA))
.isEqualTo("Byte array resource [Custom byte array resource]");
assertThat(customDocument.getContent()).isEqualTo("Another test content");
assertThat(customDocument.getText()).isEqualTo("Another test content");
}
}

View File

@@ -73,13 +73,13 @@ public class TextSplitterTests {
assertThat(chunks).hasSize(4);
// Doc1 chunks:
assertThat(chunks.get(0).getContent()).isEqualTo("In the end, writing arises when man");
assertThat(chunks.get(1).getContent()).isEqualTo(" realizes that memory is not enough.");
assertThat(chunks.get(0).getText()).isEqualTo("In the end, writing arises when man");
assertThat(chunks.get(1).getText()).isEqualTo(" realizes that memory is not enough.");
// Doc2 chunks:
assertThat(chunks.get(2).getContent())
assertThat(chunks.get(2).getText())
.isEqualTo("The most oppressive thing about the labyrinth is that you are constantly being forced to ");
assertThat(chunks.get(3).getContent())
assertThat(chunks.get(3).getText())
.isEqualTo("choose. It isnt the lack of an exit, but the abundance of exits that is so disorienting.");
// Verify that the same, merged metadata is copied to all chunks.
@@ -233,8 +233,8 @@ public class TextSplitterTests {
assertThat(chunks).hasSize(2);
// Doc chunks:
assertThat(chunks.get(0).getContent()).isEqualTo("In the end, writing arises when man");
assertThat(chunks.get(1).getContent()).isEqualTo(" realizes that memory is not enough.");
assertThat(chunks.get(0).getText()).isEqualTo("In the end, writing arises when man");
assertThat(chunks.get(1).getText()).isEqualTo(" realizes that memory is not enough.");
// Verify that the same, merged metadata is copied to all chunks.
assertThat(chunks.get(0).getMetadata()).isEqualTo(chunks.get(1).getMetadata());

View File

@@ -55,10 +55,10 @@ public class TokenTextSplitterTest {
assertThat(chunks.size()).isEqualTo(2);
// Doc 1
assertThat(chunks.get(0).getContent())
assertThat(chunks.get(0).getText())
.isEqualTo("In the end, writing arises when man realizes that memory is not enough.");
// Doc 2
assertThat(chunks.get(1).getContent()).isEqualTo(
assertThat(chunks.get(1).getText()).isEqualTo(
"The most oppressive thing about the labyrinth is that you are constantly being forced to choose. It isnt the lack of an exit, but the abundance of exits that is so disorienting.");
assertThat(chunks.get(0).getMetadata()).containsKeys("key1", "key2").doesNotContainKeys("key3");
@@ -95,14 +95,14 @@ public class TokenTextSplitterTest {
assertThat(chunks.size()).isEqualTo(6);
// Doc 1
assertThat(chunks.get(0).getContent()).isEqualTo("In the end, writing arises when man realizes that");
assertThat(chunks.get(1).getContent()).isEqualTo("memory is not enough.");
assertThat(chunks.get(0).getText()).isEqualTo("In the end, writing arises when man realizes that");
assertThat(chunks.get(1).getText()).isEqualTo("memory is not enough.");
// Doc 2
assertThat(chunks.get(2).getContent()).isEqualTo("The most oppressive thing about the labyrinth is that you");
assertThat(chunks.get(3).getContent()).isEqualTo("are constantly being forced to choose.");
assertThat(chunks.get(4).getContent()).isEqualTo("It isnt the lack of an exit, but");
assertThat(chunks.get(5).getContent()).isEqualTo("the abundance of exits that is so disorienting");
assertThat(chunks.get(2).getText()).isEqualTo("The most oppressive thing about the labyrinth is that you");
assertThat(chunks.get(3).getText()).isEqualTo("are constantly being forced to choose.");
assertThat(chunks.get(4).getText()).isEqualTo("It isnt the lack of an exit, but");
assertThat(chunks.get(5).getText()).isEqualTo("the abundance of exits that is so disorienting");
// Verify that the same, merged metadata is copied to all chunks.
assertThat(chunks.get(0).getMetadata()).isEqualTo(chunks.get(1).getMetadata());

View File

@@ -42,7 +42,7 @@ public class SimpleVectorStoreSimilarityTests {
Document document = storeContent.toDocument(0.6);
assertThat(document).isNotNull();
assertThat(document.getId()).isEqualTo("1");
assertThat(document.getContent()).isEqualTo("hello, how are you?");
assertThat(document.getText()).isEqualTo("hello, how are you?");
assertThat(document.getMetadata().get("foo")).isEqualTo("bar");
}

View File

@@ -69,7 +69,7 @@ class SimpleVectorStoreTests {
List<Document> results = this.vectorStore.similaritySearch("test content");
assertThat(results).hasSize(1).first().satisfies(result -> {
assertThat(result.getId()).isEqualTo("1");
assertThat(result.getContent()).isEqualTo("test content");
assertThat(result.getText()).isEqualTo("test content");
assertThat(result.getMetadata()).containsEntry("key", "value");
});
}
@@ -150,7 +150,7 @@ class SimpleVectorStoreTests {
List<Document> results = loadedStore.similaritySearch("test content");
assertThat(results).hasSize(1).first().satisfies(result -> {
assertThat(result.getId()).isEqualTo("1");
assertThat(result.getContent()).isEqualTo("test content");
assertThat(result.getText()).isEqualTo("test content");
assertThat(result.getMetadata()).containsEntry("key", "value");
});
}
@@ -208,7 +208,7 @@ class SimpleVectorStoreTests {
assertThat(resultIds).containsExactlyInAnyOrderElementsOf(expectedIds);
// Verify content integrity
results.forEach(doc -> assertThat(doc.getContent()).isEqualTo("content " + doc.getId()));
results.forEach(doc -> assertThat(doc.getText()).isEqualTo("content " + doc.getId()));
}
@Test

View File

@@ -95,7 +95,7 @@ public class SimpleVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -112,7 +112,7 @@ public class SimpleVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());

View File

@@ -123,7 +123,7 @@ public class AzureVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKeys("spring", "distance");

View File

@@ -92,7 +92,7 @@ class CassandraVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertObservationRegistry(observationRegistry, VectorStoreProvider.CASSANDRA,

View File

@@ -100,7 +100,7 @@ class ElasticsearchVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey("distance");

View File

@@ -167,7 +167,7 @@ class GemFireVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKeys("spring", "distance");

View File

@@ -89,7 +89,7 @@ public class MilvusVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKeys("spring", "distance");
@@ -141,7 +141,7 @@ public class MilvusVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKeys("spring", "distance");

View File

@@ -107,7 +107,7 @@ class MongoDBAtlasVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).isEqualTo(
assertThat(resultDoc.getText()).isEqualTo(
"Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression");
assertThat(resultDoc.getMetadata()).containsEntry("meta2", "meta2");
@@ -143,7 +143,7 @@ class MongoDBAtlasVectorStoreAutoConfigurationIT {
List<Document> results = vectorStore
.similaritySearch(SearchRequest.builder().query("Testcontainers").topK(2).build());
assertThat(results).hasSize(2);
results.forEach(doc -> assertThat(doc.getContent().contains("Testcontainers")).isTrue());
results.forEach(doc -> assertThat(doc.getText().contains("Testcontainers")).isTrue());
FilterExpressionBuilder b = new FilterExpressionBuilder();
results = vectorStore.similaritySearch(SearchRequest.builder()
@@ -155,7 +155,7 @@ class MongoDBAtlasVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(3).getId());
assertThat(resultDoc.getContent().contains("Testcontainers")).isTrue();
assertThat(resultDoc.getText().contains("Testcontainers")).isTrue();
assertThat(resultDoc.getMetadata()).containsEntry("foo", "bar");
context.getBean(MongoTemplate.class).dropCollection("test_collection");

View File

@@ -95,7 +95,7 @@ public class Neo4jVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertObservationRegistry(observationRegistry, VectorStoreProvider.NEO4J,

View File

@@ -123,7 +123,7 @@ class AwsOpenSearchVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey("distance");

View File

@@ -123,7 +123,7 @@ class OpenSearchVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey("distance");

View File

@@ -109,7 +109,7 @@ public class PineconeVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKeys("spring", "customDistanceField");

View File

@@ -87,7 +87,7 @@ class RedisVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertObservationRegistry(observationRegistry, VectorStoreProvider.REDIS,

View File

@@ -93,7 +93,7 @@ public class TypesenseVectorStoreAutoConfigurationIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKeys("spring", "distance");

View File

@@ -71,7 +71,7 @@ class MilvusContainerConnectionDetailsFactoryIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent())
assertThat(resultDoc.getText())
.contains("Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKeys("spring", "distance");

View File

@@ -81,7 +81,7 @@ class MongoDbAtlasLocalContainerConnectionDetailsFactoryIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(documents.get(2).getId());
assertThat(resultDoc.getContent()).isEqualTo(
assertThat(resultDoc.getText()).isEqualTo(
"Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression");
assertThat(resultDoc.getMetadata()).containsEntry("meta2", "meta2");

View File

@@ -110,7 +110,7 @@ class AwsOpenSearchContainerConnectionDetailsFactoryIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey("distance");

View File

@@ -90,7 +90,7 @@ class OpenSearchContainerConnectionDetailsFactoryIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey("distance");

View File

@@ -76,7 +76,7 @@ class TypesenseContainerConnectionDetailsFactoryIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent())
assertThat(resultDoc.getText())
.contains("Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKeys("spring", "distance");

View File

@@ -103,7 +103,7 @@ public class AzureVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -241,7 +241,7 @@ public class AzureVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -254,7 +254,7 @@ public class AzureVectorStoreIT {
SearchRequest fooBarSearchRequest = SearchRequest.builder().query("FooBar").topK(5).build();
Awaitility.await()
.until(() -> vectorStore.similaritySearch(fooBarSearchRequest).get(0).getContent(),
.until(() -> vectorStore.similaritySearch(fooBarSearchRequest).get(0).getText(),
equalTo("The World is Big and Salvation Lurks Around the Corner"));
results = vectorStore.similaritySearch(fooBarSearchRequest);
@@ -262,7 +262,7 @@ public class AzureVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -305,7 +305,7 @@ public class AzureVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
assertThat(resultDoc.getScore()).isGreaterThanOrEqualTo(similarityThreshold);

View File

@@ -227,7 +227,7 @@ class CassandraRichSchemaVectorStoreIT {
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(documents.get(0).getId());
assertThat(resultDoc.getContent()).contains("Neptunes gravity makes its atmosphere");
assertThat(resultDoc.getText()).contains("Neptunes gravity makes its atmosphere");
assertThat(resultDoc.getMetadata()).hasSize(3);
@@ -490,7 +490,7 @@ class CassandraRichSchemaVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getContent()).contains(URANUS_ORBIT_QUERY);
assertThat(resultDoc.getText()).contains(URANUS_ORBIT_QUERY);
assertThat(resultDoc.getMetadata()).containsKey("revision");
String newContent = "The World is Big and Salvation Lurks Around the Corner";
@@ -523,7 +523,7 @@ class CassandraRichSchemaVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isNotEqualTo(sameIdDocument.getId());
assertThat(resultDoc.getContent()).doesNotContain(newContent);
assertThat(resultDoc.getText()).doesNotContain(newContent);
assertThat(resultDoc.getMetadata()).containsKeys("id", "revision", DocumentMetadata.DISTANCE.value());
}
@@ -555,7 +555,7 @@ class CassandraRichSchemaVectorStoreIT {
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(documents.get(1).getId());
assertThat(resultDoc.getContent()).contains(URANUS_ORBIT_QUERY);
assertThat(resultDoc.getText()).contains(URANUS_ORBIT_QUERY);
assertThat(resultDoc.getMetadata()).containsKeys("id", "revision", DocumentMetadata.DISTANCE.value());
assertThat(resultDoc.getScore()).isGreaterThanOrEqualTo(similarityThreshold);

View File

@@ -132,7 +132,7 @@ class CassandraVectorStoreIT {
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(documents().get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(2);
@@ -165,7 +165,7 @@ class CassandraVectorStoreIT {
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(documents().get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(1);
@@ -361,7 +361,7 @@ class CassandraVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
Document sameIdDocument = new Document(document.getId(),
@@ -375,7 +375,7 @@ class CassandraVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKeys("meta2", DocumentMetadata.DISTANCE.value());
store.delete(List.of(document.getId()));
@@ -408,7 +408,7 @@ class CassandraVectorStoreIT {
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(documents().get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", DocumentMetadata.DISTANCE.value());

View File

@@ -82,7 +82,7 @@ public class ChromaVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).isEqualTo(
assertThat(resultDoc.getText()).isEqualTo(
"Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression");
assertThat(resultDoc.getMetadata()).containsKeys("meta2", DocumentMetadata.DISTANCE.value());
@@ -114,7 +114,7 @@ public class ChromaVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The sky is blue because of Rayleigh scattering.");
assertThat(resultDoc.getText()).isEqualTo("The sky is blue because of Rayleigh scattering.");
// Remove all documents from the store
assertThat(vectorStore.delete(List.of(document.getId()))).isEqualTo(Optional.of(Boolean.TRUE));
@@ -188,7 +188,7 @@ public class ChromaVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -203,7 +203,7 @@ public class ChromaVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -237,7 +237,7 @@ public class ChromaVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).isEqualTo(
assertThat(resultDoc.getText()).isEqualTo(
"Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());

View File

@@ -235,7 +235,7 @@ public class CoherenceVectorStoreIT {
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", DocumentMetadata.DISTANCE.value());
Document sameIdDocument = new Document(document.getId(),
@@ -248,7 +248,7 @@ public class CoherenceVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKeys("meta2", DocumentMetadata.DISTANCE.value());
truncateMap(context, ((CoherenceVectorStore) vectorStore).getMapName());

View File

@@ -164,7 +164,7 @@ class ElasticsearchVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -316,7 +316,7 @@ class ElasticsearchVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -331,7 +331,7 @@ class ElasticsearchVectorStoreIT {
.build();
Awaitility.await()
.until(() -> vectorStore.similaritySearch(fooBarSearchRequest).get(0).getContent(),
.until(() -> vectorStore.similaritySearch(fooBarSearchRequest).get(0).getText(),
equalTo("The World is Big and Salvation Lurks Around the Corner"));
results = vectorStore.similaritySearch(fooBarSearchRequest);
@@ -339,7 +339,7 @@ class ElasticsearchVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -385,7 +385,7 @@ class ElasticsearchVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
assertThat(resultDoc.getScore()).isGreaterThanOrEqualTo(similarityThreshold);

View File

@@ -135,7 +135,7 @@ public class GemFireVectorStoreIT {
.similaritySearch(SearchRequest.builder().query("Great Depression").topK(5).build());
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939)" + " was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939)" + " was an economic shock");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -158,7 +158,7 @@ public class GemFireVectorStoreIT {
List<Document> results = vectorStore.similaritySearch(springSearchRequest);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -173,7 +173,7 @@ public class GemFireVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation" + " Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation" + " Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
});
@@ -209,7 +209,7 @@ public class GemFireVectorStoreIT {
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression " + "(19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression " + "(19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
assertThat(resultDoc.getScore()).isGreaterThanOrEqualTo(similarityThreshold);

View File

@@ -74,7 +74,7 @@ public class HanaCloudVectorStoreIT {
List<Document> results = vectorStore.similaritySearch("Who won the 2023 cricket world cup finals?");
Assertions.assertEquals(1, results.size());
Assertions.assertTrue(results.get(0).getContent().contains("Australia"));
Assertions.assertTrue(results.get(0).getText().contains("Australia"));
// Remove all documents from the store
vectorStore.delete(documents.stream().map(Document::getId).toList());

View File

@@ -299,7 +299,7 @@ public class MariaDBStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", "distance");
Document sameIdDocument = new Document(document.getId(),
@@ -313,7 +313,7 @@ public class MariaDBStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKeys("meta2", "distance");
dropTable(context);

View File

@@ -117,7 +117,7 @@ class MilvusVectorStoreCustomFieldNamesIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(String.valueOf(resultDoc.getId())).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", "distance");
@@ -158,7 +158,7 @@ class MilvusVectorStoreCustomFieldNamesIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(String.valueOf(resultDoc.getId())).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", "distance");
@@ -202,7 +202,7 @@ class MilvusVectorStoreCustomFieldNamesIT {
Document resultDoc = results.get(0);
// Verify that the auto ID is used
assertThat(String.valueOf(resultDoc.getId())).isNotEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", "distance");

View File

@@ -106,7 +106,7 @@ public class MilvusVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKeys("meta1", DocumentMetadata.DISTANCE.value());
@@ -211,7 +211,7 @@ public class MilvusVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -226,7 +226,7 @@ public class MilvusVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -266,7 +266,7 @@ public class MilvusVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", DocumentMetadata.DISTANCE.value());
assertThat(resultDoc.getScore()).isGreaterThanOrEqualTo(similarityThreshold);

View File

@@ -103,7 +103,7 @@ class MongoDBAtlasVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(documents.get(2).getId());
assertThat(resultDoc.getContent()).isEqualTo(
assertThat(resultDoc.getText()).isEqualTo(
"Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression");
assertThat(resultDoc.getMetadata()).containsEntry("meta2", "meta2");
@@ -134,7 +134,7 @@ class MongoDBAtlasVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsEntry("meta1", "meta1");
Document sameIdDocument = new Document(document.getId(),
@@ -148,7 +148,7 @@ class MongoDBAtlasVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsEntry("meta2", "meta2");
});
}
@@ -247,7 +247,7 @@ class MongoDBAtlasVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", DocumentMetadata.DISTANCE.value());
assertThat(resultDoc.getScore()).isGreaterThanOrEqualTo(similarityThreshold);

View File

@@ -92,7 +92,7 @@ class Neo4jVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).isEqualTo(
assertThat(resultDoc.getText()).isEqualTo(
"Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -221,7 +221,7 @@ class Neo4jVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -236,7 +236,7 @@ class Neo4jVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -267,7 +267,7 @@ class Neo4jVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).isEqualTo(
assertThat(resultDoc.getText()).isEqualTo(
"Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());

View File

@@ -144,7 +144,7 @@ class OpenSearchVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -300,7 +300,7 @@ class OpenSearchVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -311,7 +311,7 @@ class OpenSearchVectorStoreIT {
SearchRequest fooBarSearchRequest = SearchRequest.builder().query("FooBar").topK(5).build();
Awaitility.await()
.until(() -> vectorStore.similaritySearch(fooBarSearchRequest).get(0).getContent(),
.until(() -> vectorStore.similaritySearch(fooBarSearchRequest).get(0).getText(),
equalTo("The World is Big and Salvation Lurks Around the Corner"));
results = vectorStore.similaritySearch(fooBarSearchRequest);
@@ -319,7 +319,7 @@ class OpenSearchVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -368,7 +368,7 @@ class OpenSearchVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
assertThat(resultDoc.getScore()).isGreaterThanOrEqualTo(similarityThreshold);

View File

@@ -147,7 +147,7 @@ class OpenSearchVectorStoreWithOllamaIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey("distance");

View File

@@ -255,7 +255,7 @@ public class OracleVectorStoreIT {
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", DocumentMetadata.DISTANCE.value());
Document sameIdDocument = new Document(document.getId(),
@@ -268,7 +268,7 @@ public class OracleVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKeys("meta2", DocumentMetadata.DISTANCE.value());
dropTable(context, ((OracleVectorStore) vectorStore).getTableName());

View File

@@ -305,7 +305,7 @@ public class PgVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", DocumentMetadata.DISTANCE.value());
Document sameIdDocument = new Document(document.getId(),
@@ -319,7 +319,7 @@ public class PgVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKeys("meta2", DocumentMetadata.DISTANCE.value());
dropTable(context);

View File

@@ -110,7 +110,7 @@ public class PineconeVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -206,7 +206,7 @@ public class PineconeVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -219,7 +219,7 @@ public class PineconeVectorStoreIT {
SearchRequest fooBarSearchRequest = SearchRequest.builder().query("FooBar").topK(5).build();
Awaitility.await()
.until(() -> vectorStore.similaritySearch(fooBarSearchRequest).get(0).getContent(),
.until(() -> vectorStore.similaritySearch(fooBarSearchRequest).get(0).getText(),
equalTo("The World is Big and Salvation Lurks Around the Corner"));
results = vectorStore.similaritySearch(fooBarSearchRequest);
@@ -227,7 +227,7 @@ public class PineconeVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -270,7 +270,7 @@ public class PineconeVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getText()).contains("The Great Depression (19291939) was an economic shock");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
assertThat(resultDoc.getScore()).isGreaterThanOrEqualTo(similarityThreshold);

View File

@@ -107,7 +107,7 @@ public class QdrantVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).isEqualTo(
assertThat(resultDoc.getText()).isEqualTo(
"Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression");
assertThat(resultDoc.getMetadata()).containsKeys("meta2", DocumentMetadata.DISTANCE.value());
@@ -197,7 +197,7 @@ public class QdrantVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -212,7 +212,7 @@ public class QdrantVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -245,7 +245,7 @@ public class QdrantVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(2).getId());
assertThat(resultDoc.getContent()).isEqualTo(
assertThat(resultDoc.getText()).isEqualTo(
"Great Depression Great Depression Great Depression Great Depression Great Depression Great Depression");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());

View File

@@ -107,7 +107,7 @@ class RedisVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(3);
assertThat(resultDoc.getMetadata()).containsKeys("meta1", RedisVectorStore.DISTANCE_FIELD_NAME,
@@ -202,7 +202,7 @@ class RedisVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(RedisVectorStore.DISTANCE_FIELD_NAME);
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -218,7 +218,7 @@ class RedisVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(RedisVectorStore.DISTANCE_FIELD_NAME);
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -252,7 +252,7 @@ class RedisVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", RedisVectorStore.DISTANCE_FIELD_NAME,
DocumentMetadata.DISTANCE.value());

View File

@@ -97,7 +97,7 @@ public class TypesenseVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -115,7 +115,7 @@ public class TypesenseVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -235,7 +235,7 @@ public class TypesenseVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", DocumentMetadata.DISTANCE.value());
assertThat(resultDoc.getScore()).isGreaterThanOrEqualTo(similarityThreshold);

View File

@@ -100,7 +100,7 @@ public class WeaviateVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).hasSize(2);
assertThat(resultDoc.getMetadata()).containsKeys("meta1", DocumentMetadata.DISTANCE.value());
@@ -196,7 +196,7 @@ public class WeaviateVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getText()).isEqualTo("Spring AI rocks!!");
assertThat(resultDoc.getMetadata()).containsKey("meta1");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -211,7 +211,7 @@ public class WeaviateVectorStoreIT {
assertThat(results).hasSize(1);
resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(document.getId());
assertThat(resultDoc.getContent()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getText()).isEqualTo("The World is Big and Salvation Lurks Around the Corner");
assertThat(resultDoc.getMetadata()).containsKey("meta2");
assertThat(resultDoc.getMetadata()).containsKey(DocumentMetadata.DISTANCE.value());
@@ -246,7 +246,7 @@ public class WeaviateVectorStoreIT {
assertThat(results).hasSize(1);
Document resultDoc = results.get(0);
assertThat(resultDoc.getId()).isEqualTo(this.documents.get(0).getId());
assertThat(resultDoc.getContent()).contains(
assertThat(resultDoc.getText()).contains(
"Spring AI provides abstractions that serve as the foundation for developing AI applications.");
assertThat(resultDoc.getMetadata()).containsKeys("meta1", DocumentMetadata.DISTANCE.value());
assertThat(resultDoc.getScore()).isGreaterThanOrEqualTo(similarityThreshold);