Skip to content

Commit 7637d49

Browse files
jessicasingh7Jessica Singhgreptile-apps[bot]
authored
refactor(model): move api-based embeddings/reranking calls out of model server (onyx-dot-app#5216)
* move api-based embeddings/reranking calls to api server out of model server, added/modified unit tests * ran pre-commit * fix mypy errors * mypy and precommit * move utils to right place and add requirements * precommit check * removed extra constants, changed error msg * Update backend/onyx/utils/search_nlp_models_utils.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * greptile * addressed comments * added code enforcement to throw error --------- Co-authored-by: Jessica Singh <jessicasingh@Mac.attlocal.net> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
1 parent e71acf8 commit 7637d49

File tree

9 files changed

+782
-713
lines changed

9 files changed

+782
-713
lines changed

backend/model_server/constants.py

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,5 @@
1-
from shared_configs.enums import EmbeddingProvider
2-
from shared_configs.enums import EmbedTextType
3-
4-
51
MODEL_WARM_UP_STRING = "hi " * 512
62
INFORMATION_CONTENT_MODEL_WARM_UP_STRING = "hi " * 16
7-
DEFAULT_OPENAI_MODEL = "text-embedding-3-small"
8-
DEFAULT_COHERE_MODEL = "embed-english-light-v3.0"
9-
DEFAULT_VOYAGE_MODEL = "voyage-large-2-instruct"
10-
DEFAULT_VERTEX_MODEL = "text-embedding-005"
11-
12-
13-
class EmbeddingModelTextType:
14-
PROVIDER_TEXT_TYPE_MAP = {
15-
EmbeddingProvider.COHERE: {
16-
EmbedTextType.QUERY: "search_query",
17-
EmbedTextType.PASSAGE: "search_document",
18-
},
19-
EmbeddingProvider.VOYAGE: {
20-
EmbedTextType.QUERY: "query",
21-
EmbedTextType.PASSAGE: "document",
22-
},
23-
EmbeddingProvider.GOOGLE: {
24-
EmbedTextType.QUERY: "RETRIEVAL_QUERY",
25-
EmbedTextType.PASSAGE: "RETRIEVAL_DOCUMENT",
26-
},
27-
}
28-
29-
@staticmethod
30-
def get_type(provider: EmbeddingProvider, text_type: EmbedTextType) -> str:
31-
return EmbeddingModelTextType.PROVIDER_TEXT_TYPE_MAP[provider][text_type]
323

334

345
class GPUStatus:

0 commit comments

Comments
 (0)