Skip to content

feat: Support compressed requests in the RPT client#1488

Open
davidkna-sap wants to merge 6 commits intomainfrom
davidkna-sap_rpt-compress
Open

feat: Support compressed requests in the RPT client#1488
davidkna-sap wants to merge 6 commits intomainfrom
davidkna-sap_rpt-compress

Conversation

@davidkna-sap
Copy link
Member

@davidkna-sap davidkna-sap commented Jan 30, 2026

Context

Closes SAP/ai-sdk-js-backlog#470.
Needs SAP/cloud-sdk-js#6291

What this PR does and why it is needed

@davidkna-sap davidkna-sap force-pushed the davidkna-sap_rpt-compress branch from 092323c to 35f8548 Compare January 30, 2026 15:28
Copy link
Member Author

Choose a reason for hiding this comment

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

Caution

Vendored from SAP/cloud-sdk-js#6291

@davidkna-sap davidkna-sap force-pushed the davidkna-sap_rpt-compress branch 2 times, most recently from 62534e3 to ff34a97 Compare January 30, 2026 15:41
@davidkna-sap davidkna-sap force-pushed the davidkna-sap_rpt-compress branch from ff34a97 to 846d2c4 Compare January 30, 2026 15:44
@davidkna-sap davidkna-sap marked this pull request as ready for review January 30, 2026 16:05
@davidkna-sap davidkna-sap force-pushed the davidkna-sap_rpt-compress branch from 7201599 to b871f28 Compare February 3, 2026 15:43
@hyperspace-insights
Copy link
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Support Compressed Requests in the RPT Client

New Features

Request Compression Support: The RPT client now automatically compresses prediction requests with payloads of 1024 bytes or larger using gzip compression by default. This feature helps reduce network bandwidth usage and improve request performance for large datasets.

Custom HTTP Request Configuration: Added support for custom HTTP request options through the new customRequest parameter in predictWithSchema() and predictWithoutSchema() methods, enabling configuration of headers, timeout, middlewares, and compression settings.

Changes

  • .changeset/new-tigers-guess.md: Added changelog entry for generic HTTP request configuration support via RptRequestOptions parameter
  • .changeset/true-dolls-say.md: Added changelog entry for automatic request compression feature with configurable compression settings
  • packages/rpt/package.json: Added @sap-cloud-sdk/http-client dependency for HTTP client functionality
  • packages/rpt/src/client.ts:
    • Refactored executePrediction() to use executeRequest() from @sap-ai-sdk/core instead of generated API client
    • Added customRequest parameter to predictWithSchema() and predictWithoutSchema() methods
    • Integrated compression middleware that automatically applies gzip compression to requests meeting size threshold
    • Added support for configurable compression via requestCompression option
  • packages/rpt/src/index.ts: Exported new types RptRequestOptions, RptRequestCompressionAlgorithm, RptRequestCompressionMiddlewareOptions, and RequestCompressionMiddlewareOptions
  • packages/rpt/src/types.ts:
    • Defined RptRequestCompressionAlgorithm type (currently supporting 'gzip')
    • Added RptRequestCompressionMiddlewareOptions interface for compression configuration
    • Created RptRequestOptions interface extending CustomRequestConfig with compression support
  • packages/rpt/src/vendor/compress-request-middleware.ts: Vendored compression middleware implementation supporting multiple algorithms (gzip, brotli, deflate, zstd) with configurable compression modes and thresholds
  • packages/rpt/src/vendor/index.ts: Created vendor module barrel export
  • sample-code/src/index.ts: Exported new predictWithSchemaCompressed sample function
  • sample-code/src/rpt.ts: Added predictWithSchemaCompressed() example demonstrating forced compression with configurable algorithm
  • tests/e2e-tests/src/rpt.test.ts: Added end-to-end test validating gzip compression functionality

GitHub Issues:


  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.17.50 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback


💌 Have ideas or want to contribute? Create an issue and share your thoughts with us!
📑 Check out the documentation for more information.
📬 Subscribe to our mailing list to get the latest announcements and pilot features!

Made with ❤️ by Hyperspace.

@hyperspace-insights hyperspace-insights bot deleted a comment from davidkna-sap Feb 4, 2026
Copy link
Contributor

@hyperspace-insights hyperspace-insights bot left a comment

Choose a reason for hiding this comment

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

The code quality is generally good with clear intent and proper typing. A few naming inconsistencies and a grammatical error in documentation should be addressed for clarity and maintainability.

PR Bot Information

Version: 1.17.50 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • Event Trigger: issue_comment.created
  • LLM: anthropic--claude-4.5-sonnet
  • Correlation ID: a1e74340-01cc-11f1-8ba4-2cd32fc9729d

@hyperspace-insights hyperspace-insights bot deleted a comment from davidkna-sap Feb 4, 2026
Co-authored-by: hyperspace-insights[bot] <209611008+hyperspace-insights[bot]@users.noreply.github.com>
@davidkna-sap davidkna-sap added the blocked Issue or PR blocked due to other issues. label Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Issue or PR blocked due to other issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant