Skip to content

Commit c373cd6

Browse files
oleghalinsixlive
andauthored
fix(openrouter): de-duplicate tool merging logic (#923)
Co-authored-by: TJ Miller <tj@themillers.co>
1 parent 37a087f commit c373cd6

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/Providers/OpenRouter/Concerns/BuildsRequestOptions.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,10 @@ protected function buildRequestOptions(TextRequest|StructuredRequest $request, a
2727
'temperature' => $request->temperature(),
2828
'top_p' => $request->topP(),
2929
'max_tokens' => $request->maxTokens(),
30+
'tools' => ToolMap::map($request->tools()),
31+
'tool_choice' => ToolChoiceMap::map($request->toolChoice()),
3032
]));
3133

32-
if ($request instanceof TextRequest) {
33-
$options = array_merge($options, Arr::whereNotNull([
34-
'tools' => ToolMap::map($request->tools()),
35-
'tool_choice' => ToolChoiceMap::map($request->toolChoice()),
36-
]));
37-
}
38-
3934
return Arr::whereNotNull(array_merge($options, $additional));
4035
}
4136
}

0 commit comments

Comments
 (0)