diff --git a/src/shared/api-schemas/anthropic.ts b/src/shared/api-schemas/anthropic.ts index bce5730..02216d2 100644 --- a/src/shared/api-schemas/anthropic.ts +++ b/src/shared/api-schemas/anthropic.ts @@ -82,7 +82,7 @@ function openAIMessagesToClaudeTextPrompt(messages: OpenAIChatMessage[]) { let role: string = m.role; if (role === "assistant") { role = "Assistant"; - } else if (role === "system") { + } else if (["system", "developer"].includes(role)) { role = "System"; } else if (role === "user") { role = "Human"; @@ -365,7 +365,7 @@ function openAIMessagesToClaudeChatPrompt(messages: OpenAIChatMessage[]): { // Here we will lose the original name if it was a system message, but that // is generally okay because the system message is usually a prompt and not // a character in the chat. - const name = msg.role === "system" ? "System" : msg.name?.trim(); + const name = ["system", "developer"].includes(msg.role) ? "System" : msg.name?.trim(); const content = convertOpenAIContent(msg.content); // Prepend the display name to the first text content in the current message @@ -395,8 +395,8 @@ function openAIMessagesToClaudeChatPrompt(messages: OpenAIChatMessage[]): { function isSystemOpenAIRole( role: OpenAIChatMessage["role"] -): role is "system" | "function" | "tool" { - return ["system", "function", "tool"].includes(role); +): role is "developer" | "system" | "function" | "tool" { + return ["developer","system", "function", "tool"].includes(role); } function getFirstTextContent(content: OpenAIChatMessage["content"]) { diff --git a/src/shared/api-schemas/openai.ts b/src/shared/api-schemas/openai.ts index d4be629..714dec5 100644 --- a/src/shared/api-schemas/openai.ts +++ b/src/shared/api-schemas/openai.ts @@ -21,7 +21,7 @@ export const OpenAIV1ChatCompletionSchema = z model: z.string().max(100), messages: z.array( z.object({ - role: z.enum(["system", "user", "assistant", "tool", "function"]), + role: z.enum(["developer", "system", "user", "assistant", "tool", "function"]), content: z.union([z.string(), OpenAIV1ChatContentArraySchema]), name: z.string().optional(), tool_calls: z.array(z.any()).optional(), @@ -78,6 +78,7 @@ export const OpenAIV1ChatCompletionSchema = z tool_choice: z.any().optional(), function_choice: z.any().optional(), response_format: z.any(), + reasoning_effort: z.enum(["low", "medium", "high"]).optional(), }) // Tool usage must be enabled via config because we currently have no way to // track quota usage for them or enforce limits.