feat: support TEI embedding service, configurable reranking model (#287)

* feat: add support for TEI embedding service, allow reranking model to be configurable.

Signed-off-by: Kennywu <jdlow@live.cn>

* fix: add cohere default reranking model

* fix: comfort pre-commit

---------

Signed-off-by: Kennywu <jdlow@live.cn>
Co-authored-by: wujiaye <wujiaye@bluemoon.com.cn>
Co-authored-by: Tadashi <tadashi@cinnamon.is>
This commit is contained in:
KennyWu
2024-09-30 23:00:00 +08:00
committed by GitHub
parent 2e3c17b256
commit 53530e296f
20 changed files with 928 additions and 22 deletions

View File

@@ -92,6 +92,7 @@ KH_VECTORSTORE = {
}
KH_LLMS = {}
KH_EMBEDDINGS = {}
KH_RERANKINGS = {}
# populate options from config
if config("AZURE_OPENAI_API_KEY", default="") and config(
@@ -212,7 +213,7 @@ KH_LLMS["cohere"] = {
"spec": {
"__type__": "kotaemon.llms.chats.LCCohereChat",
"model_name": "command-r-plus-08-2024",
"api_key": "your-key",
"api_key": config("COHERE_API_KEY", default="your-key"),
},
"default": False,
}
@@ -222,7 +223,7 @@ KH_EMBEDDINGS["cohere"] = {
"spec": {
"__type__": "kotaemon.embeddings.LCCohereEmbeddings",
"model": "embed-multilingual-v3.0",
"cohere_api_key": "your-key",
"cohere_api_key": config("COHERE_API_KEY", default="your-key"),
"user_agent": "default",
},
"default": False,
@@ -235,6 +236,16 @@ KH_EMBEDDINGS["cohere"] = {
# "default": False,
# }
# default reranking models
KH_RERANKINGS["cohere"] = {
"spec": {
"__type__": "kotaemon.rerankings.CohereReranking",
"model_name": "rerank-multilingual-v2.0",
"cohere_api_key": config("COHERE_API_KEY", default="your-key"),
},
"default": True,
}
KH_REASONINGS = [
"ktem.reasoning.simple.FullQAPipeline",
"ktem.reasoning.simple.FullDecomposeQAPipeline",