mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-02 06:23:35 +00:00
18 lines
555 B
TypeScript
18 lines
555 B
TypeScript
/**
|
|
* Filters Codex dynamic tools for turns that already contain image inputs so
|
|
* models with native vision do not get redundant image-inspection tools.
|
|
*/
|
|
/** Removes the image tool when the model can directly consume inbound images. */
|
|
export function filterToolsForVisionInputs<T extends { name?: string }>(
|
|
tools: T[],
|
|
params: {
|
|
modelHasVision: boolean;
|
|
hasInboundImages: boolean;
|
|
},
|
|
): T[] {
|
|
if (!params.modelHasVision || !params.hasInboundImages) {
|
|
return tools;
|
|
}
|
|
return tools.filter((tool) => tool.name !== "image");
|
|
}
|