Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

apply-patch-tool.ts

36 lines981 Bytes

1import { openAIProviderTool } from './openai-provider-tool'
2import type { ApplyPatchTool as ApplyPatchToolConfig } from 'openai/resources/responses/responses'
3import type { Tool } from '@tanstack/ai'
4​
5export type { ApplyPatchToolConfig }
6​
7/** @deprecated Renamed to `ApplyPatchToolConfig`. Will be removed in a future release. */
8export type ApplyPatchTool = ApplyPatchToolConfig
9​
10/**
11 * Converts a standard Tool to OpenAI ApplyPatchTool format
12 */
13export function convertApplyPatchToolToAdapterFormat(
14 _tool: Tool,
15): ApplyPatchToolConfig {
16 return {
17 type: 'apply_patch',
18 }
20​
21/**
22 * Creates a standard Tool from ApplyPatchTool parameters.
23 *
24 * Base (non-branded) factory. Providers that need branded return types should
25 * re-wrap this in their own package.
26 */
27export function applyPatchTool(): Tool {
28 return openAIProviderTool(
29 {
30 name: 'apply_patch',
31 description: 'Apply a patch to modify files',
32 metadata: {},
33 },
34 'apply_patch',
35 )