{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "#/components/schemas/ChatRequest", "title": "ChatRequest", "type": "object", "required": [ "model", "messages" ], "properties": { "model": { "type": "string", "description": "The name of a compatible Cohere model to use for generation.", "example": "command-r-plus" }, "messages": { "type": "array", "description": "A list of chat messages in chronological order representing a conversation between the user and the model. Messages can be from User, Assistant, Tool, and System roles.", "items": { "$ref": "#/components/schemas/Message" } }, "tools": { "type": "array", "description": "A list of tools (functions) available to the model. The model may choose to call these tools during generation. Each tool is defined with a name, description, and JSON schema for parameters.", "items": { "$ref": "#/components/schemas/Tool" } }, "max_tokens": { "type": "integer", "description": "The maximum number of output tokens the model will generate in the response. If not set, defaults to the model's maximum output token limit.", "minimum": 1 }, "stop_sequences": { "type": "array", "description": "A list of up to 5 strings that the model will use to stop generation. If the model generates a string matching any entry, it will stop generating tokens.", "items": { "type": "string" }, "maxItems": 5 }, "temperature": { "type": "number", "description": "A non-negative float that tunes the degree of randomness in generation. Lower temperatures mean less random generations and higher temperatures mean more random generations. Defaults to 0.3.", "minimum": 0, "maximum": 2, "default": 0.3 }, "response_format": { "type": "object", "description": "Controls the format of the model's output. Set type to json_object to force JSON output. Optionally provide a JSON Schema to ensure a specific structure.", "properties": { "type": { "type": "string", "enum": [ "text", "json_object" ], "description": "The format type for the response output." }, "json_schema": { "type": "object", "description": "An optional JSON Schema that the output must conform to when type is json_object." } } }, "safety_mode": { "type": "string", "enum": [ "CONTEXTUAL", "STRICT", "NONE" ], "description": "Used to select the safety instruction inserted into the prompt. Defaults to CONTEXTUAL.", "default": "CONTEXTUAL" } } }