Skip to content

Commit 13fe76a

Browse files
fix: replace invalid 'reasoning' dict with 'reasoning_effort' string param
The openai SDK does not accept a 'reasoning' dict parameter in AsyncCompletions.create(). The correct parameter is 'reasoning_effort' (a string like 'high'). This fixes the runtime error in the map stage: AsyncCompletions.create() got an unexpected keyword argument 'reasoning' Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8255859 commit 13fe76a

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/ContentProcessor/src/libs/agent_framework/agent_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ def create_agent(
774774
temperature=0.7,
775775
max_tokens=500,
776776
additional_chat_options={
777-
"reasoning": {"effort": "high", "summary": "concise"}
777+
"reasoning_effort": "high"
778778
}, # OpenAI-specific reasoning options
779779
)
780780

src/ContentProcessor/src/libs/pipeline/handlers/map_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ async def execute(self, context: MessageContext) -> StepResult:
250250
.with_top_p(0.1)
251251
.with_response_format(schema_class)
252252
.with_additional_chat_options({
253-
"reasoning": {"effort": "high", "summary": "detailed"}
253+
"reasoning_effort": "high"
254254
})
255255
.build()
256256
)

src/ContentProcessorWorkflow/src/libs/agent_framework/agent_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ def create_agent(
822822
temperature=0.7,
823823
max_tokens=500,
824824
additional_chat_options={
825-
"reasoning": {"effort": "high", "summary": "concise"}
825+
"reasoning_effort": "high"
826826
}, # OpenAI-specific reasoning options
827827
)
828828

src/ContentProcessorWorkflow/tests/unit/libs/agent_framework/test_agent_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_extra_kwargs_forwarded(self, mock_chat_agent):
131131
class TestAdditionalChatOptions:
132132
def test_stores_options(self):
133133
client = _fake_chat_client()
134-
opts = {"reasoning": {"effort": "high"}}
134+
opts = {"reasoning_effort": "high"}
135135
builder = AgentBuilder(client).with_additional_chat_options(opts)
136136
assert builder._additional_chat_options == opts
137137

src/tests/ContentProcessorWorkflow/libs/agent_framework/test_agent_builder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def test_extra_kwargs_forwarded(self, mock_chat_agent):
131131
class TestAdditionalChatOptions:
132132
def test_stores_options(self):
133133
client = _fake_chat_client()
134-
opts = {"reasoning": {"effort": "high"}}
134+
opts = {"reasoning_effort": "high"}
135135
builder = AgentBuilder(client).with_additional_chat_options(opts)
136136
assert builder._additional_chat_options == opts
137137

0 commit comments

Comments
 (0)