Skip to content

Commit

Permalink
fix: customize model schema fetch failed raise error (#1900)
Browse files Browse the repository at this point in the history
  • Loading branch information
takatost authored Jan 4, 2024
1 parent 0c5892b commit 6a2eb5f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions api/core/entities/provider_configuration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import json
import logging
import time
from json import JSONDecodeError
from typing import Optional, List, Dict, Tuple, Iterator
Expand All @@ -18,6 +19,8 @@
from extensions.ext_database import db
from models.provider import ProviderType, Provider, ProviderModel, TenantPreferredModelProvider

logger = logging.getLogger(__name__)


class ProviderConfiguration(BaseModel):
"""
Expand Down Expand Up @@ -544,13 +547,17 @@ def _get_custom_provider_models(self,
if model_configuration.model_type not in model_types:
continue

custom_model_schema = (
provider_instance.get_model_instance(model_configuration.model_type)
.get_customizable_model_schema_from_credentials(
model_configuration.model,
model_configuration.credentials
try:
custom_model_schema = (
provider_instance.get_model_instance(model_configuration.model_type)
.get_customizable_model_schema_from_credentials(
model_configuration.model,
model_configuration.credentials
)
)
)
except Exception as ex:
logger.warning(f'get custom model schema failed, {ex}')
continue

if not custom_model_schema:
continue
Expand Down

0 comments on commit 6a2eb5f

Please sign in to comment.