mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-27 20:42:52 +00:00
23 lines
609 B
Python
23 lines
609 B
Python
# coding=utf-8
|
||
"""
|
||
@project: MaxKB
|
||
@Author:虎
|
||
@file: embedding.py
|
||
@date:2024/7/12 17:44
|
||
@desc:
|
||
"""
|
||
from typing import Dict
|
||
|
||
from langchain_google_genai import GoogleGenerativeAIEmbeddings
|
||
|
||
from models_provider.base_model_provider import MaxKBBaseModel
|
||
|
||
|
||
class GeminiEmbeddingModel(MaxKBBaseModel, GoogleGenerativeAIEmbeddings):
|
||
@staticmethod
|
||
def new_instance(model_type, model_name, model_credential: Dict[str, object], **model_kwargs):
|
||
return GeminiEmbeddingModel(
|
||
google_api_key=model_credential.get('api_key'),
|
||
model=model_name,
|
||
)
|