Change EmbeddingOptions from class into interface
This commit is contained in:
@@ -156,7 +156,7 @@ public class PostgresMlEmbeddingClient extends AbstractEmbeddingClient implement
|
||||
|
||||
@Override
|
||||
public EmbeddingResponse embedForResponse(List<String> texts) {
|
||||
return this.call(new EmbeddingRequest(texts, new EmbeddingOptions()));
|
||||
return this.call(new EmbeddingRequest(texts, EmbeddingOptions.EMPTY));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -214,7 +214,7 @@ public class TransformersEmbeddingClient extends AbstractEmbeddingClient impleme
|
||||
|
||||
@Override
|
||||
public List<List<Double>> embed(List<String> texts) {
|
||||
return this.call(new EmbeddingRequest(texts, new EmbeddingOptions()))
|
||||
return this.call(new EmbeddingRequest(texts, EmbeddingOptions.EMPTY))
|
||||
.getResults()
|
||||
.stream()
|
||||
.map(e -> e.getOutput())
|
||||
|
||||
@@ -50,7 +50,7 @@ public interface EmbeddingClient extends ModelClient<EmbeddingRequest, Embedding
|
||||
*/
|
||||
default List<List<Double>> embed(List<String> texts) {
|
||||
Assert.notNull(texts, "Texts must not be null");
|
||||
return this.call(new EmbeddingRequest(texts, new EmbeddingOptions()))
|
||||
return this.call(new EmbeddingRequest(texts, EmbeddingOptions.EMPTY))
|
||||
.getResults()
|
||||
.stream()
|
||||
.map(Embedding::getOutput)
|
||||
@@ -64,7 +64,7 @@ public interface EmbeddingClient extends ModelClient<EmbeddingRequest, Embedding
|
||||
*/
|
||||
default EmbeddingResponse embedForResponse(List<String> texts) {
|
||||
Assert.notNull(texts, "Texts must not be null");
|
||||
return this.call(new EmbeddingRequest(texts, new EmbeddingOptions()));
|
||||
return this.call(new EmbeddingRequest(texts, EmbeddingOptions.EMPTY));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,9 @@ import org.springframework.ai.model.ModelOptions;
|
||||
/**
|
||||
* @author Christian Tzolov
|
||||
*/
|
||||
public class EmbeddingOptions implements ModelOptions {
|
||||
public interface EmbeddingOptions extends ModelOptions {
|
||||
|
||||
public static EmbeddingOptions EMPTY = new EmbeddingOptions() {
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user