Skip to content

Commit 8501160

Browse files
authored
Merge pull request #1446 from gooddata/feature/auto-P020-fix-llm-provider-nullable-fields
fix(gooddata-sdk): [AUTO] make LlmProvider models and providerConfig nullable
2 parents 15b4033 + a271ae6 commit 8501160

File tree

1 file changed

+16
-12
lines changed
  • packages/gooddata-sdk/src/gooddata_sdk/catalog/organization/entity_model

1 file changed

+16
-12
lines changed

packages/gooddata-sdk/src/gooddata_sdk/catalog/organization/entity_model/llm_provider.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -253,16 +253,20 @@ def init(
253253
@classmethod
254254
def from_api(cls, entity: dict[str, Any]) -> CatalogLlmProvider:
255255
ea = entity["attributes"]
256-
raw_models = safeget(ea, ["models"]) or []
257-
models = [
258-
CatalogLlmProviderModel(
259-
id=safeget(m, ["id"]),
260-
family=safeget(m, ["family"]),
261-
)
262-
for m in raw_models
263-
]
264-
raw_config = safeget(ea, ["providerConfig"]) or {}
265-
provider_config = _provider_config_from_api(raw_config)
256+
raw_models = safeget(ea, ["models"])
257+
models = (
258+
[
259+
CatalogLlmProviderModel(
260+
id=safeget(m, ["id"]),
261+
family=safeget(m, ["family"]),
262+
)
263+
for m in raw_models
264+
]
265+
if raw_models is not None
266+
else None
267+
)
268+
raw_config = safeget(ea, ["providerConfig"])
269+
provider_config = _provider_config_from_api(raw_config) if raw_config is not None else None
266270
return cls(
267271
id=entity["id"],
268272
attributes=CatalogLlmProviderAttributes(
@@ -311,8 +315,8 @@ def init(
311315

312316
@define(kw_only=True)
313317
class CatalogLlmProviderAttributes(Base):
314-
models: list[CatalogLlmProviderModel]
315-
provider_config: CatalogLlmProviderConfig
318+
models: list[CatalogLlmProviderModel] | None = None
319+
provider_config: CatalogLlmProviderConfig | None = None
316320
name: str | None = None
317321
description: str | None = None
318322
default_model_id: str | None = None

0 commit comments

Comments
 (0)