Skip to content

Conversation

@shanghongsim
Copy link
Contributor

Description

  1. Consume reasoning argument of ChatCompletions object
    Reasoning/hybrid models like Kimi K2, DeepSeek v3.1, GPT OSS 120B returns thinking traces in the reasoning argument of ChatCompletionMessage object.
ChatCompletionMessage(content='Of course! The capital of France is **Paris**.', refusal=None, role='assistant', annotations=None, audio=None, function_call=None, tool_calls=[], reasoning="Hmm, the user is asking a straightforward factual question about the capital of France. This is a common knowledge query with a clear answer. \n\nI recall that Paris is the capital and has been for centuries, so I can confirm that directly. Since the question is simple, no additional context or elaboration is needed unless the user asks for more. \n\nI'll keep the response concise and accurate, just stating the answer with a brief mention of its historical status to add slight value without overcomplicating it.")

Currently, Oumi conversations only consumes the content argument of ChatCompletionMessage object. This PR modifies TogetherAI inference engine API to concatenate reasoning and content fields of the ChatCompletionMessage for the content field of oumi Conversations output.

  1. Enable reasoning in API
    Hybrid models like DeepSeek-V3.1 need "reasoning": {"enabled": True}, to be passed in via API input to turn on reasoning. This PR adds optional api_kwargs to RemoteParams to allow users to pass in such arguments.

Related issues

Fixes # (issue)

Before submitting

  • This PR only changes documentation. (You can ignore the following checks in that case)
  • Did you read the contributor guideline Pull Request guidelines?
  • Did you link the issue(s) related to this PR in the section above?
  • Did you add / update tests where needed?

Reviewers

At least one review from a member of oumi-ai/oumi-staff is required.

@wizeng23
Copy link
Contributor

wizeng23 commented Dec 2, 2025

I don't see any logic changes in this PR, only test changes

)

@override
def _convert_conversation_to_api_input(
Copy link
Contributor

Choose a reason for hiding this comment

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

Per DRY, and to make sure this implementation doesn't diverge from the parent class over time, could you call super._convert_conversation_to_api_input() and then add any modifications you need after that? Ditto for _convert_api_output_to_conversation.

@shanghongsim shanghongsim requested a review from wizeng23 December 3, 2025 00:09
api_kwargs: Optional[dict[str, Any]] = None
"""Additional keyword arguments to pass to the API.
This allows for passing any API-specific parameters that are not
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a comment here that this is currently only used for the together inference engine?

Returns:
Conversation: The conversation including the generated response.
"""
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite get what this try-except is trying to do. If the try-block fails, then super()._convert_api_output_to_conversation will also fail because it will also try to extract message the exact same way right?

response, original_conversation
)

if "reasoning" in message and "</think>" not in message.get("content", ""):
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know if any other inference provider may include a "reasoning" field? If this is a common convention, we should move the logic in this function into the parent class RemoteInferenceEngine.


# Then layer on Together-specific / remote-specific kwargs
remote_params = self._remote_params
if remote_params.api_kwargs:
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto here; do you know of any other inference engines that could benefit from this? Should this logic be in RemoteInferenceEngine?

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