Skip to content

Commit 0d8e5fc

Browse files
authored
Merge branch 'main' into GH-1856-fix-pgvector-id-column
2 parents 6131aed + 224191a commit 0d8e5fc

File tree

307 files changed

+6262
-10415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

307 files changed

+6262
-10415
lines changed

document-readers/markdown-reader/src/test/java/org/springframework/ai/reader/markdown/MarkdownDocumentReaderTest.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ void testDocumentNotDividedViaHorizontalRulesWhenIsDisabled() {
105105

106106
Document documentsFirst = documents.get(0);
107107
assertThat(documentsFirst.getMetadata()).isEmpty();
108-
assertThat(documentsFirst.getContent()).startsWith("Lorem ipsum dolor sit amet, consectetur adipiscing elit")
108+
assertThat(documentsFirst.getText()).startsWith("Lorem ipsum dolor sit amet, consectetur adipiscing elit")
109109
.endsWith("Phasellus eget tellus sed nibh ornare interdum eu eu mi.");
110110
}
111111

@@ -119,7 +119,7 @@ void testSimpleMarkdownDocumentWithHardAndSoftLineBreaks() {
119119

120120
Document documentsFirst = documents.get(0);
121121
assertThat(documentsFirst.getMetadata()).isEmpty();
122-
assertThat(documentsFirst.getContent()).isEqualTo(
122+
assertThat(documentsFirst.getText()).isEqualTo(
123123
"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.");
124124
}
125125

@@ -135,22 +135,22 @@ void testCode() {
135135

136136
assertThat(documents).satisfiesExactly(document -> {
137137
assertThat(document.getMetadata()).isEqualTo(Map.of());
138-
assertThat(document.getContent()).isEqualTo("This is a Java sample application:");
138+
assertThat(document.getText()).isEqualTo("This is a Java sample application:");
139139
}, document -> {
140140
assertThat(document.getMetadata()).isEqualTo(Map.of("lang", "java", "category", "code_block"));
141-
assertThat(document.getContent()).startsWith("package com.example.demo;")
141+
assertThat(document.getText()).startsWith("package com.example.demo;")
142142
.contains("SpringApplication.run(DemoApplication.class, args);");
143143
}, document -> {
144144
assertThat(document.getMetadata()).isEqualTo(Map.of("category", "code_inline"));
145-
assertThat(document.getContent()).isEqualTo(
145+
assertThat(document.getText()).isEqualTo(
146146
"Markdown also provides the possibility to use inline code formatting throughout the entire sentence.");
147147
}, document -> {
148148
assertThat(document.getMetadata()).isEqualTo(Map.of());
149-
assertThat(document.getContent())
149+
assertThat(document.getText())
150150
.isEqualTo("Another possibility is to set block code without specific highlighting:");
151151
}, document -> {
152152
assertThat(document.getMetadata()).isEqualTo(Map.of("lang", "", "category", "code_block"));
153-
assertThat(document.getContent()).isEqualTo("./mvnw spring-javaformat:apply\n");
153+
assertThat(document.getText()).isEqualTo("./mvnw spring-javaformat:apply\n");
154154
});
155155
}
156156

@@ -167,15 +167,15 @@ void testCodeWhenCodeBlockShouldNotBeSeparatedDocument() {
167167

168168
assertThat(documents).satisfiesExactly(document -> {
169169
assertThat(document.getMetadata()).isEqualTo(Map.of("lang", "java", "category", "code_block"));
170-
assertThat(document.getContent()).startsWith("This is a Java sample application: package com.example.demo")
170+
assertThat(document.getText()).startsWith("This is a Java sample application: package com.example.demo")
171171
.contains("SpringApplication.run(DemoApplication.class, args);");
172172
}, document -> {
173173
assertThat(document.getMetadata()).isEqualTo(Map.of("category", "code_inline"));
174-
assertThat(document.getContent()).isEqualTo(
174+
assertThat(document.getText()).isEqualTo(
175175
"Markdown also provides the possibility to use inline code formatting throughout the entire sentence.");
176176
}, document -> {
177177
assertThat(document.getMetadata()).isEqualTo(Map.of("lang", "", "category", "code_block"));
178-
assertThat(document.getContent()).isEqualTo(
178+
assertThat(document.getText()).isEqualTo(
179179
"Another possibility is to set block code without specific highlighting: ./mvnw spring-javaformat:apply\n");
180180
});
181181
}
@@ -208,7 +208,7 @@ void testBlockquoteWhenBlockquoteShouldNotBeSeparatedDocument() {
208208

209209
Document documentsFirst = documents.get(0);
210210
assertThat(documentsFirst.getMetadata()).isEqualTo(Map.of("category", "blockquote"));
211-
assertThat(documentsFirst.getContent()).isEqualTo(
211+
assertThat(documentsFirst.getText()).isEqualTo(
212212
"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.");
213213
}
214214

@@ -241,7 +241,7 @@ void testWithAdditionalMetadata() {
241241

242242
Document documentsFirst = documents.get(0);
243243
assertThat(documentsFirst.getMetadata()).isEqualTo(Map.of("service", "some-service-name", "env", "prod"));
244-
assertThat(documentsFirst.getContent()).startsWith("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
244+
assertThat(documentsFirst.getText()).startsWith("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
245245
}
246246

247247
}

document-readers/pdf-reader/src/main/java/org/springframework/ai/reader/pdf/ParagraphPdfDocumentReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public List<Document> get() {
145145
while (itr.hasNext()) {
146146
var next = itr.next();
147147
Document document = toDocument(current, next);
148-
if (document != null && StringUtils.hasText(document.getContent())) {
148+
if (document != null && StringUtils.hasText(document.getText())) {
149149
documents.add(toDocument(current, next));
150150
}
151151
current = next;

document-readers/tika-reader/src/test/java/org/springframework/ai/reader/tika/TikaDocumentReaderTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void testDocx(String resourceUri, String resourceName, String contentSnip
4343

4444
assertThat(doc.getMetadata()).containsKeys(TikaDocumentReader.METADATA_SOURCE);
4545
assertThat(doc.getMetadata().get(TikaDocumentReader.METADATA_SOURCE)).isEqualTo(resourceName);
46-
assertThat(doc.getContent()).contains(contentSnipped);
46+
assertThat(doc.getText()).contains(contentSnipped);
4747
}
4848

4949
}

models/spring-ai-anthropic/src/main/java/org/springframework/ai/anthropic/AnthropicChatOptions.java

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -300,110 +300,6 @@ public Builder toolContext(Map<String, Object> toolContext) {
300300
return this;
301301
}
302302

303-
/**
304-
* @deprecated use {@link #model(String)} instead.
305-
*/
306-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
307-
public Builder withModel(String model) {
308-
return model(model);
309-
}
310-
311-
/**
312-
* @deprecated use {@link #model(AnthropicApi.ChatModel)} instead.
313-
*/
314-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
315-
public Builder withModel(AnthropicApi.ChatModel model) {
316-
return model(model);
317-
}
318-
319-
/**
320-
* @deprecated use {@link #maxTokens(Integer)} instead.
321-
*/
322-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
323-
public Builder withMaxTokens(Integer maxTokens) {
324-
return maxTokens(maxTokens);
325-
}
326-
327-
/**
328-
* @deprecated use {@link #metadata(ChatCompletionRequest.Metadata)} instead.
329-
*/
330-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
331-
public Builder withMetadata(ChatCompletionRequest.Metadata metadata) {
332-
return metadata(metadata);
333-
}
334-
335-
/**
336-
* @deprecated use {@link #stopSequences(List)} instead.
337-
*/
338-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
339-
public Builder withStopSequences(List<String> stopSequences) {
340-
return stopSequences(stopSequences);
341-
}
342-
343-
/**
344-
* @deprecated use {@link #temperature(Double)} instead.
345-
*/
346-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
347-
public Builder withTemperature(Double temperature) {
348-
return temperature(temperature);
349-
}
350-
351-
/**
352-
* @deprecated use {@link #topP(Double)} instead.
353-
*/
354-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
355-
public Builder withTopP(Double topP) {
356-
return topP(topP);
357-
}
358-
359-
/**
360-
* @deprecated use {@link #topK(Integer)} instead.
361-
*/
362-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
363-
public Builder withTopK(Integer topK) {
364-
return topK(topK);
365-
}
366-
367-
/**
368-
* @deprecated use {@link #functionCallbacks(List)} instead.
369-
*/
370-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
371-
public Builder withFunctionCallbacks(List<FunctionCallback> functionCallbacks) {
372-
return functionCallbacks(functionCallbacks);
373-
}
374-
375-
/**
376-
* @deprecated use {@link #functions(Set)} instead.
377-
*/
378-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
379-
public Builder withFunctions(Set<String> functionNames) {
380-
return functions(functionNames);
381-
}
382-
383-
/**
384-
* @deprecated use {@link #function(String)} instead.
385-
*/
386-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
387-
public Builder withFunction(String functionName) {
388-
return function(functionName);
389-
}
390-
391-
/**
392-
* @deprecated use {@link #proxyToolCalls(Boolean)} instead.
393-
*/
394-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
395-
public Builder withProxyToolCalls(Boolean proxyToolCalls) {
396-
return proxyToolCalls(proxyToolCalls);
397-
}
398-
399-
/**
400-
* @deprecated use {@link #toolContext(Map)} instead.
401-
*/
402-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
403-
public Builder withToolContext(Map<String, Object> toolContext) {
404-
return toolContext(toolContext);
405-
}
406-
407303
public AnthropicChatOptions build() {
408304
return this.options;
409305
}

models/spring-ai-azure-openai/src/main/java/org/springframework/ai/azure/openai/AzureOpenAiAudioTranscriptionOptions.java

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -302,69 +302,6 @@ public Builder granularityType(List<GranularityType> granularityType) {
302302
return this;
303303
}
304304

305-
/**
306-
* @deprecated use {@link #model(String)} instead.
307-
*/
308-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
309-
public Builder withModel(String model) {
310-
this.options.model = model;
311-
return this;
312-
}
313-
314-
/**
315-
* @deprecated use {@link #deploymentName(String)} instead.
316-
*/
317-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
318-
public Builder withDeploymentName(String deploymentName) {
319-
this.options.setDeploymentName(deploymentName);
320-
return this;
321-
}
322-
323-
/**
324-
* @deprecated use {@link #language(String)} instead.
325-
*/
326-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
327-
public Builder withLanguage(String language) {
328-
this.options.language = language;
329-
return this;
330-
}
331-
332-
/**
333-
* @deprecated use {@link #prompt(String)} instead.
334-
*/
335-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
336-
public Builder withPrompt(String prompt) {
337-
this.options.prompt = prompt;
338-
return this;
339-
}
340-
341-
/**
342-
* @deprecated use {@link #responseFormat(TranscriptResponseFormat)} instead.
343-
*/
344-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
345-
public Builder withResponseFormat(TranscriptResponseFormat responseFormat) {
346-
this.options.responseFormat = responseFormat;
347-
return this;
348-
}
349-
350-
/**
351-
* @deprecated use {@link #temperature(Float)} instead.
352-
*/
353-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
354-
public Builder withTemperature(Float temperature) {
355-
this.options.temperature = temperature;
356-
return this;
357-
}
358-
359-
/**
360-
* @deprecated use {@link #granularityType(List)} instead.
361-
*/
362-
@Deprecated(forRemoval = true, since = "1.0.0-M5")
363-
public Builder withGranularityType(List<GranularityType> granularityType) {
364-
this.options.granularityType = granularityType;
365-
return this;
366-
}
367-
368305
public AzureOpenAiAudioTranscriptionOptions build() {
369306
Assert.hasText(this.options.model, "model must not be empty");
370307
Assert.notNull(this.options.responseFormat, "response_format must not be null");

models/spring-ai-azure-openai/src/main/java/org/springframework/ai/azure/openai/AzureOpenAiChatModel.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,7 @@ private ChatGenerationMetadata generateChoiceMetadata(ChatChoice choice) {
565565
return ChatGenerationMetadata.builder()
566566
.finishReason(String.valueOf(choice.getFinishReason()))
567567
.metadata("contentFilterResults", choice.getContentFilterResults())
568+
.metadata("logprobs", choice.getLogprobs())
568569
.build();
569570
}
570571

0 commit comments

Comments
 (0)