Add vertexai text embeddings capability
This commit is contained in:
parent
4c7942d2e8
commit
8bf4269208
1 changed files with 11 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
import { ChatOpenAI, OpenAIEmbeddings } from '@langchain/openai';
|
import { ChatOpenAI, OpenAIEmbeddings } from '@langchain/openai';
|
||||||
import { ChatOllama } from '@langchain/community/chat_models/ollama';
|
import { ChatOllama } from '@langchain/community/chat_models/ollama';
|
||||||
import { VertexAI } from "@langchain/google-vertexai";
|
import { VertexAI } from "@langchain/google-vertexai";
|
||||||
|
import { GoogleVertexAIEmbeddings } from "@langchain/community/embeddings/googlevertexai";
|
||||||
import { OllamaEmbeddings } from '@langchain/community/embeddings/ollama';
|
import { OllamaEmbeddings } from '@langchain/community/embeddings/ollama';
|
||||||
import { HuggingFaceTransformersEmbeddings } from './huggingfaceTransformer';
|
import { HuggingFaceTransformersEmbeddings } from './huggingfaceTransformer';
|
||||||
import { hasGCPCredentials } from '../auth';
|
import { hasGCPCredentials } from '../auth';
|
||||||
|
@ -186,6 +187,16 @@ export const getAvailableEmbeddingModelProviders = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (await hasGCPCredentials()) {
|
||||||
|
try {
|
||||||
|
models['vertexai'] = {
|
||||||
|
'Text Gecko default': new GoogleVertexAIEmbeddings(),
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
logger.error(`Error loading VertexAI embeddings: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
models['local'] = {
|
models['local'] = {
|
||||||
'BGE Small': new HuggingFaceTransformersEmbeddings({
|
'BGE Small': new HuggingFaceTransformersEmbeddings({
|
||||||
|
|
Loading…
Add table
Reference in a new issue