diff --git a/libs/langchain-google-common/src/embeddings.ts b/libs/langchain-google-common/src/embeddings.ts index d1e2549c631a..d3b7b8a2e2ab 100644 --- a/libs/langchain-google-common/src/embeddings.ts +++ b/libs/langchain-google-common/src/embeddings.ts @@ -38,6 +38,11 @@ class EmbeddingsConnection< return "predict"; } + get modelPublisher(): string { + // All the embedding models are currently published by "google" + return "google"; + } + async formatData( input: GoogleEmbeddingsInstance[], parameters: GoogleAIModelRequestParams diff --git a/libs/langchain-google-vertexai/src/tests/embeddings.int.test.ts b/libs/langchain-google-vertexai/src/tests/embeddings.int.test.ts index 5bf57a82b24b..72634c669a2e 100644 --- a/libs/langchain-google-vertexai/src/tests/embeddings.int.test.ts +++ b/libs/langchain-google-vertexai/src/tests/embeddings.int.test.ts @@ -9,21 +9,32 @@ test("Test VertexAIEmbeddings.embedQuery", async () => { expect(typeof res[0]).toBe("number"); }); -test("Test VertexAIEmbeddings.embedDocuments", async () => { - const embeddings = new VertexAIEmbeddings({ - model: "text-embedding-004", - }); - const res = await embeddings.embedDocuments([ - "Hello world", - "Bye bye", - "we need", - "at least", - "six documents", - "to test pagination", - ]); - // console.log(res); - expect(res).toHaveLength(6); - res.forEach((r) => { - expect(typeof r[0]).toBe("number"); - }); -}); +const testModelsLocations = [ + ["text-embedding-005", "us-central1"], + ["text-multilingual-embedding-002", "us-central1"], + ["text-embedding-005", "europe-west9"], + ["text-multilingual-embedding-002", "europe-west9"], +]; + +test.each(testModelsLocations)( + "VertexAIEmbeddings.embedDocuments %s %s", + async (model, location) => { + const embeddings = new VertexAIEmbeddings({ + model, + location, + }); + const res = await embeddings.embedDocuments([ + "Hello world", + "Bye bye", + "we need", + "at least", + "six documents", + "to test pagination", + ]); + // console.log(res); + expect(res).toHaveLength(6); + res.forEach((r) => { + expect(typeof r[0]).toBe("number"); + }); + } +);