Skip to content

Commit 7c7392e

Browse files
committed
Change EmbeddingOptions from class into interface
1 parent da12b56 commit 7c7392e

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

models/spring-ai-postgresml/src/main/java/org/springframework/ai/postgresml/PostgresMlEmbeddingClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public List<List<Double>> embed(List<String> texts) {
156156

157157
@Override
158158
public EmbeddingResponse embedForResponse(List<String> texts) {
159-
return this.call(new EmbeddingRequest(texts, new EmbeddingOptions()));
159+
return this.call(new EmbeddingRequest(texts, EmbeddingOptions.EMPTY));
160160
}
161161

162162
@Override

models/spring-ai-transformers/src/main/java/org/springframework/ai/transformers/TransformersEmbeddingClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public EmbeddingResponse embedForResponse(List<String> texts) {
214214

215215
@Override
216216
public List<List<Double>> embed(List<String> texts) {
217-
return this.call(new EmbeddingRequest(texts, new EmbeddingOptions()))
217+
return this.call(new EmbeddingRequest(texts, EmbeddingOptions.EMPTY))
218218
.getResults()
219219
.stream()
220220
.map(e -> e.getOutput())

spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ default List<Double> embed(String text) {
5050
*/
5151
default List<List<Double>> embed(List<String> texts) {
5252
Assert.notNull(texts, "Texts must not be null");
53-
return this.call(new EmbeddingRequest(texts, new EmbeddingOptions()))
53+
return this.call(new EmbeddingRequest(texts, EmbeddingOptions.EMPTY))
5454
.getResults()
5555
.stream()
5656
.map(Embedding::getOutput)
@@ -64,7 +64,7 @@ default List<List<Double>> embed(List<String> texts) {
6464
*/
6565
default EmbeddingResponse embedForResponse(List<String> texts) {
6666
Assert.notNull(texts, "Texts must not be null");
67-
return this.call(new EmbeddingRequest(texts, new EmbeddingOptions()));
67+
return this.call(new EmbeddingRequest(texts, EmbeddingOptions.EMPTY));
6868
}
6969

7070
/**

spring-ai-core/src/main/java/org/springframework/ai/embedding/EmbeddingOptions.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
/**
2222
* @author Christian Tzolov
2323
*/
24-
public class EmbeddingOptions implements ModelOptions {
24+
public interface EmbeddingOptions extends ModelOptions {
25+
26+
public static EmbeddingOptions EMPTY = new EmbeddingOptions() {
27+
};
2528

2629
}

0 commit comments

Comments
 (0)