Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSE-38076 - Add copilot_embedding_models.json list and read embedding models from COPILOT_EMBEDDING_CONFIG_DIR. #6

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions copilot_embedding_models.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"copilot_models": [
{
"provider": "Amazon Bedrock",
"model": "amazon.titan-embed-text-v2:0",
"provider_id": "bedrock"
},
{
"provider": "Amazon Bedrock",
"model": "cohere.embed-english-v3",
"provider_id": "bedrock"
},
{
"provider": "Amazon Bedrock",
"model": "cohere.embed-multilingual-v3",
"provider_id": "bedrock"
}
]
}
17 changes: 6 additions & 11 deletions copilot_models.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,32 @@
},
{
"provider": "Amazon Bedrock",
"model": "anthropic.claude-3-sonnet-20240229-v1:0",
"model": "anthropic.claude-3-5-haiku-20241022-v1:0",
"provider_id": "bedrock-chat"
},
{
"provider": "Amazon Bedrock",
"model": "anthropic.claude-3-haiku-20240307-v1:0",
"model": "anthropic.claude-3-5-sonnet-20241022-v2:0",
"provider_id": "bedrock-chat"
},
{
"provider": "Amazon Bedrock",
"model": "anthropic.claude-3-opus-20240229-v1:0",
"provider_id": "bedrock-chat"
},
{
"provider": "Amazon Bedrock",
"model": "meta.llama3-70b-instruct-v1:0",
"model": "meta.llama3-1-70b-instruct-v1:0",
"provider_id": "bedrock"
},
{
"provider": "Amazon Bedrock",
"model": "mistral.mixtral-8x7b-instruct-v0:1",
"model": "meta.llama3-1-405b-instruct-v1:0",
"provider_id": "bedrock"
},
{
"provider": "Amazon Bedrock",
"model": "amazon.titan-embed-text-v1",
"model": "mistral.mixtral-8x7b-instruct-v0:1",
"provider_id": "bedrock"
},
{
"provider": "Amazon Bedrock",
"model": "amazon.titan-embed-text-v2:0",
"model": "mistral.mistral-large-2402-v1:0",
"provider_id": "bedrock"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ class ClouderaAIInferenceEmbeddingModelProvider(BaseEmbeddingsProvider, Embeddin
os.getenv("COPILOT_CONFIG_DIR", ""), model_type="embedding"
)

# Read from both config files, as embedding models could still be in the old config file for an older CML version.
embedding_ai_inference_models, embedding_models = getCopilotModels(
os.getenv("COPILOT_EMBEDDING_CONFIG_DIR", ""), model_type="embedding"
)

# Merge lists, removing duplicates.
ai_inference_models = ai_inference_models + embedding_ai_inference_models
models = models + embedding_models

def __init__(self, **kwargs):
super().__init__(**kwargs)
self.model_endpoint = self._get_inference_endpoint()
Expand Down
7 changes: 7 additions & 0 deletions packages/jupyter-ai/jupyter_ai/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,13 @@ def getConfiguredThirdPartyModels(self):
if copilot_config and "thirdPartyModels" in copilot_config and copilot_config["thirdPartyModels"]:
third_party_models = copilot_config["thirdPartyModels"]

copilot_embedding_config_dir = os.getenv("COPILOT_EMBEDDING_CONFIG_DIR")
if copilot_embedding_config_dir and os.path.exists(copilot_embedding_config_dir):
f = open(copilot_embedding_config_dir)
copilot_embedding_config = json.load(f)
if copilot_embedding_config and "thirdPartyModels" in copilot_embedding_config and copilot_embedding_config["thirdPartyModels"]:
third_party_models += copilot_embedding_config["thirdPartyModels"]

# Fill in provider_id if it is missing.
for third_party_model in third_party_models:
print(third_party_model)
Expand Down
Loading