Open History to see the last commit
1import { computerUseTool as baseComputerUseTool } from '@tanstack/openai-base'
2import type { ProviderTool } from '@tanstack/ai'
3import type { ComputerUseToolConfig } from '@tanstack/openai-base'
4
5export {
6 type ComputerUseToolConfig,
7 type ComputerUseTool,
8 convertComputerUseToolToAdapterFormat,
9} from '@tanstack/openai-base'
10
11// The brand discriminator (`computer_use`) intentionally differs from the
12// runtime tool name (`computer_use_preview`). The brand matches the model-meta
13// tool-capability union (`tools: ['computer_use', ...]`) used to gate which
14// models can construct this tool at compile time, while the runtime name
15// matches the OpenAI SDK's literal `'computer_use_preview'`. The base factory
16// records the canonical `computer_use` kind separately in adapter metadata.
17export type OpenAIComputerUseTool = ProviderTool<'openai', 'computer_use'>
18
19/**
20 * Creates a standard Tool from ComputerUseTool parameters, branded as an
21 * OpenAI provider tool.
22 */
23export function computerUseTool(
24 toolData: ComputerUseToolConfig,
25): OpenAIComputerUseTool {
26 return baseComputerUseTool(toolData) as OpenAIComputerUseTool
27}