diff --git a/src/shared/api-schemas/anthropic.ts b/src/shared/api-schemas/anthropic.ts index fedb052..bb279d2 100644 --- a/src/shared/api-schemas/anthropic.ts +++ b/src/shared/api-schemas/anthropic.ts @@ -119,7 +119,8 @@ export const transformOpenAIToAnthropicChat: APIFormatTransformer< stream: rest.stream, temperature: rest.temperature, top_p: rest.top_p, - stop_sequences: typeof rest.stop === "string" ? [rest.stop] : rest.stop, + stop_sequences: + typeof rest.stop === "string" ? [rest.stop] : rest.stop || undefined, ...(rest.user ? { metadata: { user_id: rest.user } } : {}), // Anthropic supports top_k, but OpenAI does not // OpenAI supports frequency_penalty, presence_penalty, logit_bias, n, seed, diff --git a/src/shared/api-schemas/openai.ts b/src/shared/api-schemas/openai.ts index ca2edee..0f0e420 100644 --- a/src/shared/api-schemas/openai.ts +++ b/src/shared/api-schemas/openai.ts @@ -47,7 +47,7 @@ export const OpenAIV1ChatCompletionSchema = z stream: z.boolean().optional().default(false), stop: z .union([z.string().max(500), z.array(z.string().max(500))]) - .optional(), + .nullish(), max_tokens: z.coerce .number() .int()