Skip to content

feat(gooddata-sdk): [AUTO] Add Anthropic LLM provider config to AFM and metadata APIs#1629

Open
yenkins-admin wants to merge 7 commits into
masterfrom
auto/openapi-sync-C002-20260525-r94782
Open

feat(gooddata-sdk): [AUTO] Add Anthropic LLM provider config to AFM and metadata APIs#1629
yenkins-admin wants to merge 7 commits into
masterfrom
auto/openapi-sync-C002-20260525-r94782

Conversation

@yenkins-admin
Copy link
Copy Markdown
Contributor

Summary

Added Anthropic LLM provider support to the SDK wrapper. New classes CatalogAnthropicApiKeyAuth and CatalogAnthropicProviderConfig follow the exact same pattern as existing OpenAI/Bedrock/AzureFoundry providers. Deserialization (from_api) is fully functional. Write path (to_api) will require api-client regeneration to add AnthropicProviderConfig to the generated client's oneOf discriminator.

Impact: new_feature | Services: afm, metadata

Source commits (gdc-nas):

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

Files changed

  • 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 (2)

client_class() for Anthropic auth/config classes — Omit client_class() override (inherit Base.client_class() returning NotImplemented)

  • Alternatives: Return a placeholder existing type like OpenAiProviderAuth, Set status=error and wait for api-client regeneration
  • Why: AnthropicApiKeyAuth and AnthropicProviderConfig do not yet exist in gooddata_api_client. The client_class() methods on auth/config sub-objects are never called in the normal service flow. Returning NotImplemented is honest and avoids ImportError from missing generated types.

Integration test cassette recording dependency on api-client regeneration — Write integration test referencing cassette path; note in risks that recording requires api-client regeneration

  • Alternatives: Set status=error to block until api-client is regenerated first, Skip the integration test
  • Why: The SDK-side wrapper layer (model classes, from_api deserialization, exports) is fully implementable now. The cassette recording will succeed once the api-client is regenerated.
Assumptions to verify (4)
  • AnthropicProviderConfig in the OpenAPI spec uses 'ANTHROPIC' as the type discriminator
  • AnthropicApiKeyAuth uses 'API_KEY' as the auth type (same as OpenAI and Azure Foundry)
  • The baseUrl field in AnthropicProviderConfig maps to the same camelCase/snake_case convention as other providers
  • The api-client regeneration pipeline will add AnthropicProviderConfig to JsonApiLlmProviderInAttributesProviderConfig._composed_schemas before cassette recording
Risks (2)
  • to_api() on CatalogLlmProvider with an Anthropic config will fail at runtime until the api-client is regenerated: JsonApiLlmProviderInAttributesProviderConfig._composed_schemas does not include AnthropicProviderConfig and allowed_values only lists OPENAI
  • Integration test cassette (test_create_llm_provider_anthropic.yaml) cannot be recorded until the api-client is regenerated
Layers touched (3)
  • entity_model — Added CatalogAnthropicApiKeyAuth, CatalogAnthropicAuth, CatalogAnthropicProviderConfig, _anthropic_auth_from_api; updated CatalogLlmProviderConfig Union and _provider_config_from_api
    • 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_llm_provider_anthropic integration test
    • packages/gooddata-sdk/tests/catalog/test_catalog_organization.py
