split up
This commit is contained in:
14
agent/find-tool-call.ts
Normal file
14
agent/find-tool-call.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { z, ZodTypeAny } from "zod";
|
||||
|
||||
interface ToolCall {
|
||||
name: string;
|
||||
args: Record<string, any>;
|
||||
id?: string;
|
||||
type?: "tool_call";
|
||||
}
|
||||
|
||||
export function findToolCall<Name extends string>(name: Name) {
|
||||
return <Args extends ZodTypeAny>(
|
||||
x: ToolCall,
|
||||
): x is { name: Name; args: z.infer<Args> } => x.name === name;
|
||||
}
|
||||
Reference in New Issue
Block a user