Skip to content

Commit 0bf43bb

Browse files
committed
feat(gooddata-sdk): [AUTO] Remove LLM endpoint schemas and replace with 410 Gone
1 parent 38b0798 commit 0bf43bb

4 files changed

Lines changed: 79 additions & 2 deletions

File tree

packages/gooddata-sdk/src/gooddata_sdk/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@
127127
CatalogLlmProviderPatchDocument,
128128
CatalogOpenAiApiKeyAuth,
129129
CatalogOpenAiProviderConfig,
130+
CatalogResolvedLlmProvider,
130131
)
131132
from gooddata_sdk.catalog.organization.entity_model.organization import CatalogOrganization
132133
from gooddata_sdk.catalog.organization.entity_model.setting import CatalogOrganizationSetting

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

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from typing import Any, Union
55

6-
from attr import define
6+
from attr import define, field
77
from gooddata_api_client.model.aws_bedrock_provider_config import AwsBedrockProviderConfig
88
from gooddata_api_client.model.azure_foundry_provider_auth import AzureFoundryProviderAuth
99
from gooddata_api_client.model.azure_foundry_provider_config import AzureFoundryProviderConfig
@@ -337,3 +337,35 @@ class CatalogLlmProviderPatchAttributes(Base):
337337
@staticmethod
338338
def client_class() -> type[JsonApiLlmProviderInAttributes]:
339339
return JsonApiLlmProviderInAttributes
340+
341+
342+
# --- Resolved provider (read-only, returned by workspace-level resolution) ---
343+
344+
345+
@define(kw_only=True)
346+
class CatalogResolvedLlmProvider(Base):
347+
"""Active LLM provider resolved for a workspace.
348+
349+
Returned by :meth:`CatalogWorkspaceContentService.resolve_llm_providers`.
350+
This is a read-only object — it represents the live configuration resolved
351+
for the workspace, not the stored entity.
352+
"""
353+
354+
id: str
355+
title: str
356+
models: list[CatalogLlmProviderModel] = field(factory=list)
357+
358+
@classmethod
359+
def from_api(cls, entity: dict[str, Any]) -> CatalogResolvedLlmProvider:
360+
raw_models = safeget(entity, ["models"]) or []
361+
return cls(
362+
id=entity["id"],
363+
title=entity["title"],
364+
models=[
365+
CatalogLlmProviderModel(
366+
id=safeget(m, ["id"]) or "",
367+
family=safeget(m, ["family"]) or "",
368+
)
369+
for m in raw_models
370+
],
371+
)

packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/content_service.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from gooddata_sdk.catalog.data_source.validation.data_source import DataSourceValidator
1414
from gooddata_sdk.catalog.depends_on import CatalogDependsOn, CatalogDependsOnDateFilter
1515
from gooddata_sdk.catalog.filter_by import CatalogFilterBy
16+
from gooddata_sdk.catalog.organization.entity_model.llm_provider import CatalogResolvedLlmProvider
1617
from gooddata_sdk.catalog.types import ValidObjects
1718
from gooddata_sdk.catalog.validate_by_item import CatalogValidateByItem
1819
from gooddata_sdk.catalog.workspace.declarative_model.workspace.analytics_model.analytics_model import (
@@ -38,7 +39,7 @@
3839
from gooddata_sdk.compute.model.execution import ExecutionDefinition, compute_model_to_api_model
3940
from gooddata_sdk.compute.model.filter import Filter
4041
from gooddata_sdk.compute.model.metric import Metric
41-
from gooddata_sdk.utils import load_all_entities
42+
from gooddata_sdk.utils import load_all_entities, safeget
4243

4344
ValidObjectTypes = Union[Attribute, Metric, Filter, CatalogLabel, CatalogFact, CatalogMetric]
4445

@@ -685,3 +686,27 @@ def get_label_elements(
685686
workspace_id, request, _check_return_type=False, **paging_params
686687
)
687688
return [v["title"] for v in values["elements"]]
689+
690+
def resolve_llm_providers(self, workspace_id: str) -> CatalogResolvedLlmProvider | None:
691+
"""Resolve the active LLM provider configuration for a workspace.
692+
693+
Calls ``GET /api/v1/actions/workspaces/{workspaceId}/ai/resolveLlmProviders``
694+
and returns the resolved active LLM provider, or ``None`` when no LLM
695+
provider is configured for the workspace.
696+
697+
This is the replacement for the now-removed ``resolveLlmEndpoints`` endpoint.
698+
699+
Args:
700+
workspace_id (str):
701+
Workspace identifier e.g. ``"demo"``.
702+
703+
Returns:
704+
CatalogResolvedLlmProvider | None:
705+
The resolved active LLM provider, or ``None`` if the workspace
706+
has no LLM provider configured.
707+
"""
708+
response = self._actions_api.resolve_llm_providers(workspace_id, _check_return_type=False)
709+
data = safeget(response, ["data"])
710+
if data is None:
711+
return None
712+
return CatalogResolvedLlmProvider.from_api(data)

packages/gooddata-sdk/tests/catalog/test_catalog_workspace_content.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
CatalogDependsOn,
1919
CatalogDependsOnDateFilter,
2020
CatalogEntityIdentifier,
21+
CatalogResolvedLlmProvider,
2122
CatalogValidateByItem,
2223
CatalogWorkspace,
2324
DataSourceValidator,
@@ -502,3 +503,21 @@ def test_export_definition_analytics_layout(test_config):
502503
assert deep_eq(analytics_o.analytics.export_definitions, analytics_e.analytics.export_definitions)
503504
finally:
504505
safe_delete(_refresh_workspaces, sdk)
506+
507+
508+
@gd_vcr.use_cassette(str(_fixtures_dir / "test_resolve_llm_providers.yaml"))
509+
def test_resolve_llm_providers_integration(test_config):
510+
"""Exercise the resolveLlmProviders action (replaces the removed resolveLlmEndpoints).
511+
512+
The endpoint returns the active LLM provider for the workspace, or None when
513+
no LLM provider is configured. Both outcomes are valid — the test just
514+
verifies the SDK can call the endpoint without error and that the return
515+
value is either None or a well-formed CatalogResolvedLlmProvider.
516+
"""
517+
sdk = GoodDataSdk.create(host_=test_config["host"], token_=test_config["token"])
518+
result = sdk.catalog_workspace_content.resolve_llm_providers(test_config["workspace"])
519+
assert result is None or isinstance(result, CatalogResolvedLlmProvider)
520+
if result is not None:
521+
assert result.id
522+
assert result.title
523+
assert isinstance(result.models, list)

0 commit comments

Comments
 (0)