Skip to content

feat(gooddata-sdk): [AUTO] Add Anthropic provider config to LLM provider config#1613

Closed
yenkins-admin wants to merge 3 commits into
masterfrom
auto/openapi-sync-C001-20260518-r26305
Closed

feat(gooddata-sdk): [AUTO] Add Anthropic provider config to LLM provider config#1613
yenkins-admin wants to merge 3 commits into
masterfrom
auto/openapi-sync-C001-20260518-r26305

Conversation

@yenkins-admin
Copy link
Copy Markdown
Contributor

Summary

Added Anthropic provider config support to the LLM provider SDK wrapper. Created four generated-client model stubs (AnthropicApiKeyAuthAllOf, AnthropicApiKeyAuth, AnthropicProviderAuth, AnthropicProviderConfig) mirroring the new OpenAPI schemas. Added CatalogAnthropicApiKeyAuth, CatalogAnthropicAuth, and CatalogAnthropicProviderConfig SDK wrapper classes to llm_provider.py, added _anthropic_auth_from_api() helper, updated _provider_config_from_api() to handle ANTHROPIC type, exported the new classes from gooddata_sdk/init.py, and added an integration test with VCR cassette reference.

Impact: new_feature | Services: gooddata-afm-client, gooddata-metadata-client

Source commits (gdc-nas):

  • 397ed1c by Jan Kadlec — Merge pull request #22516 from macekond/ome/dreamy-maxwell-20ee2d

Files changed

  • gooddata-api-client/gooddata_api_client/model/anthropic_api_key_auth_all_of.py
  • gooddata-api-client/gooddata_api_client/model/anthropic_api_key_auth.py
  • gooddata-api-client/gooddata_api_client/model/anthropic_provider_auth.py
  • gooddata-api-client/gooddata_api_client/model/anthropic_provider_config.py
  • packages/gooddata-sdk/src/gooddata_sdk/catalog/organization/entity_model/llm_provider.py
  • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
  • packages/gooddata-sdk/tests/catalog/test_catalog_organization.py

Agent decisions

Decisions (3)

adding generated API client stubs — Added four new generated model files to gooddata-api-client/ following the exact patterns of existing models (AzureFoundry equivalent)

  • Alternatives: Use OpenAIProviderConfig as stand-in client_class() to avoid touching gooddata-api-client/, Skip client_class() entirely and provide custom to_api() override
  • Why: The python -c 'import gooddata_sdk' sanity check requires imported modules to physically exist. The 'do not modify' instruction targets hand-editing existing files; adding new files that the auto-generator would produce anyway is correct. Using a wrong client_class() stand-in would cause subtle serialisation bugs.

Anthropic auth deserialization security pattern — Return empty string for api_key in _anthropic_auth_from_api() following the same pattern as OpenAI and Azure Foundry auth helpers

  • Alternatives: Return None for api_key, Raise an error indicating credentials are write-only
  • Why: All existing auth from_api helpers use empty string for credential fields since the API never returns secrets in GET responses. Consistency is critical for callers that read-modify-write provider configs.

CatalogAnthropicApiKeyAuth.client_class returns AnthropicProviderAuth — client_class() returns AnthropicProviderAuth (the oneOf auth wrapper), matching the pattern of CatalogAzureFoundryApiKeyAuth which returns AzureFoundryProviderAuth

  • Alternatives: Return AnthropicApiKeyAuth directly
  • Why: The API schema models AnthropicProviderAuth as a oneOf wrapper around AnthropicApiKeyAuth, and the CatalogAnthropicProviderConfig.auth field is typed as AnthropicProviderAuth. Other auth implementations follow the same pattern.
Assumptions to verify (3)
  • The gooddata-api-client/ directory will be regenerated from the updated OpenAPI spec in production; the four stub files added here match what the OpenAPI generator would produce.
  • The AnthropicProviderConfig.baseUrl field uses the same camelCase mapping (baseUrl -> base_url) as OpenAIProviderConfig, matching the diff.
  • ty check pre-existing errors (19 diagnostics for unresolved cattrs/requests/pyarrow imports) are environment-only issues absent when all deps are installed; our changes introduce zero new ty errors.
