Skip to content

Commit e3d4e06

Browse files
committed
feat(google-aistudio): set task type to RETRIEVAL_QUERY or RETRIEVAL_DOCUMENT based on context.forQueries()
1 parent c4a0d8f commit e3d4e06

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

google-aistudio/src/main/java/dev/bluetree242/saaiaddons/aistudio/GoogleAiStudioEmbeddingProvider.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ public class GoogleAiStudioEmbeddingProvider implements EmbeddingModelProvider<G
2727
.apiKey(apiKey)
2828
.modelName(model)
2929
.timeout(Duration.ofSeconds(options.getLong("timeout")))
30+
.taskType(context.forQueries() ? GoogleAiEmbeddingModel.TaskType.RETRIEVAL_QUERY : GoogleAiEmbeddingModel.TaskType.RETRIEVAL_DOCUMENT)
3031
.build();
3132
}
3233

34+
@Override
35+
public boolean supportsQueryOptimization() {
36+
return true;
37+
}
38+
3339
@NotNull
3440
@Override
3541
public Map<String, Object> getDefaultOptions() {
@@ -44,4 +50,4 @@ public Map<String, Object> getDefaultOptions() {
4450
public String getDisplayName(@Nullable EmbeddingContext context) {
4551
return "Google AI Studio";
4652
}
47-
}
53+
}

0 commit comments

Comments
 (0)