发布

  • [OPIK-6833][BE] Support OpenAI Responses API for the OpenAI provider (Playground & LLM-as-a-Judge) (#7008)

    frostbyte_neo 发布于 2026-06-12 10:58:51 +00:00

    • [OPIK-6833] Add support for OpenAI Responses API in client generator
    • Introduced ApiPipelineMode enum to toggle between Chat Completions API and Responses API.
    • Implemented extractApiPipelineMode for dynamic pipeline mode detection.
    • Added newResponsesApiChatModel for modern Responses API support.
    • Updated dependencies to include langchain4j-open-ai-official for the Responses API.
    • [OPIK-6833] Migrate client generation to OpenAI official SDK and refactor timeout/logging configurations
    • Updated OpenAIClientGenerator to utilize the official OpenAI SDK (OpenAIOkHttpClient).
    • Added support for Timeout and LogLevel settings directly in the client configuration.
    • Refactored timeout configuration into a dedicated buildTimeout method.
    • Updated header configuration to align with the SDK's requirements and support multiple values per key.
    • [OPIK-6833] Add support for OpenAI Responses API and implement associated mappers and tests
    • Introduced LlmProviderOpenAiResponses for interfacing with OpenAI Responses API.
    • Added LlmProviderOpenAiResponsesMapper to handle DTO transformations between OpenAI and LangChain4j.
    • Refactored OpenAIClientGenerator to contextualize pipeline modes and instantiate appropriate clients.
    • Extended unit and integration tests for Responses API compatibility and validation, including mapper tests.
    • Updated OpenAILlmServiceProvider to integrate Responses API within service extraction logic.
    • [OPIK-6833] Add streaming support for OpenAI Responses API with client extensions and tests
    • Implemented newResponsesApiStreamingChatModel for streaming in OpenAIClientGenerator.
    • Extended LlmProviderOpenAiResponses to support streaming via StreamingChatModel.
    • Updated mappers in LlmProviderOpenAiResponsesMapper to handle streaming partial and final chunks.
    • Added tests for LlmProviderOpenAiResponses covering happy path, error cases, and realistic streaming scenarios.
    • Refactored OpenAILlmServiceProvider to integrate streaming configurations.
    • [OPIK-6833] Add tool-calling support in OpenAI Responses API mapper with tests
    • Extended LlmProviderOpenAiResponsesMapper to integrate tool specifications, tool calls, and tool result messages.
    • Implemented bidirectional transformations for tool-related constructs between LangChain4j and OpenAI formats.
    • Enhanced LlmProviderOpenAiResponsesTest with end-to-end tool loop round-trip scenarios.
    • Updated LlmProviderOpenAiResponses to handle multi-turn tool interaction workflows.
    • Added comprehensive unit and integration tests covering tool-calling behaviors.
    • [OPIK-6833] Add structured response format support with JSON object and schema mappings in OpenAI Responses API mapper
    • Enhanced LlmProviderOpenAiResponsesMapper to support structured response formats (json_object and json_schema).
    • Implemented bidirectional mapping for JSON schema and object formats between OpenAI and LangChain4j.
    • Added tests for structured output scenarios, ensuring correct handling for schema-based responses and different format types.
    • Included defensive logic for schema-less response formats and null response cases.
    • [OPIK-6833] Add pipeline mode selection for OpenAI in ManageAIProviderDialog
    • Introduced a dropdown for selecting OpenAI pipeline modes (Chat Completions API or Responses API) in CloudAIProviderDetails.
    • Updated form schema and state management to handle openaiPipelineMode.
    • Enhanced backend configuration logic to persist and pass pipeline mode settings for OpenAI providers.
    • Added contextual descriptions to assist users in selecting the appropriate pipeline mode.
    • [OPIK-6833] Fix missing newline at EOF in CloudAIProviderDetails file

    • [OPIK-6833] Add strict JSON schema support and enhance error handling in OpenAI Responses API

    • Updated OpenAIClientGenerator to support strict JSON schema mode via new overloads for newResponsesApiChatModel and newResponsesApiStreamingChatModel.
    • Enhanced LlmProviderOpenAiResponsesMapper to extract and validate strict mode from request response formats.
    • Refactored LlmProviderOpenAiResponses to build chat models per request, incorporating strict flag propagation.
    • Improved error handling for unsupported tool choices with explicit exceptions for named function specifications.
    • Added new test coverage for strict JSON schema handling, loose mode fallback, and error scenarios.
    • [OPIK-6833] Centralize default OpenAI pipeline mode in ManageAIProviderDialog schema
    • Introduced DEFAULT_OPENAI_PIPELINE_MODE constant for consistent fallback handling of OpenAI pipeline modes.
    • Replaced hardcoded "chat_completions_api" with DEFAULT_OPENAI_PIPELINE_MODE across form defaults, resets, and save payloads in ManageAIProviderDialog.
    • [OPIK-6833] Normalize OpenAI pipeline mode handling in ManageAIProviderDialog
    • Introduced normalizeOpenAiPipelineMode utility to ensure consistent casing and fallback logic for openaiPipelineMode.
    • Updated form schema and state management in ManageAIProviderDialog to use the normalization function.
    • Improved handling of legacy or improperly cased openaiPipelineMode values.
    • [OPIK-6833] Fixed ESLint issue

    • [OPIK-6833] Drop unsupported parameters in OpenAI Responses API mapper

    • Removed unsupported fields (frequency_penalty, presence_penalty) from requests to prevent validation failures.
    • Added warnings for dropped parameters via new warnIfDroppedSamplingParam method.
    • Introduced handling for OpikUserMessage to ensure proper mapping of custom multimodal messages.
    • Updated and extended test coverage for the new behaviors and edge cases.
    • [OPIK-6833] Improve OpenAI Responses API error handling and status mapping
    • Added mapping for "unsupported_parameter" errors to HTTP 400 in OpenAiCompatStatusCodes.
    • Enhanced error extraction in LlmProviderOpenAiResponses to handle OpenAIServiceException and provide precise diagnostic information.
    • Introduced fallback logic for unrecognized error codes using high-level types or status codes.
    • Updated tests to cover new error-handling logic, including nested exceptions and fallback scenarios.
    • [OPIK-6833] Strip unsupported top_p parameter for OpenAI reasoning models
    • Updated modelUtils to remove top_p for reasoning models, preventing 400 errors due to unsupported parameters.
    • Modified PromptModelSettings to hide top_p slider for applicable models in the UI.
    • Added tests to ensure consistent clearing of stale top_p values during configuration updates and request sanitization.
    • [OPIK-6833] Replace Select component with SelectBox in CloudAIProviderDetails
    • Updated pipeline mode selection to use the SelectBox component for improved consistency and code simplification.
    • Adjusted type definitions and form handling to align with the new dropdown component.
    • [OPIK-6833] Centralize OpenAI pipeline mode values in types/providers
    • Moved OPENAI_PIPELINE_MODE_VALUES and OpenAiPipelineMode type to types/providers for reusability and consistency.
    • Updated ManageAIProviderDialog schema to import and use centralized pipeline mode definitions.
    • [OPIK-6833] Refine OpenAI pipeline mode handling in ManageAIProviderDialog
    • Ensured that openaiPipelineMode is safely seeded in form defaults for OpenAI configurations.
    • Removed redundant DEFAULT_OPENAI_PIPELINE_MODE usage, relying instead on guaranteed non-null assertions.
    • Updated related form handling and comments for clarity and maintainability.
    • [OPIK-6833] Extract OpenAiResponsesStreamingHandler for response handling
    • Moved inline StreamingChatResponseHandler implementation to OpenAiResponsesStreamingHandler for clarity and reusability.
    • Updated LlmProviderOpenAiResponses to use the new handler class while preserving existing functionality.
    • [OPIK-6833] Refactor tests and replace inline request creation with reusable builder methods
    • Consolidated repetitive ChatCompletionRequest.builder() calls into reusable helper methods to improve test readability and maintainability.
    • Updated all relevant tests to utilize requestBuilder variants.
    • Adjusted constants and mapping logic for consistency with OpenAI Responses API requirements, including modelName placeholder updates.
    • Improved assertions to dynamically adapt to request fields, reducing hardcoded values.
    下载附件