Skip to content

Conversation

@caioSalchesttes
Copy link

@caioSalchesttes caioSalchesttes commented Dec 15, 2025

Add ASSISTANT role to ResponseInputItem and ResponseInputMessageItem

Summary

This PR adds support for the assistant role in both ResponseInputItem.Message.Role and ResponseInputMessageItem.Role enums, enabling server-side conversation state management.

Related Issues

This issue is also mentioned in #585.

Changes

  • Added ASSISTANT constant to Role companion objects in both files
  • Added ASSISTANT to Known and Value enums
  • Updated value() and known() methods to handle ASSISTANT case
  • Updated documentation to include assistant as a valid role option

Motivation

When managing conversation state on the server side (the service calling the API), adding assistant messages to the conversation history allows:

  1. Client-side state control: The server can maintain and control the full conversation history, including assistant responses, without relying solely on OpenAI's provided history.

  2. Flexible history management: By including assistant role messages in the input, applications can:

    • Build custom conversation flows
    • Implement their own history persistence
    • Control which messages are included in context
    • Not necessarily use the history provided by OpenAI
  3. API compatibility: This change aligns the SDK with the OpenAI API's support for assistant role in message inputs, enabling full utilization of the API's capabilities.

Testing

  • ✅ No linter errors
  • ✅ All enum cases properly handled
  • ✅ Documentation updated

Files Changed

  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputItem.kt
  • openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseInputMessageItem.kt

@caioSalchesttes caioSalchesttes requested a review from a team as a code owner December 15, 2025 18:12
@caioSalchesttes caioSalchesttes changed the title fix: Add ASSISTANT role to ResponseInputItem message input fix: Add ASSISTANT role to ResponseInputItem message input (#585) Dec 15, 2025
@caioSalchesttes caioSalchesttes changed the title fix: Add ASSISTANT role to ResponseInputItem message input (#585) fix: Add ASSISTANT role to ResponseInputItem message input Dec 15, 2025
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.

1 participant