| 1143 | > => Object.assign(Object.create(ProviderDefinedProto), { annotations: Context.empty(), ...options }) |
| 1144 | |
| 1145 | const dynamicProto = < |
| 1146 | const Name extends string, |
| 1147 | Parameters extends Schema.Constraint | JsonSchema.JsonSchema, |
| 1148 | Success extends Schema.Constraint, |
| 1149 | Failure extends Schema.Constraint, |
| 1150 | Mode extends FailureMode |
| 1151 | >(options: { |
| 1152 | readonly name: Name |
| 1153 | readonly description?: string | undefined |
| 1154 | readonly parametersSchema: Parameters |
| 1155 | readonly successSchema: Success |
| 1156 | readonly failureSchema: Failure |
| 1157 | readonly annotations: Context.Context<never> |
| 1158 | readonly failureMode: Mode |
| 1159 | readonly needsApproval?: NeedsApproval<any> | undefined |
| 1160 | readonly jsonSchema: JsonSchema.JsonSchema | undefined |
| 1161 | }): Dynamic< |
| 1162 | Name, |
| 1163 | { |
| 1164 | readonly parameters: Parameters |
| 1165 | readonly success: Success |
| 1166 | readonly failure: Failure |
| 1167 | readonly failureMode: Mode |
| 1168 | } |
| 1169 | > => { |
| 1170 | const self = Object.assign(Object.create(DynamicProto), options) |
| 1171 | self.id = `effect/ai/Tool/${options.name}` |
| 1172 | return self |
| 1173 | } |
| 1174 | |
| 1175 | /** |
| 1176 | * Creates a user-defined tool with the specified name and configuration. |