Skip to content

Commit

Permalink
fix: replace openai dummy endpoint by dummy strings to avoid lychee fail
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueGrizzliBear committed Oct 1, 2024
1 parent 4d1e2fe commit d8bd153
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/sdk/tutorials/llm_project_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ model_response = kili.llm.create_model(
model={
"credentials": {
"api_key": "<YOUR_OPEN_AI_API_KEY>",
"endpoint": "https://api.openai.com/v1/",
"endpoint": "<your_desired_open_ai_endpoint>",
},
"name": "My Model",
"type": "OPEN_AI_SDK",
Expand Down
2 changes: 1 addition & 1 deletion recipes/llm_project_setup.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
" model={\n",
" \"credentials\": {\n",
" \"api_key\": \"<YOUR_OPEN_AI_API_KEY>\",\n",
" \"endpoint\": \"https://api.openai.com/v1/\",\n",
" \"endpoint\": \"<your_desired_open_ai_endpoint>\",\n",
" },\n",
" \"name\": \"My Model\",\n",
" \"type\": \"OPEN_AI_SDK\",\n",
Expand Down
2 changes: 1 addition & 1 deletion src/kili/llm/presentation/client/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def create_model(self, organization_id: str, model: dict) -> ModelDict:
... "type": "OPEN_AI_SDK",
... "credentials": {
... "api_key": "your_open_ai_api_key",
... "endpoint": "https://api.openai.com/v1/"
... "endpoint": "ypur_open_ai_endpoint"
... }
... }
>>> kili.llm.create_model(organization_id="your_organization_id", model=model_data)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/test_e2e_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_create_and_manage_project_and_model_resources(kili: Kili):
project_id = project["id"]

model_data = {
"credentials": {"api_key": "***", "endpoint": "https://api.openai.com"},
"credentials": {"api_key": "***", "endpoint": "your_open_ai_endpoint"},
"name": MODEL_NAME,
"type": "OPEN_AI_SDK",
}
Expand Down
38 changes: 19 additions & 19 deletions tests/unit/llm/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@


def test_map_create_model_input_with_openai_sdk_credentials():
credentials = OpenAISDKCredentials(api_key="api_key", endpoint="https://api.openai.com/v1/")
credentials = OpenAISDKCredentials(api_key="api_key", endpoint="your_open_ai_endpoint")
input_data = ModelToCreateInput(
name="Test Model",
type=ModelType.OPEN_AI_SDK,
Expand All @@ -71,7 +71,7 @@ def test_map_create_model_input_with_openai_sdk_credentials():
expected_output = {
"credentials": {
"apiKey": "api_key",
"endpoint": "https://api.openai.com/v1/",
"endpoint": "your_open_ai_endpoint",
},
"name": "Test Model",
"type": ModelType.OPEN_AI_SDK.value,
Expand All @@ -86,7 +86,7 @@ def test_map_create_model_input_with_azure_openai_credentials():
credentials = AzureOpenAICredentials(
api_key="api_key",
deployment_id="deployment_id",
endpoint="https://azure-openai-endpoint.com",
endpoint="your_azure_open_ai_endpoint",
)
input_data = ModelToCreateInput(
name="Test Azure Model",
Expand All @@ -98,7 +98,7 @@ def test_map_create_model_input_with_azure_openai_credentials():
"credentials": {
"apiKey": "api_key",
"deploymentId": "deployment_id",
"endpoint": "https://azure-openai-endpoint.com",
"endpoint": "your_azure_open_ai_endpoint",
},
"name": "Test Azure Model",
"type": ModelType.AZURE_OPEN_AI.value,
Expand All @@ -119,13 +119,13 @@ def test_map_update_model_input_update_name_only():

def test_map_update_model_input_update_openai_sdk_credentials():
credentials = OpenAISDKCredentials(
api_key="new_api_key", endpoint="https://new-openai-endpoint.com"
api_key="new_api_key", endpoint="your_new_open_ai_endpoint"
)
input_data = ModelToUpdateInput(credentials=credentials)
expected_output = {
"credentials": {
"apiKey": "new_api_key",
"endpoint": "https://new-openai-endpoint.com",
"endpoint": "your_new_open_ai_endpoint",
}
}

Expand All @@ -137,14 +137,14 @@ def test_map_update_model_input_update_azure_openai_credentials():
credentials = AzureOpenAICredentials(
api_key="new_api_key",
deployment_id="new_deployment_id",
endpoint="https://new-azure-openai-endpoint.com",
endpoint="your_new_azure_open_ai_endpoint",
)
input_data = ModelToUpdateInput(credentials=credentials)
expected_output = {
"credentials": {
"apiKey": "new_api_key",
"deploymentId": "new_deployment_id",
"endpoint": "https://new-azure-openai-endpoint.com",
"endpoint": "your_new_azure_open_ai_endpoint",
}
}

Expand All @@ -154,14 +154,14 @@ def test_map_update_model_input_update_azure_openai_credentials():

def test_map_update_model_input_update_name_and_openai_sdk_credentials():
credentials = OpenAISDKCredentials(
api_key="new_api_key", endpoint="https://new-openai-endpoint.com"
api_key="new_api_key", endpoint="your_new_open_ai_endpoint"
)
input_data = ModelToUpdateInput(name="Updated Model Name", credentials=credentials)
expected_output = {
"name": "Updated Model Name",
"credentials": {
"apiKey": "new_api_key",
"endpoint": "https://new-openai-endpoint.com",
"endpoint": "your_new_open_ai_endpoint",
},
}

Expand All @@ -173,15 +173,15 @@ def test_map_update_model_input_update_name_and_azure_openai_credentials():
credentials = AzureOpenAICredentials(
api_key="new_api_key",
deployment_id="new_deployment_id",
endpoint="https://new-azure-openai-endpoint.com",
endpoint="your_new_azure_open_ai_endpoint",
)
input_data = ModelToUpdateInput(name="Updated Model Name", credentials=credentials)
expected_output = {
"name": "Updated Model Name",
"credentials": {
"apiKey": "new_api_key",
"deploymentId": "new_deployment_id",
"endpoint": "https://new-azure-openai-endpoint.com",
"endpoint": "your_new_azure_open_ai_endpoint",
},
}

Expand Down Expand Up @@ -229,7 +229,7 @@ def test_create_model_open_ai_sdk(mocker):
"type": "OPEN_AI_SDK",
"credentials": {
"api_key": "***",
"endpoint": "https://api.openai.com",
"endpoint": "your_open_ai_endpoint",
},
},
)
Expand All @@ -249,7 +249,7 @@ def test_create_model_azure_openai(mocker):
"type": "AZURE_OPEN_AI",
"credentials": {
"api_key": "***",
"endpoint": "https://api.openai.com",
"endpoint": "your_open_ai_endpoint",
"deployment_id": "deployment_id",
},
},
Expand All @@ -268,7 +268,7 @@ def test_create_invalid_model(mocker):
model={
"name": "New Model",
"type": "Wrong type",
"credentials": {"api_key": "***", "endpoint": "https://api.openai.com"},
"credentials": {"api_key": "***", "endpoint": "your_open_ai_endpoint"},
},
)

