adjusts openai schema validation to allow

ull stop sequence
This commit is contained in:
nai-degen 2024-06-07 14:29:18 -05:00
parent 7660ed8b94
commit ca4321b4cb
2 changed files with 3 additions and 2 deletions

View File

@ -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,

View File

@ -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()