From f7f0ccff0e04ebf3eb50b7562d15506b7a4b9c54 Mon Sep 17 00:00:00 2001 From: Justin Spahr-Summers Date: Wed, 6 Nov 2024 11:56:05 +0000 Subject: [PATCH] Declare known `stopReason`s, as a kind of documentation --- src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/types.ts b/src/types.ts index bbcd4424..8ff6f65b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -868,7 +868,7 @@ export const CreateMessageResultSchema = ResultSchema.extend({ /** * The reason why sampling stopped. */ - stopReason: z.optional(z.string()), + stopReason: z.optional(z.enum(["endTurn", "stopSequence", "maxTokens"]).or(z.string())), role: z.enum(["user", "assistant"]), content: z.discriminatedUnion("type", [ TextContentSchema,