OpenAPI diff
--- a/gooddata-afm-client.json
@@ -785,6 +785,68 @@
+      "AnthropicApiKeyAuth": {
+        "allOf": [{ "properties": { "apiKey": { ... }, "type": { "enum": ["API_KEY"] } } }],
+        "required": ["type"], "type": "object"
+      },
+      "AnthropicProviderAuth": {
+        "description": "Authentication configuration.",
+        "oneOf": [{ "$ref": "#/components/schemas/AnthropicApiKeyAuth" }], "type": "object"
+      },
+      "AnthropicProviderConfig": {
+        "description": "Configuration for Anthropic provider.",
+        "properties": { "auth": { ... }, "baseUrl": { "default": "https://api.anthropic.com", ... }, "type": { "enum": ["ANTHROPIC"] } },
+        "required": ["auth", "type"], "type": "object"
+      },
@@ -3749,6 +3842,9 @@
           "providerConfig": { "oneOf": [
+              { "$ref": "#/components/schemas/AnthropicProviderConfig" },
               { "$ref": "#/components/schemas/AwsBedrockProviderConfig" }, ...
--- a/gooddata-metadata-client.json
@@ -554,6 +554,68 @@
+      "AnthropicApiKeyAuth": { ... },
+      "AnthropicProviderAuth": { ... },
+      "AnthropicProviderConfig": { ... },
@@ -17708,15 +18009,19 @@
               "oneOf": [
-                { "$ref": "#/components/schemas/AwsBedrockProviderConfig" },
+                { "$ref": "#/components/schemas/OpenAIProviderConfig" },
                 { "$ref": "#/components/schemas/AzureFoundryProviderConfig" },
+                { "$ref": "#/components/schemas/AwsBedrockProviderConfig" },
+                { "$ref": "#/components/schemas/AnthropicProviderConfig" }
               ]

Workflow run


Generated by SDK OpenAPI Sync workflow

Copy link
Copy Markdown
Contributor

@tychtjan tychtjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Analyze why the unit tests in ci are failing and fix it

@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

❌ Patch coverage is 96.15385% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.25%. Comparing base (e1d6ad4) to head (ee09b79).

Files with missing lines Patch % Lines
.../catalog/organization/entity_model/llm_provider.py 96.15% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1629      +/-   ##
==========================================
+ Coverage   79.03%   79.25%   +0.21%     
==========================================
  Files         231      231              
  Lines       15634    15659      +25     
==========================================
+ Hits        12357    12411      +54     
+ Misses       3277     3248      -29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gooddata gooddata deleted a comment from yenkins-admin May 25, 2026
@gooddata gooddata deleted a comment from yenkins-admin May 25, 2026
@tychtjan tychtjan force-pushed the auto/openapi-sync-C002-20260525-r94782 branch from 5496e7f to df181c4 Compare May 25, 2026 12:16
@yenkins-admin
Copy link
Copy Markdown
Contributor Author

✅ Review fixes applied

Note

Addressed feedback from @tychtjan in 5e926c8.
Workflow run

Note

📼 Recording cassettes against staging — a follow-up commit will land shortly:

  • packages/gooddata-sdk/tests/catalog/test_catalog_organization.py::test_create_llm_provider_anthropic

Invalidating cassettes for:

  • packages/gooddata-sdk/tests/catalog/test_catalog_organization.py::test_create_llm_provider_anthropic

CI will be red until recording lands. That's expected.

Actions

1 fixed

✅ Fixed (1)
  • packages/gooddata-sdk/src/gooddata_sdk/catalog/organization/entity_model/llm_provider.py — Identified root cause: CatalogAnthropicProviderConfig and CatalogAnthropicApiKeyAuth lacked client_class() implementations, and the generated API client was missing Anthropic model classes entirely. This caused to_api() to fail when creating an Anthropic LLM provider — specifically, JsonApiLlmProviderInAttributesProviderConfig._composed_schemas.oneOf only listed AwsBedrockProviderConfig, AzureFoundryProviderConfig, and OpenAIProviderConfig, and allowed_values only accepted 'OPENAI'. When the test called create_llm_provider() with an Anthropic config, the serialization failed before any HTTP request was made, leaving the VCR cassette with only the DELETE cleanup interaction.

Fixed by:

  1. Created 4 new generated API client model files mirroring the OpenAI/AzureFoundry pattern:
    • 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
  2. **Updated 3 composite generated model file

…(truncated)

Claude output available in workflow artifacts.

@yenkins-admin
Copy link
Copy Markdown
Contributor Author

Tip

📼 ✅ Cassettes recorded for the requested tests.

Test Cassette
packages/gooddata-sdk/tests/catalog/test_catalog_organization.py::test_create_llm_provider_anthropic packages/gooddata-sdk/tests/catalog/fixtures/organization/test_create_llm_provider_anthropic.yaml
tests/catalog/test_catalog_organization.py::test_create_llm_provider_anthropic tests/catalog/fixtures/organization/test_create_llm_provider_anthropic.yaml

Pushed in e8dc4d1. CI should now go green.
(fix-agent retried 1 time(s) before recording succeeded.)
Review cost: $3.8192.

Run 26400063280 / fix-agent attempt 1 (3ed8eee) inadvertently
pushed transcripts/fix-C002-attempt1.jsonl. Root cause was a recorder.py
bug where cwd.parent resolved to cwd when cwd=Path("."), placing the
transcript inside the SDK working tree. Fixed in gdc-nas commit
96280b1a2d.
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