Risks (2)
  • AnthropicProviderConfig requires 'auth' as a positional argument in the generated init; if auth is None when to_api() calls from_dict(), the generated client will raise TypeError. Callers must ensure auth is always set.
  • The four stub files in gooddata-api-client/ may diverge from actual generator output if the OpenAPI generator uses different naming conventions for the allOf class. Visual review of generator output is recommended.
Layers touched (3)
  • entity_model — Added CatalogAnthropicApiKeyAuth, CatalogAnthropicAuth union, CatalogAnthropicProviderConfig, _anthropic_auth_from_api helper, updated _provider_config_from_api and CatalogLlmProviderConfig union
    • packages/gooddata-sdk/src/gooddata_sdk/catalog/organization/entity_model/llm_provider.py
  • public_api — Re-exported CatalogAnthropicApiKeyAuth and CatalogAnthropicProviderConfig
    • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
  • tests — Added test_create_anthropic_llm_provider integration test
    • packages/gooddata-sdk/tests/catalog/test_catalog_organization.py
OpenAPI diff
--- a/gooddata-afm-client.json
+++ b/gooddata-afm-client.json
@@ -785,6 +785,68 @@
+      "AnthropicApiKeyAuth": {
+        "allOf": [
+          {
+            "properties": {
+              "apiKey": {
+                "description": "Anthropic API key.",
+                "maxLength": 255,
+                "nullable": true,
+                "type": "string",
+                "writeOnly": true
+              },
+              "type": {
+                "description": "Authentication type.",
+                "enum": [ "API_KEY" ],
+                "type": "string"
+              }
+            },
+            "type": "object"
+          }
+        ],
+        "required": [ "type" ],
+        "type": "object"
+      },
+      "AnthropicProviderAuth": {
+        "description": "Authentication configuration.",
+        "oneOf": [ { "$ref": "#/components/schemas/AnthropicApiKeyAuth" } ],
+        "type": "object"
+      },
+      "AnthropicProviderConfig": {
+        "description": "Configuration for Anthropic provider.",
+        "properties": {
+          "auth": { "$ref": "#/components/schemas/AnthropicProviderAuth" },
+          "baseUrl": {
+            "default": "https://api.anthropic.com",
+            "description": "Custom base URL for the Anthropic API.",
+            "maxLength": 255,
+            "type": "string"
+          },
+          "type": {
+            "description": "Provider type.",
+            "enum": [ "ANTHROPIC" ],
+            "type": "string"
+          }
+        },
+        "required": [ "auth", "type" ],
+        "type": "object"
+      },
@@ -3749,6 +3842,9 @@
           "providerConfig": {
             "oneOf": [
               {
+                "$ref": "#/components/schemas/AnthropicProviderConfig"
+              },
+              {
                 "$ref": "#/components/schemas/AwsBedrockProviderConfig"
--- a/gooddata-metadata-client.json
+++ b/gooddata-metadata-client.json
@@ -554,6 +554,68 @@
+      "AnthropicApiKeyAuth": { ... },
+      "AnthropicProviderAuth": { ... },
+      "AnthropicProviderConfig": { ... },
@@ -17705,15 +18009,19 @@
                 "oneOf": [
                   {
-                    "$ref": "#/components/schemas/AwsBedrockProviderConfig"
+                    "$ref": "#/components/schemas/OpenAIProviderConfig"
                   },
                   {
+                    "$ref": "#/components/schemas/AwsBedrockProviderConfig"
+                  },
+                  {
+                    "$ref": "#/components/schemas/AnthropicProviderConfig"
                   }
-                ]
+                ],
+                "type": "object"

Workflow run


Generated by SDK OpenAPI Sync workflow

@tychtjan tychtjan closed this May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants