Skip to content

refactor(sagemaker): consolidate SageMaker types into centralized provider types - #195

Merged
murdore merged 1 commit into
juspay:releasefrom
RajuSudhar:BZ-44700-sagemaker-module-types-refactor
Oct 2, 2025
Merged

murdore merged 1 commit into
juspay:releasefrom
RajuSudhar:BZ-44700-sagemaker-module-types-refactor

Conversation

@RajuSudhar

@RajuSudhar RajuSudhar commented Sep 28, 2025 •

Copy link
Copy Markdown
Contributor

Moves all SageMaker-specific type definitions from standalone types.ts module into the centralized src/lib/types/providers.ts architecture.

Changes

  • Moved types: All SageMaker types (489 lines) from sagemaker/types.ts to types/providers.ts
  • Updated imports: All SageMaker modules now import from "../../types/providers.js"
  • Deleted file: Removed standalone src/lib/providers/sagemaker/types.ts
  • Centralized architecture: SageMaker types now part of unified provider type system

Benefits

  • Consistent with overall types module architecture
  • Single source of truth for all provider types
  • Improved maintainability and discoverability
  • Aligned with centralized type management strategy

🤖 Generated with Claude Code

Pull Request

Description

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🧹 Code refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test coverage improvement
  • 🔧 Build/CI configuration change

Related Issues

  • Fixes #
  • Related to #

Changes Made

AI Provider Impact

  • OpenAI
  • Anthropic
  • Google AI/Vertex
  • AWS Bedrock
  • Azure OpenAI
  • Hugging Face
  • Ollama
  • Mistral
  • Amazon Sagemaker AI
  • All providers
  • No provider-specific changes

Component Impact

  • CLI
  • SDK
  • MCP Integration
  • Streaming
  • Tool Calling
  • Configuration
  • Documentation
  • Tests

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • E2E tests added/updated
  • Manual testing performed
  • All existing tests pass

Test Environment

  • OS:
  • Node.js version:
  • Package manager:

Performance Impact

  • No performance impact
  • Performance improvement
  • Minor performance impact (acceptable)
  • Significant performance impact (needs discussion)

Breaking Changes

Screenshots/Demo

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Summary by CodeRabbit

  • New Features
    • None. No user-facing functionality changed.
  • Refactor
    • Consolidated SageMaker-related type definitions into a shared provider types module, removing duplicates and updating references across the codebase.
    • Streamlined concurrency and configuration type usage for SageMaker to improve consistency.
  • Chores
    • Standardized type exports/imports for SageMaker components to reduce fragmentation and simplify maintenance.

Note: These changes do not affect runtime behavior or interfaces; existing SageMaker functionality continues to work as before.

@coderabbitai

coderabbitai Bot commented Sep 28, 2025 •

Copy link
Copy Markdown

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

SageMaker-related type definitions were consolidated into src/lib/types/providers.ts. The local src/lib/providers/sagemaker/types.ts was removed. Multiple SageMaker modules updated import paths to reference the new central types module, and re-exports were adjusted accordingly. No runtime behavior or control flow changes.

Changes

Cohort / File(s) Summary
Centralized provider types
src/lib/types/providers.ts
Added comprehensive SageMaker and concurrency-related type declarations (config, endpoints, usage, invoke params/responses, streaming, tool calls, generation, errors, batch, deployment, metrics, cost, results).
Removed local SageMaker types
src/lib/providers/sagemaker/types.ts
Deleted the local SageMaker types module; all prior type exports moved to the centralized providers types file.
SageMaker import-path updates
src/lib/providers/sagemaker/client.ts, src/lib/providers/sagemaker/config.ts, src/lib/providers/sagemaker/detection.ts, src/lib/providers/sagemaker/errors.ts, src/lib/providers/sagemaker/language-model.ts, src/lib/providers/sagemaker/parsers.ts, src/lib/providers/sagemaker/streaming.ts, src/lib/providers/sagemaker/structured-parser.ts
Updated type import paths from ./types.js to ../../types/providers.js; no logic changes.
Adaptive semaphore type relocation
src/lib/providers/sagemaker/adaptive-semaphore.ts
Removed locally exported interfaces AdaptiveSemaphoreConfig and AdaptiveSemaphoreMetrics; now import types from ../../types/providers.js.
Re-exports path change
src/lib/providers/sagemaker/index.ts
Re-exported SageMaker types now sourced from ../../types/providers.js instead of ./types.js.
Top-level provider import update
src/lib/providers/amazonSagemaker.ts
Updated import path for SageMakerModelConfig and SageMakerConfig to ../types/providers.js.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • murdore

Poem

I hopped through types with tidy cheer,
Gathering SageMaker fields far and near.
One burrow now holds every spec—
No more nest-to-nest to check.
Imports align, the paths are clear,
Thump-thump! the code feels light this year. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and concisely indicates that this PR refactors Sagemaker by moving type definitions into a centralized provider types module, which is exactly the primary purpose of the changeset. It is specific, uses the conventional prefix, and focuses on the main change without extraneous details.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

@RajuSudhar RajuSudhar changed the title refactor(sagemaker): consolidate SageMaker types into centralized pro… refactor(sagemaker): consolidate SageMaker types into centralized provider types Sep 28, 2025
@murdore
murdore requested a review from Copilot September 30, 2025 16:15
…vider types

Moves all SageMaker-specific type definitions from standalone types.ts module
into the centralized src/lib/types/providers.ts architecture.

## Changes
- **Moved types**: All SageMaker types (489 lines) from sagemaker/types.ts to types/providers.ts
- **Updated imports**: All SageMaker modules now import from "../../types/providers.js"
- **Deleted file**: Removed standalone src/lib/providers/sagemaker/types.ts
- **Centralized architecture**: SageMaker types now part of unified provider type system

## Benefits
- Consistent with overall types module architecture
- Single source of truth for all provider types
- Improved maintainability and discoverability
- Aligned with centralized type management strategy

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@murdore
murdore force-pushed the BZ-44700-sagemaker-module-types-refactor branch from 2fb041c to e6b3231 Compare September 30, 2025 16:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

Consolidates all SageMaker-specific type definitions from a standalone types.ts module into the centralized provider types architecture for improved maintainability and consistency.

  • Moved 489 lines of SageMaker types from sagemaker/types.ts to types/providers.ts
  • Updated all import statements across SageMaker modules to reference centralized types
  • Removed standalone types file to eliminate duplication

Reviewed Changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

File Description
src/lib/types/providers.ts Added all SageMaker type definitions (AdaptiveSemaphoreConfig, SageMakerConfig, etc.)
src/lib/providers/sagemaker/types.ts Completely removed standalone types file
src/lib/providers/sagemaker/*.ts Updated import paths to reference centralized provider types
src/lib/providers/amazonSagemaker.ts Updated import path for SageMaker types

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +761 to +777
export type AdaptiveSemaphoreConfig = {
initialConcurrency: number;
maxConcurrency: number;
minConcurrency: number;
};

/**
* Metrics for adaptive semaphore performance tracking
*/
export type AdaptiveSemaphoreMetrics = {
activeRequests: number;
currentConcurrency: number;
completedCount: number;
errorCount: number;
averageResponseTime: number;
waitingCount: number;
};

Copilot AI Sep 30, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Consider using interface instead of type for object definitions like AdaptiveSemaphoreConfig and AdaptiveSemaphoreMetrics to maintain consistency with the original implementation that used interfaces.

Suggested change
export type AdaptiveSemaphoreConfig = {
initialConcurrency: number;
maxConcurrency: number;
minConcurrency: number;
};
/**
* Metrics for adaptive semaphore performance tracking
*/
export type AdaptiveSemaphoreMetrics = {
activeRequests: number;
currentConcurrency: number;
completedCount: number;
errorCount: number;
averageResponseTime: number;
waitingCount: number;
};
export interface AdaptiveSemaphoreConfig {
initialConcurrency: number;
maxConcurrency: number;
minConcurrency: number;
}
/**
* Metrics for adaptive semaphore performance tracking
*/
export interface AdaptiveSemaphoreMetrics {
activeRequests: number;
currentConcurrency: number;
completedCount: number;
errorCount: number;
averageResponseTime: number;
waitingCount: number;
}

Copilot uses AI. Check for mistakes.
/**
* AWS configuration options for SageMaker client
*/
export type SageMakerConfig = {

Copilot AI Sep 30, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] The SageMakerConfig type definition should use interface instead of type to maintain consistency with the original implementation and other type definitions in the codebase.

Copilot uses AI. Check for mistakes.
@murdore
murdore merged commit a50c387 into juspay:release Oct 2, 2025
7 checks passed
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.

3 participants