mirror of
https://github.com/NousResearch/atropos.git
synced 2026-04-19 12:57:58 +00:00
Refactor ManagedServer to retain full content including <think> blocks for downstream processing. Removed reasoning content extraction and associated attributes to streamline choice construction.
This commit is contained in:
parent
95bbffc34f
commit
8f18614320
1 changed files with 3 additions and 21 deletions
|
|
@ -422,23 +422,9 @@ class ManagedServer:
|
|||
except Exception:
|
||||
pass # Fall through to no tool calls
|
||||
|
||||
# Extract reasoning content from <think> blocks or similar
|
||||
reasoning_content = None
|
||||
final_content = parsed_content
|
||||
import re as _re
|
||||
|
||||
think_match = _re.search(
|
||||
r"<think>(.*?)</think>", final_content or "", _re.DOTALL
|
||||
)
|
||||
if think_match:
|
||||
reasoning_content = think_match.group(1).strip()
|
||||
# Strip <think> blocks from content
|
||||
final_content = _re.sub(
|
||||
r"<think>.*?</think>", "", final_content, flags=_re.DOTALL
|
||||
).strip()
|
||||
|
||||
# Build choice with tool_calls and reasoning if found
|
||||
message_kwargs = {"content": final_content or "", "role": "assistant"}
|
||||
# Build choice - keep full content including any <think> blocks,
|
||||
# since downstream reward functions handle their own parsing
|
||||
message_kwargs = {"content": parsed_content or "", "role": "assistant"}
|
||||
choice = Choice(
|
||||
finish_reason=parsed_finish_reason,
|
||||
index=i,
|
||||
|
|
@ -449,10 +435,6 @@ class ManagedServer:
|
|||
if parsed_tool_calls:
|
||||
choice.message.tool_calls = parsed_tool_calls
|
||||
|
||||
# Attach reasoning_content as an extra attribute
|
||||
if reasoning_content:
|
||||
choice.message.reasoning_content = reasoning_content
|
||||
|
||||
choices.append(choice)
|
||||
|
||||
# Construct ChatCompletion response
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue