import type * as Cohere from "../../index";
/**
 * @example
 *     {
 *         model: "command-a-03-2025",
 *         message: "Tell me about LLMs"
 *     }
 *
 * @example
 *     {
 *         model: "command-a-03-2025",
 *         message: "Who is more popular: Nsync or Backstreet Boys?",
 *         documents: [{
 *                 "title": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters",
 *                 "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: Backstreet Boys Popularity Analysis\n\nHern\u00E1n Lopez Posted on February 9, 2017 Posted in CSPC 72 Comments Tagged with Backstreet Boys, Boy band\n\nAt one point, Backstreet Boys defined success: massive albums sales across the globe, great singles sales, plenty of chart topping releases, hugely hyped tours and tremendous media coverage.\n\nIt is true that they benefited from extraordinarily good market conditions in all markets. After all, the all-time record year for the music business, as far as revenues in billion dollars are concerned, was actually 1999. That is, back when this five men group was at its peak."
 *             }, {
 *                 "title": "CSPC: NSYNC Popularity Analysis - ChartMasters",
 *                 "snippet": "\u2193 Skip to Main Content\n\nMusic industry \u2013 One step closer to being accurate\n\nCSPC: NSYNC Popularity Analysis\n\nMJD Posted on February 9, 2018 Posted in CSPC 27 Comments Tagged with Boy band, N'Sync\n\nAt the turn of the millennium three teen acts were huge in the US, the Backstreet Boys, Britney Spears and NSYNC. The latter is the only one we haven\u2019t study so far. It took 15 years and Adele to break their record of 2,4 million units sold of No Strings Attached in its first week alone.\n\nIt wasn\u2019t a fluke, as the second fastest selling album of the Soundscan era prior 2015, was also theirs since Celebrity debuted with 1,88 million units sold."
 *             }, {
 *                 "title": "CSPC: Backstreet Boys Popularity Analysis - ChartMasters",
 *                 "snippet": "1997, 1998, 2000 and 2001 also rank amongst some of the very best years.\nYet the way many music consumers \u2013 especially teenagers and young women\u2019s \u2013 embraced their output deserves its own chapter. If Jonas Brothers and more recently One Direction reached a great level of popularity during the past decade, the type of success achieved by Backstreet Boys is in a completely different level as they really dominated the business for a few years all over the world, including in some countries that were traditionally hard to penetrate for Western artists.\n\nWe will try to analyze the extent of that hegemony with this new article with final results which will more than surprise many readers."
 *             }, {
 *                 "title": "CSPC: NSYNC Popularity Analysis - ChartMasters",
 *                 "snippet": "Was the teen group led by Justin Timberlake really that big? Was it only in the US where they found success? Or were they a global phenomenon?\nAs usual, I\u2019ll be using the Commensurate Sales to Popularity Concept in order to relevantly gauge their results. This concept will not only bring you sales information for all NSYNC\u2018s albums, physical and download singles, as well as audio and video streaming, but it will also determine their true popularity. If you are not yet familiar with the CSPC method, the next page explains it with a short video. I fully recommend watching the video before getting into the sales figures."
 *             }]
 *     }
 *
 * @example
 *     {
 *         model: "command-a-03-2025",
 *         message: "Can you provide a sales summary for 29th September 2023, and also give me some details about the products in the 'Electronics' category, for example their prices and stock levels?",
 *         tools: [{
 *                 name: "query_daily_sales_report",
 *                 description: "Connects to a database to retrieve overall sales volumes and sales information for a given day.",
 *                 parameterDefinitions: {
 *                     "day": {
 *                         description: "Retrieves sales data for this day, formatted as YYYY-MM-DD.",
 *                         type: "str",
 *                         required: true
 *                     }
 *                 }
 *             }, {
 *                 name: "query_product_catalog",
 *                 description: "Connects to a a product catalog with information about all the products being sold, including categories, prices, and stock levels.",
 *                 parameterDefinitions: {
 *                     "category": {
 *                         description: "Retrieves product information data for all products in this category.",
 *                         type: "str",
 *                         required: true
 *                     }
 *                 }
 *             }]
 *     }
 */
export interface ChatRequest {
    /** Pass text/event-stream to receive the streamed response as server-sent events. The default is `\n` delimited events. */
    accepts?: "text/event-stream";
    /**
     * Text input for the model to respond to.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    message: string;
    /**
     * The name of a compatible [Cohere model](https://docs.cohere.com/docs/models) or the ID of a [fine-tuned](https://docs.cohere.com/docs/chat-fine-tuning) model.
     *
     * Compatible Deployments: Cohere Platform, Private Deployments
     */
    model?: string;
    /**
     * When specified, the default Cohere preamble will be replaced with the provided one. Preambles are a part of the prompt used to adjust the model's overall behavior and conversation style, and use the `SYSTEM` role.
     *
     * The `SYSTEM` role is also used for the contents of the optional `chat_history=` parameter. When used with the `chat_history=` parameter it adds content throughout a conversation. Conversely, when used with the `preamble=` parameter it adds content at the start of the conversation only.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    preamble?: string;
    /**
     * A list of previous messages between the user and the model, giving the model conversational context for responding to the user's `message`.
     *
     * Each item represents a single message in the chat history, excluding the current user turn. It has two properties: `role` and `message`. The `role` identifies the sender (`CHATBOT`, `SYSTEM`, or `USER`), while the `message` contains the text content.
     *
     * The chat_history parameter should not be used for `SYSTEM` messages in most cases. Instead, to add a `SYSTEM` role message at the beginning of a conversation, the `preamble` parameter should be used.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    chatHistory?: Cohere.Message[];
    /**
     * An alternative to `chat_history`.
     *
     * Providing a `conversation_id` creates or resumes a persisted conversation with the specified ID. The ID can be any non empty string.
     *
     * Compatible Deployments: Cohere Platform
     */
    conversationId?: string;
    /**
     * Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases.
     *
     * Dictates how the prompt will be constructed.
     *
     * With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be changed and ranked by relevance.
     *
     * With `prompt_truncation` set to "AUTO_PRESERVE_ORDER", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit. During this process the order of the documents and chat history will be preserved as they are inputted into the API.
     *
     * With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned.
     *
     * Compatible Deployments:
     *  - AUTO: Cohere Platform Only
     *  - AUTO_PRESERVE_ORDER: Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    promptTruncation?: Cohere.ChatRequestPromptTruncation;
    /**
     * Accepts `{"id": "web-search"}`, and/or the `"id"` for a custom [connector](https://docs.cohere.com/docs/connectors), if you've [created](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) one.
     *
     * When specified, the model's reply will be enriched with information found by querying each of the connectors (RAG).
     *
     * Compatible Deployments: Cohere Platform
     */
    connectors?: Cohere.ChatConnector[];
    /**
     * Defaults to `false`.
     *
     * When `true`, the response will only contain a list of generated search queries, but no search will take place, and no reply from the model to the user's `message` will be generated.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    searchQueriesOnly?: boolean;
    /**
     * A list of relevant documents that the model can cite to generate a more accurate reply. Each document is a string-string dictionary.
     *
     * Example:
     * ```
     * [
     *   { "title": "Tall penguins", "text": "Emperor penguins are the tallest." },
     *   { "title": "Penguin habitats", "text": "Emperor penguins only live in Antarctica." },
     * ]
     * ```
     *
     * Keys and values from each document will be serialized to a string and passed to the model. The resulting generation will include citations that reference some of these documents.
     *
     * Some suggested keys are "text", "author", and "date". For better generation quality, it is recommended to keep the total word count of the strings in the dictionary to under 300 words.
     *
     * An `id` field (string) can be optionally supplied to identify the document in the citations. This field will not be passed to the model.
     *
     * An `_excludes` field (array of strings) can be optionally supplied to omit some key-value pairs from being shown to the model. The omitted fields will still show up in the citation object. The "_excludes" field will not be passed to the model.
     *
     * See ['Document Mode'](https://docs.cohere.com/docs/retrieval-augmented-generation-rag#document-mode) in the guide for more information.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    documents?: Cohere.ChatDocument[];
    /**
     * Defaults to `"enabled"`.
     * Citations are enabled by default for models that support it, but can be turned off by setting `"type": "disabled"`.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    citationQuality?: Cohere.ChatRequestCitationQuality;
    /**
     * Defaults to `0.3`.
     *
     * 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.
     *
     * Randomness can be further maximized by increasing the  value of the `p` parameter.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    temperature?: number;
    /**
     * The maximum number of tokens the model will generate as part of the response. Note: Setting a low value may result in incomplete generations.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    maxTokens?: number;
    /**
     * The maximum number of input tokens to send to the model. If not specified, `max_input_tokens` is the model's context length limit minus a small buffer.
     *
     * Input will be truncated according to the `prompt_truncation` parameter.
     *
     * Compatible Deployments: Cohere Platform
     */
    maxInputTokens?: number;
    /**
     * Ensures only the top `k` most likely tokens are considered for generation at each step.
     * Defaults to `0`, min value of `0`, max value of `500`.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    k?: number;
    /**
     * Ensures that only the most likely tokens, with total probability mass of `p`, are considered for generation at each step. If both `k` and `p` are enabled, `p` acts after `k`.
     * Defaults to `0.75`. min value of `0.01`, max value of `0.99`.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    p?: number;
    /**
     * If specified, the backend will make a best effort to sample tokens
     * deterministically, such that repeated requests with the same
     * seed and parameters should return the same result. However,
     * determinism cannot be totally guaranteed.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    seed?: number;
    /**
     * A list of up to 5 strings that the model will use to stop generation. If the model generates a string that matches any of the strings in the list, it will stop generating tokens and return the generated text up to that point not including the stop sequence.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    stopSequences?: string[];
    /**
     * Defaults to `0.0`, min value of `0.0`, max value of `1.0`.
     *
     * Used to reduce repetitiveness of generated tokens. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    frequencyPenalty?: number;
    /**
     * Defaults to `0.0`, min value of `0.0`, max value of `1.0`.
     *
     * Used to reduce repetitiveness of generated tokens. Similar to `frequency_penalty`, except that this penalty is applied equally to all tokens that have already appeared, regardless of their exact frequencies.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    presencePenalty?: number;
    /**
     * When enabled, the user's prompt will be sent to the model without
     * any pre-processing.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    rawPrompting?: boolean;
    /**
     * A list of available tools (functions) that the model may suggest invoking before producing a text response.
     *
     * When `tools` is passed (without `tool_results`), the `text` field in the response will be `""` and the `tool_calls` field in the response will be populated with a list of tool calls that need to be made. If no calls need to be made, the `tool_calls` array will be empty.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    tools?: Cohere.Tool[];
    /**
     * A list of results from invoking tools recommended by the model in the previous chat turn. Results are used to produce a text response and will be referenced in citations. When using `tool_results`, `tools` must be passed as well.
     * Each tool_result contains information about how it was invoked, as well as a list of outputs in the form of dictionaries.
     *
     * **Note**: `outputs` must be a list of objects. If your tool returns a single object (eg `{"status": 200}`), make sure to wrap it in a list.
     * ```
     * tool_results = [
     *   {
     *     "call": {
     *       "name": <tool name>,
     *       "parameters": {
     *         <param name>: <param value>
     *       }
     *     },
     *     "outputs": [{
     *       <key>: <value>
     *     }]
     *   },
     *   ...
     * ]
     * ```
     * **Note**: Chat calls with `tool_results` should not be included in the Chat history to avoid duplication of the message text.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    toolResults?: Cohere.ToolResult[];
    /** Forces the chat to be single step. Defaults to `false`. */
    forceSingleStep?: boolean;
    responseFormat?: Cohere.ResponseFormat;
    /**
     * Used to select the [safety instruction](https://docs.cohere.com/docs/safety-modes) inserted into the prompt. Defaults to `CONTEXTUAL`.
     * When `NONE` is specified, the safety instruction will be omitted.
     *
     * Safety modes are not yet configurable in combination with `tools`, `tool_results` and `documents` parameters.
     *
     * **Note**: This parameter is only compatible newer Cohere models, starting with [Command R 08-2024](https://docs.cohere.com/docs/command-r#august-2024-release) and [Command R+ 08-2024](https://docs.cohere.com/docs/command-r-plus#august-2024-release).
     *
     * **Note**: `command-r7b-12-2024` and newer models only support `"CONTEXTUAL"` and `"STRICT"` modes.
     *
     * Compatible Deployments: Cohere Platform, Azure, AWS Sagemaker/Bedrock, Private Deployments
     */
    safetyMode?: Cohere.ChatRequestSafetyMode;
}
