Skip to content

Commit 2c43829

Browse files
committed
add embedding support for chatECNU(WIP)
1 parent ac0dc21 commit 2c43829

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

backend/src/shared/common_fn.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ def load_embedding_model(embedding_model_name: str):
8282
embeddings = get_bedrock_embeddings()
8383
dimension = 1536
8484
logging.info(f"Embedding: Using bedrock titan Embeddings , Dimension:{dimension}")
85+
if embedding_model_name == "ecnu":
86+
ecnu_api_key=os.environ.get("ECNU_API_KEY")
87+
embeddings = OpenAIEmbeddings(base_url="https://chat.ecnu.edu.cn/open/api/v1",model="ecnu-embedding-small",api_key=ecnu_api_key,deployment="ecnu-embedding-small")
88+
dimension = 1024
89+
logging.info(f"Embedding: Using ECNU Embeddings , Dimension:{dimension}")
8590
else:
8691
embeddings = HuggingFaceEmbeddings(
8792
model_name="all-MiniLM-L6-v2"#, cache_folder="/embedding_model"

0 commit comments

Comments
 (0)