mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-17 15:28:37 +00:00
Add vertexai text embeddings capability
This commit is contained in:
@ -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({
|
||||||
|
Reference in New Issue
Block a user