( toolkit: T )
| 199 | * @category Schemas |
| 200 | */ |
| 201 | export const AllParts = <T extends Toolkit.Any | Toolkit.WithHandler<any>>( |
| 202 | toolkit: T |
| 203 | ): Schema.Schema<AllParts<T extends Toolkit.Any ? Toolkit.Tools<T> : Toolkit.WithHandlerTools<T>>, AllPartsEncoded> => { |
| 204 | const toolCalls: Array<Schema.Schema<ToolCallPart<string, any>, ToolCallPartEncoded>> = [] |
| 205 | const toolCallResults: Array<Schema.Schema<ToolResultPart<string, any, any>, ToolResultPartEncoded>> = [] |
| 206 | for (const tool of Object.values(toolkit.tools as Record<string, Tool.Any>)) { |
| 207 | toolCalls.push(ToolCallPart(tool.name, tool.parametersSchema as any)) |
| 208 | toolCallResults.push(ToolResultPart(tool.name, tool.successSchema, tool.failureSchema)) |
| 209 | } |
| 210 | return Schema.Union( |
| 211 | TextPart, |
| 212 | TextStartPart, |
| 213 | TextDeltaPart, |
| 214 | TextEndPart, |
| 215 | ReasoningPart, |
| 216 | ReasoningStartPart, |
| 217 | ReasoningDeltaPart, |
| 218 | ReasoningEndPart, |
| 219 | ToolParamsStartPart, |
| 220 | ToolParamsDeltaPart, |
| 221 | ToolParamsEndPart, |
| 222 | FilePart, |
| 223 | DocumentSourcePart, |
| 224 | UrlSourcePart, |
| 225 | ResponseMetadataPart, |
| 226 | FinishPart, |
| 227 | ErrorPart, |
| 228 | ...toolCalls, |
| 229 | ...toolCallResults |
| 230 | ) as any |
| 231 | } |
| 232 | |
| 233 | // ============================================================================= |
| 234 | // Generate Parts |
nothing calls this directly
no test coverage detected