mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-18 16:27:13 +00:00
(improvement)(common) Upgraded langchain4j to version 0.31. (#1174)
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package dev.langchain4j.model.embedding;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class EmbeddingModelConfig {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public EmbeddingModel embeddingModel() {
|
||||
return new BgeSmallZhEmbeddingModel();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
package dev.langchain4j.model.embedding;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* An embedding model that runs within your Java application's process.
|
||||
@@ -51,7 +52,7 @@ public class S2OnnxEmbeddingModel extends AbstractInProcessEmbeddingModel {
|
||||
try {
|
||||
return new OnnxBertBiEncoder(
|
||||
Files.newInputStream(pathToModel),
|
||||
vocabularyFile,
|
||||
vocabularyFile.openStream(),
|
||||
PoolingMode.MEAN
|
||||
);
|
||||
} catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user