| 160 | } |
| 161 | |
| 162 | function nativeSchema(value: unknown): JsonSchema { |
| 163 | if (!value || typeof value !== "object") return { type: "object", properties: {} } |
| 164 | if ("jsonSchema" in value && value.jsonSchema && typeof value.jsonSchema === "object") |
| 165 | return value.jsonSchema as JsonSchema |
| 166 | return asSchema(value as Parameters<typeof asSchema>[0]).jsonSchema as JsonSchema |
| 167 | } |
| 168 | |
| 169 | export function nativeTools(tools: Record<string, Tool>, input: Pick<StreamInput, "messages" | "abort">) { |
| 170 | return Object.fromEntries( |