small cohere fix

This commit is contained in:
reanon
2025-05-05 13:59:53 +02:00
parent 6374bfdee1
commit f2b55ebabb
2 changed files with 8 additions and 5 deletions
+2 -2
View File
@@ -156,8 +156,8 @@ function removeUnsupportedParameters(req: Request) {
// Transform to Cohere's format if needed
const jsonSchema = req.body.response_format.schema;
req.body.response_format = {
type: "json_schema",
json_schema: jsonSchema
type: "json_object",
schema: jsonSchema
};
}
@@ -119,11 +119,14 @@ export const validateContextSize: RequestPreprocessor = async (req) => {
modelMax = 64000;
} else if (model.match(/^grok/)) {
modelMax = 128000;
} else if (model.match(/command-a-03/)) {
} else if (model.match(/command-a-03-202[0-9]/)) {
// Cohere's command-a-03 models have 256k context window
modelMax = 256000;
} else if (model.match(/command/)) {
// Other Cohere command models have 128k context window
} else if (model.match(/command[\w-]*-03-202[0-9]/)) {
// Other Command models with -03- pattern (including r, r-plus) have 128k context window
modelMax = 128000;
} else if (model.match(/command/) || model.match(/cohere/)) {
// Default for all other Cohere models
modelMax = 128000;
} else if (model.match(/tral/)) {
// catches mistral, mixtral, codestral, mathstral, etc. mistral models have