-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement cluster labeling interface, similar system for supporting c…
…hat and embed models
- Loading branch information
Showing
18 changed files
with
192 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,6 @@ | |
position: fixed; | ||
right: 0; | ||
top: 40px; | ||
width: 100px; | ||
width: 350px; | ||
height: 100%; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,43 @@ | ||
import os | ||
import json | ||
from .providers.transformers import TransformersProvider | ||
from .providers.openai import OpenAIProvider | ||
from .providers.cohereai import CohereAIProvider | ||
from .providers.togetherai import TogetherAIProvider | ||
from .providers.voyageai import VoyageAIProvider | ||
from .providers.transformers import TransformersEmbedProvider, TransformersChatProvider | ||
from .providers.openai import OpenAIEmbedProvider, OpenAIChatProvider | ||
from .providers.cohereai import CohereAIEmbedProvider | ||
from .providers.togetherai import TogetherAIEmbedProvider | ||
from .providers.voyageai import VoyageAIEmbedProvider | ||
|
||
models_path = os.path.join(os.path.dirname(__file__), "models.json") | ||
with open(models_path, "r") as f: | ||
model_list = json.load(f) | ||
|
||
model_dict = {model['id']: model for model in model_list} | ||
embed_models_path = os.path.join(os.path.dirname(__file__), "embedding_models.json") | ||
with open(embed_models_path, "r") as f: | ||
embed_model_list = json.load(f) | ||
embed_model_dict = {model['id']: model for model in embed_model_list} | ||
|
||
|
||
def get_model(id): | ||
def get_embedding_model(id): | ||
"""Returns a ModelProvider instance for the given model id.""" | ||
model = model_dict[id] | ||
model = embed_model_dict[id] | ||
if not model: | ||
raise ValueError(f"Model {id} not found") | ||
|
||
if model['provider'] == "transformers": | ||
return TransformersProvider(model['name'], model['params']) | ||
return TransformersEmbedProvider(model['name'], model['params']) | ||
if model['provider'] == "openai": | ||
return OpenAIProvider(model['name'], model['params']) | ||
return OpenAIEmbedProvider(model['name'], model['params']) | ||
if model['provider'] == "cohereai": | ||
return CohereAIProvider(model['name'], model['params']) | ||
return CohereAIEmbedProvider(model['name'], model['params']) | ||
if model['provider'] == "togetherai": | ||
return TogetherAIProvider(model['name'], model['params']) | ||
return TogetherAIEmbedProvider(model['name'], model['params']) | ||
if model['provider'] == "voyageai": | ||
return VoyageAIProvider(model['name'], model['params']) | ||
return VoyageAIEmbedProvider(model['name'], model['params']) | ||
|
||
chat_models_path = os.path.join(os.path.dirname(__file__), "chat_models.json") | ||
with open(chat_models_path, "r") as f: | ||
chat_model_list = json.load(f) | ||
chat_model_dict = {model['id']: model for model in chat_model_list} | ||
|
||
def get_chat_model(id): | ||
"""Returns a ModelProvider instance for the given model id.""" | ||
model = chat_model_dict[id] | ||
if model['provider'] == "transformers": | ||
return TransformersChatProvider(model['name'], model['params']) | ||
if model['provider'] == "openai": | ||
return OpenAIChatProvider(model['name'], model['params']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
[ | ||
{ | ||
"provider": "transformers", | ||
"name": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", | ||
"sanitized_name": "TinyLlama___TinyLlama-1.1B-Chat-v1.0", | ||
"id": "transformers-TinyLlama___TinyLlama-1.1B-Chat-v1.0", | ||
"params": { | ||
"max_tokens": 2048 | ||
} | ||
}, | ||
{ | ||
"provider": "openai", | ||
"name": "gpt-3.5-turbo", | ||
"id": "openai-gpt-3.5-turbo", | ||
"params": { | ||
"max_tokens": 4096 | ||
} | ||
}, | ||
{ | ||
"provider": "openai", | ||
"name": "gpt-4-1106-preview", | ||
"id": "openai-gpt-4-1106-preview", | ||
"params": { | ||
"max_tokens": 8192 | ||
} | ||
}, | ||
{ | ||
"provider": "cohereai", | ||
"name": "embed-english-v3.0", | ||
"id": "cohereai-embed-english-v3.0", | ||
"params": { | ||
"input_type": "clustering" | ||
} | ||
}, | ||
{ | ||
"provider": "togetherai", | ||
"name": "togethercomputer/m2-bert-80M-2k-retrieval", | ||
"sanitized_name": "togethercomputer___m2-bert-80M-2k-retrieval", | ||
"id": "togetherai-togethercomputer___m2-bert-80M-2k-retrieval", | ||
"modality": "text", | ||
"params": { | ||
"truncation": true, | ||
"padding": true, | ||
"max_tokens": 2048 | ||
} | ||
} | ||
|
||
] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
accelerate==0.26.1 | ||
aiohttp==3.9.1 | ||
aiolimiter==1.1.0 | ||
aiosignal==1.3.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.