Skip to content

feat(gooddata-sdk): [AUTO] expose user_context in ai_chat/ai_chat_stream and export new gen-AI types#1426

Closed
yenkins-admin wants to merge 1 commit intomasterfrom
feature/auto-P008-gen-ai-skill-integration
Closed

feat(gooddata-sdk): [AUTO] expose user_context in ai_chat/ai_chat_stream and export new gen-AI types#1426
yenkins-admin wants to merge 1 commit intomasterfrom
feature/auto-P008-gen-ai-skill-integration

Conversation

@yenkins-admin
Copy link
Copy Markdown
Contributor

Expose optional user_context parameter in ai_chat/ai_chat_stream SDK methods and re-export new gen-AI model types from the public API surface.

P008 | Workflow: https://github.com/gooddata/gdc-nas/actions/runs/23137028021

Caution

Test fixtures need recording. The following fixture files are referenced by tests but do not exist yet.
They must be recorded against a live GoodData server before merging:

  • packages/gooddata-sdk/tests/compute/fixtures/ai_chat_with_user_context.yaml
  • packages/gooddata-sdk/tests/compute/fixtures/ai_chat_stream_with_user_context.yaml

What changed in gdc-nas

Three commits incrementally extended the Chat data model in afm-exec-api for gen-AI skill integration:

  • 3f2b607 (LX-2141): Added UI context support — new UIContext, DashboardContext, sealed WidgetDescriptor hierarchy (InsightWidgetDescriptor, RichTextWidgetDescriptor, VisualizationSwitcherWidgetDescriptor), ObjectReference, ObjectReferenceGroup, and ObjectReferenceType enum. Extended UserContext with view: UIContext? and referencedObjects: List<ObjectReferenceGroup>? fields; deprecated activeObject.
  • 0e847c5 (GDAI-1438): Added ToolCallEventResult data class and toolCallEvents: List<ToolCallEventResult>? to ChatResult to surface agentic loop tool call events. Wired gen-ai proto for skill tests.
  • 075d22d (CQ-104): Made referencedObjects nullable to fix downstream UI SDK code generation.

What was implemented in SDK

  • Added optional keyword-only user_context: UserContext | None = None parameter to ai_chat and ai_chat_stream in ComputeService, forwarded to ChatRequest using the conditional kwargs pattern (backward-compatible).
  • Re-exported 10 new gen-AI types from gooddata_sdk.__init__.py: UIContext, DashboardContext, WidgetDescriptor, InsightWidgetDescriptor, RichTextWidgetDescriptor, VisualizationSwitcherWidgetDescriptor, ObjectReference, ObjectReferenceGroup, ToolCallEventResult, UserContext.
  • Added two integration test cases for the new user_context parameter referencing cassette fixtures that need recording against a live server.

Files modified

  • packages/gooddata-sdk/src/gooddata_sdk/compute/service.py
  • packages/gooddata-sdk/src/gooddata_sdk/__init__.py
  • packages/gooddata-sdk/tests/compute/test_compute_service.py

JIRA: PENDING (Jira ticket will be created after review)
Risk: Low

…eam and export new gen-AI types

Added optional user_context parameter to ai_chat and ai_chat_stream methods in ComputeService,
enabling callers to pass UIContext, DashboardContext, WidgetDescriptor hierarchy, and
ObjectReferenceGroup to the AI chat endpoint. Re-exported all new gen-AI client types
(UIContext, DashboardContext, WidgetDescriptor subtypes, ObjectReference, ObjectReferenceGroup,
ToolCallEventResult, UserContext) from gooddata_sdk.__init__.py public API surface.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

❌ Patch coverage is 61.90476% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.34%. Comparing base (b95ca11) to head (35ad696).

Files with missing lines Patch % Lines
...s/gooddata-sdk/src/gooddata_sdk/compute/service.py 27.27% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1426      +/-   ##
==========================================
- Coverage   77.36%   77.34%   -0.02%     
==========================================
  Files         228      228              
  Lines       14775    14792      +17     
==========================================
+ Hits        11430    11441      +11     
- Misses       3345     3351       +6     

☔ 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.

@hkad98 hkad98 closed this Mar 17, 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