Skip to content

Commit 5f0097b

Browse files
speedstorm1copybara-github
authored andcommitted
chore: add unified content wrapping for multimodal gemini embeddings (gemini-embedding-2) for Gemini API
PiperOrigin-RevId: 889923492
1 parent 89552ba commit 5f0097b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/models.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ export class Models extends BaseModule {
4747
params: types.EmbedContentParameters,
4848
): Promise<types.EmbedContentResponse> => {
4949
if (!this.apiClient.isVertexAI()) {
50+
const isGeminiEmbedding2Model =
51+
params.model.includes('gemini-embedding-2');
52+
if (isGeminiEmbedding2Model) {
53+
params.contents = tContents(params.contents);
54+
}
5055
return await this.embedContentInternal(params);
5156
}
5257
const isVertexEmbedContentModel =

0 commit comments

Comments
 (0)