Skip to content

Commit

Permalink
Merge branch 'main' into GH-1856-fix-pgvector-id-column
Browse files Browse the repository at this point in the history
  • Loading branch information
jitokim authored Jan 24, 2025
2 parents 6131aed + 224191a commit 0d8e5fc
Show file tree
Hide file tree
Showing 307 changed files with 6,262 additions and 10,415 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void testDocumentNotDividedViaHorizontalRulesWhenIsDisabled() {

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.");
}

Expand All @@ -119,7 +119,7 @@ void testSimpleMarkdownDocumentWithHardAndSoftLineBreaks() {

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.");
}

Expand All @@ -135,22 +135,22 @@ void testCode() {

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");
});
}

Expand All @@ -167,15 +167,15 @@ void testCodeWhenCodeBlockShouldNotBeSeparatedDocument() {

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");
});
}
Expand Down Expand Up @@ -208,7 +208,7 @@ void testBlockquoteWhenBlockquoteShouldNotBeSeparatedDocument() {

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.");
}

Expand Down Expand Up @@ -241,7 +241,7 @@ void testWithAdditionalMetadata() {

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.");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public List<Document> get() {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void testDocx(String resourceUri, String resourceName, String contentSnip

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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -300,110 +300,6 @@ public Builder toolContext(Map<String, Object> toolContext) {
return this;
}

/**
* @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 #model(AnthropicApi.ChatModel)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withModel(AnthropicApi.ChatModel model) {
return model(model);
}

/**
* @deprecated use {@link #maxTokens(Integer)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withMaxTokens(Integer maxTokens) {
return maxTokens(maxTokens);
}

/**
* @deprecated use {@link #metadata(ChatCompletionRequest.Metadata)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withMetadata(ChatCompletionRequest.Metadata metadata) {
return metadata(metadata);
}

/**
* @deprecated use {@link #stopSequences(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withStopSequences(List<String> stopSequences) {
return stopSequences(stopSequences);
}

/**
* @deprecated use {@link #temperature(Double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withTemperature(Double temperature) {
return temperature(temperature);
}

/**
* @deprecated use {@link #topP(Double)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withTopP(Double topP) {
return topP(topP);
}

/**
* @deprecated use {@link #topK(Integer)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withTopK(Integer topK) {
return topK(topK);
}

/**
* @deprecated use {@link #functionCallbacks(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withFunctionCallbacks(List<FunctionCallback> functionCallbacks) {
return functionCallbacks(functionCallbacks);
}

/**
* @deprecated use {@link #functions(Set)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withFunctions(Set<String> functionNames) {
return functions(functionNames);
}

/**
* @deprecated use {@link #function(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withFunction(String functionName) {
return function(functionName);
}

/**
* @deprecated use {@link #proxyToolCalls(Boolean)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withProxyToolCalls(Boolean proxyToolCalls) {
return proxyToolCalls(proxyToolCalls);
}

/**
* @deprecated use {@link #toolContext(Map)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withToolContext(Map<String, Object> toolContext) {
return toolContext(toolContext);
}

public AnthropicChatOptions build() {
return this.options;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,69 +302,6 @@ public Builder granularityType(List<GranularityType> granularityType) {
return this;
}

/**
* @deprecated use {@link #model(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withModel(String model) {
this.options.model = model;
return this;
}

/**
* @deprecated use {@link #deploymentName(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withDeploymentName(String deploymentName) {
this.options.setDeploymentName(deploymentName);
return this;
}

/**
* @deprecated use {@link #language(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withLanguage(String language) {
this.options.language = language;
return this;
}

/**
* @deprecated use {@link #prompt(String)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withPrompt(String prompt) {
this.options.prompt = prompt;
return this;
}

/**
* @deprecated use {@link #responseFormat(TranscriptResponseFormat)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withResponseFormat(TranscriptResponseFormat responseFormat) {
this.options.responseFormat = responseFormat;
return this;
}

/**
* @deprecated use {@link #temperature(Float)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withTemperature(Float temperature) {
this.options.temperature = temperature;
return this;
}

/**
* @deprecated use {@link #granularityType(List)} instead.
*/
@Deprecated(forRemoval = true, since = "1.0.0-M5")
public Builder withGranularityType(List<GranularityType> granularityType) {
this.options.granularityType = granularityType;
return this;
}

public AzureOpenAiAudioTranscriptionOptions build() {
Assert.hasText(this.options.model, "model must not be empty");
Assert.notNull(this.options.responseFormat, "response_format must not be null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ private ChatGenerationMetadata generateChoiceMetadata(ChatChoice choice) {
return ChatGenerationMetadata.builder()
.finishReason(String.valueOf(choice.getFinishReason()))
.metadata("contentFilterResults", choice.getContentFilterResults())
.metadata("logprobs", choice.getLogprobs())
.build();
}

Expand Down
Loading

0 comments on commit 0d8e5fc

Please sign in to comment.