feat: IBM WatsonX provider with integration and smoke tests (#1020) - #1052
Open
kannupriyakalra wants to merge 7 commits into
Open
feat: IBM WatsonX provider with integration and smoke tests (#1020)#1052kannupriyakalra wants to merge 7 commits into
kannupriyakalra wants to merge 7 commits into
Conversation
Resolves #1020. Implements WatsonXClient with IAM token-based auth, complete() and streamComplete() support, and comprehensive mock-based unit tests (WatsonXClientSpec) plus real-endpoint smoke tests (WatsonXSmokeSpec). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Run scalafmt on the three files that failed CI Quick Checks: LLMConnect.scala, WatsonXClient.scala, and WatsonXClientSpec.scala. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The WatsonXClient uses a try/finally block for resource cleanup in processStreamResponse(). Add DisableSyntax.NoKeywordFinally to the scalafix:off suppression comment alongside the existing NoKeywordTry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove unused 'token' parameter from handleErrorResponse in WatsonXClient - Add missing WatsonX case to NamedProviderLoader pattern match using 'endpoint' config field as the WatsonX projectId Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add WatsonXConfig pattern match cases to: - ProviderSetupRuntime.applyConfiguredSessionOverride - ProviderSetupRuntime.overrideModel - PrometheusMetricsExample providerName match These were causing compiler warnings treated as errors (-Werror). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The describe() function in ProviderKindSpec was missing the WatsonX case causing a non-exhaustive match warning treated as error (-Werror) in test compilation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d update ProviderKindSpec for WatsonX - Fix MockHttpClient.postStream to use the response returned by record() instead of the original constructor parameter, so streaming tests receive the correct queued HttpResponse (statusCode + body). - Update ProviderKindSpec: bump expected size to 11, add WatsonX to allOf check, add WatsonX name assertion, and add watsonx fromName round-trip assertions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #1020: integration and smoke tests for the IBM WatsonX provider.
This PR includes both the WatsonXClient implementation (since #1019 had not landed yet) and all the requested tests.
Changes
New source files:
modules/core/src/main/scala/org/llm4s/llmconnect/provider/WatsonXClient.scala— WatsonX client with IAM token exchange, caching, refresh,complete(), andstreamComplete().modules/core/src/main/scala/org/llm4s/llmconnect/config/ProviderConfig.scala— AddedWatsonXConfigcase class withapiKey,projectId,model,baseUrl,iamUrlfields.modules/core/src/main/scala/org/llm4s/types/ProviderModelTypes.scala— AddedWatsonXtoProviderKindenum.modules/core/src/main/scala/org/llm4s/llmconnect/LLMConnect.scala— RegisteredWatsonXConfig -> WatsonXClientrouting.New test files:
modules/core/src/test/scala/org/llm4s/llmconnect/provider/WatsonXClientSpec.scala— 30+ mock-based unit tests covering all acceptance criteria.modules/it/src/test/scala/org/llm4s/llmconnect/smoke/WatsonXSmokeSpec.scala— Real-endpoint smoke tests (skipped when credentials absent).Test Coverage
All unit tests use
MockHttpClient/FailingHttpClient— no IBM credentials required forsbt test.Covered scenarios:
ConfigurationErrorConfigurationErrorcomplete()with token usagecomplete()with missinggenerated_text→ValidationErrorRateLimitErrorAuthenticationErrorServiceErrorproject_iddetected from error body →ValidationErrorstreamComplete()assembles chunks and captures token usageValidationErrorRateLimitErrorclose()→ConfigurationErroron subsequent callsSmoke Tests
Located in
modules/it/src/test/scala/org/llm4s/llmconnect/smoke/WatsonXSmokeSpec.scala:WATSONX_API_KEY,WATSONX_PROJECT_ID; skips gracefully if absentcomplete()withibm/granite-3-8b-instructstreamComplete(): at least one chunk emittedRun with:
sbt testSmoke(requires IBM Cloud credentials)Closes #1020
🤖 Generated with Claude Code