Expand All @@ -285,7 +285,7 @@ def test_update_model_open_ai_sdk(mocker):
"name": "Updated Model",
"credentials": {
"api_key": "***",
"endpoint": "https://api.openai.com",
"endpoint": "your_open_ai_endpoint",
},
},
)
Expand All @@ -305,7 +305,7 @@ def test_update_model_azure_open_ai(mocker):
"name": "Updated Model",
"credentials": {
"api_key": "***",
"endpoint": "https://api.openai.com",
"endpoint": "your_open_ai_endpoint",
"deployment_id": "deployment_id",
},
},
Expand All @@ -324,7 +324,7 @@ def test_update_invalid_model(mocker):
model={
"name": "New Model",
"type": "Wrong type",
"credentials": {"api_key": "***", "endpoint": "https://api.openai.com"},
"credentials": {"api_key": "***", "endpoint": "your_open_ai_endpoint"},
},
)

Expand All @@ -340,7 +340,7 @@ def test_update_non_existing_model(mocker):
model={
"name": "New Model",
"type": "Wrong type",
"credentials": {"api_key": "***", "endpoint": "https://api.openai.com"},
"credentials": {"api_key": "***", "endpoint": "your_open_ai_endpoint"},
},
)

Expand Down

0 comments on commit d8bd153

Please sign in to comment.