/** * (C) Copyright IBM Corp. 2025-2026. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ /** The function call. */ export interface TextChatFunctionCall { /** The name of the function. */ name: string; /** * The arguments to call the function with, as generated by the model in JSON format. Note that * the model does not always generate valid JSON, and may hallucinate parameters not defined by * your function schema. Validate the arguments in your code before calling your function. */ arguments: string; } /** The tool call. */ export interface TextChatToolCall { /** The ID of the tool call. */ id: string; /** The type of the tool. Currently, only `function` is supported. */ type: 'function'; /** The function call. */ function: TextChatFunctionCall; } export declare namespace TextChatToolCall { namespace Constants { /** The type of the tool. Currently, only `function` is supported. */ enum Type { FUNCTION = "function" } } } /** The base definition of a text chat message. */ export interface TextChatMessage { /** * The role of the messages author. Note that this parameter is case sensitive, make sure to use * lower case. */ role: string; } /** The definition of an assistant message. */ export interface TextChatMessageAssistant extends TextChatMessage { role: 'assistant'; /** The contents of the assistant message. Required unless `tool_calls` is specified. */ content?: string; /** An optional name for the participant. */ name?: string; /** The refusal message by the assistant. */ refusal?: string | null; /** The tool calls generated by the model, such as function calls. */ tool_calls?: TextChatToolCall[]; } /** The definition of a control message. */ export interface TextChatMessageControl extends TextChatMessage { role: 'control'; /** * The contents of the control message. Depending on the model, an example would be "thinking" for * Granite reasoning models. */ content: string; /** An optional name for the participant. */ name?: string; } /** The definition of a system message. */ export interface TextChatMessageSystem extends TextChatMessage { role: 'system'; /** The contents of the system message. */ content: string; /** An optional name for the participant. */ name?: string; } /** The definition of a tool message. */ export interface TextChatMessageTool extends TextChatMessage { role: 'tool'; /** The contents of the tool message. */ content: string; /** Tool call that this message is responding to. */ tool_call_id: string; } /** The base definition of a text chat user content. */ export interface TextChatUserContent { /** * The type of the user content. You can get the list of models supporting text, image, audio, * video by using Foundation Model Specs with `filters=function_text_chat`, * `filters=function_image_chat`, `filters=function_audio_chat`, `filters=function_video_chat` * respectively. */ type: 'text' | 'image_url' | 'video_url' | 'input_audio'; } /** The definition of a user text content. */ export interface TextChatUserTextContent extends TextChatUserContent { type: 'text'; /** The text content. */ text: string; } /** The definition of a user image content. */ export interface TextChatUserImageURL { /** * You can either set this string to a base64 encoded image, or use `data_asset` field to refer to * an uploaded image. * * @example * 'data:image/jpeg;base64,{base64_image}'; */ url?: string; /** * This parameter controls how the model processes the image and generates its textual * understanding. The `auto` setting will look at the image input size and decide if it should use * the `low` or `high` setting. * * @default 'auto' */ detail?: 'low' | 'high' | 'auto'; } export declare namespace TextChatUserImageURL { namespace Constants { /** * This parameter controls how the model processes the image and generates its textual * understanding. The `auto` setting which will look at the image input size and decide if it * should use the `low` or `high` setting. */ enum Detail { LOW = "low", HIGH = "high", AUTO = "auto" } } } /** Data asset reference for uploaded content. */ export interface TextChatDataAsset { /** The id of the asset */ id: string; } /** The definition of a user image content. */ export interface TextChatUserImageURLContent extends TextChatUserContent { type: 'image_url'; /** The image URL configuration. */ image_url?: TextChatUserImageURL; /** * The data asset of an image uploaded into the `space_id` or `project_id`. If `data_asset` is * specified, the `url` field in `image_url` will be automatically set with the URL of the * uploaded image. */ data_asset?: TextChatDataAsset; } /** The definition of a user video content. */ export interface TextChatUserVideoURL { /** * You can either set this string to a base64 encoded video, or use `data_asset` field to refer to * an uploaded video. * * @example * 'data:video/mp4;base64,{base64_video}'; */ url?: string; } /** The definition of a user video content. */ export interface TextChatUserVideoURLContent extends TextChatUserContent { type: 'video_url'; /** The video URL configuration. */ video_url?: TextChatUserVideoURL; /** * The data asset of a video uploaded into the `space_id` or `project_id`. If `data_asset` is * specified, the `url` field in `video_url` will be automatically set with the URL of the * uploaded video. */ data_asset?: TextChatDataAsset; } /** The definition of a user audio content. */ export interface TextChatUserInputAudio { /** * You can either set this string to a base64 encoded audio, or use `data_asset` field to refer to * an uploaded audio file. * * @example * {base64_audio} */ data?: string; /** Either `wav` or `mp3`. */ format?: 'wav' | 'mp3'; } /** The definition of a user audio content. */ export interface TextChatUserAudioContent extends TextChatUserContent { type: 'input_audio'; /** The input audio configuration. */ input_audio?: TextChatUserInputAudio; /** * The data asset of an audio uploaded into the `space_id` or `project_id`. If `data_asset` is * specified, the `data` field in `input_audio` will be automatically set with the URL of the * uploaded audio. */ data_asset?: TextChatDataAsset; } /** Union type for all user content types. */ export type TextChatUserContents = TextChatUserTextContent | TextChatUserImageURLContent | TextChatUserVideoURLContent | TextChatUserAudioContent; /** The definition of a user message. */ export interface TextChatMessageUser extends TextChatMessage { role: 'user'; /** Content of a user message. */ content: TextChatUserContents[] | string; /** An optional name for the participant. */ name?: string; } /** Union type for all text chat message types. */ export type TextChatMessages = TextChatMessageAssistant | TextChatMessageControl | TextChatMessageSystem | TextChatMessageTool | TextChatMessageUser | TextChatMessage; /** The parameters specific to chat functions. */ export interface TextChatParameterFunction { /** The name of the function. */ name: string; /** * A description of what the function does, used by the model to choose when and how to call the * function. */ description?: string; /** * The parameters the functions accepts, described as a JSON Schema object. See the [JSON Schema * reference](https://json-schema.org/learn/getting-started-step-by-step) for documentation about * the format. Omitting parameters defines a function with an empty parameter list. */ parameters?: Record; } //# sourceMappingURL=messages.d.ts.map