Skip to content

Migrate from Azure OpenAI Java SDK to OpenAI Java Library #3368

@Reasch

Description

@Reasch

Feature Request: Migrate from Azure OpenAI Java SDK to OpenAI Java Library

Summary

Request to add support for the official OpenAI Java library (openai-java) in Spring AI, as the Azure OpenAI Java SDK has been deprecated and is no longer receiving updates.

Background

The Azure OpenAI Java SDK (previously used by Spring AI) has been officially deprecated and Microsoft is directing users to migrate to the community-maintained OpenAI Java library. This change affects Spring AI users who rely on OpenAI integration through Azure endpoints.

Current Status:

  • Azure OpenAI Java SDK: ⚠️ Deprecated - No longer receiving updates
  • Recommended Alternative: [OpenAI Java Library]- Actively maintained community project

Motivation

  1. Sustainability: The current Azure OpenAI SDK will not receive security updates or new features
  2. Future Compatibility: New OpenAI API features will only be available through the actively maintained library
  3. Community Support: The OpenAI Java library has active community support and regular updates
  4. API Parity: Ensures continued compatibility with latest OpenAI API capabilities

Proposed Solution

Implement support for the OpenAI Java library while maintaining backward compatibility where possible.

Suggested Implementation Approach:

  1. Add new dependency: Include openai-java library as an optional dependency
  2. Create new configuration classes: Implement Spring Boot auto-configuration for the new library
  3. Maintain existing interfaces: Keep current Spring AI interfaces to minimize breaking changes
  4. Provide migration guide: Document the transition path for existing users
  5. Deprecation timeline: Establish a timeline for phasing out the old Azure SDK integration

Benefits

  • Long-term maintainability: Ensures Spring AI remains up-to-date with OpenAI developments
  • Enhanced features: Access to latest OpenAI API capabilities
  • Better performance: Potential improvements from actively maintained library
  • Community alignment: Aligns with OpenAI ecosystem recommendations

Compatibility Considerations

  • Maintain existing Spring AI API surface to minimize migration effort
  • Provide clear migration documentation
  • Consider supporting both libraries during a transition period
  • Ensure Azure OpenAI endpoints continue to work with the new library

Implementation Tasks

  • Research OpenAI Java library integration requirements
  • Design new auto-configuration classes
  • Implement new client adapters
  • Create comprehensive tests
  • Write migration documentation
  • Update Spring AI documentation

Alternative Solutions Considered

  1. Continue with deprecated Azure SDK: Not viable due to lack of updates
  2. Custom HTTP client implementation: More maintenance overhead
  3. Multiple library support: Increases complexity but may be necessary during transition

Impact Assessment

  • Breaking Changes: Minimal if existing interfaces are preserved
  • Migration Effort: Medium - requires configuration updates
  • Timeline: Suggest implementation in next major/minor release

References

Community Input

This feature request addresses a critical dependency issue that affects all Spring AI users leveraging OpenAI integration. Community feedback and contributions would be valuable for ensuring a smooth transition.


Priority: High - Due to deprecated dependency security and maintenance concerns
Type: Enhancement/Migration
Area: Core Integration

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions