@ibm-cloud/watsonx-ai
Version:
IBM watsonx.ai Node.js SDK
111 lines • 4.53 kB
text/typescript
/**
* (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.
*/
import type { JsonObject } from "../../../types/common.mjs";
/** A function tool call in a chat request. */
export interface ChatsToolCall {
/**
* The name and arguments of a function that should be called, as generated by the model.
*
* Deprecated: `function_call` has been deprecated by OpenAI and replaced by `tool_calls`.
*/
function?: FunctionCall;
/** ID of the tool call. */
id?: string;
/** Type of the tool. Currently, only `"function"` is supported. */
type?: string;
}
/**
* Controls which (if any) tool is called by the model.
*
* - `"none"` means the model will not call any tool and instead generates a message.
* - `"auto"` means the model can pick between generating a message or calling one or more tools.
* - `"required"` means the model must call one or more tools.
* - Specifying a particular tool via `{"type": "function", "function": {"name": "my_function"}}`
* forces the model to call that tool.
*
* `"none"` is the default when no tools are present. `"auto"` is the default if tools are present.
*/
export type ChatsToolChoice = string | ChatsRequestTool;
/**
* The name and arguments of a function that should be called, as generated by the model.
*
* Deprecated: `function_call` has been deprecated by OpenAI and replaced by `tool_calls`.
*/
export interface FunctionCall {
/**
* 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;
/** Name of the function to call. */
name?: string;
}
/** A tool that can be called by models. */
export interface ChatsRequestTool {
/** Function to call for a tool choice. */
function?: ChoiceFunction;
/** Type of the tool. Currently, only `"function"` is supported. */
type: ChatsRequestTool.Constants.Type | string;
}
export declare namespace ChatsRequestTool {
namespace Constants {
/** Type of the tool. Currently, only `"function"` is supported. */
enum Type {
FUNCTION = "function"
}
}
}
/** Function to call for a tool choice. */
export interface ChoiceFunction {
/** 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?: JsonObject;
}
/**
* Controls which (if any) function is called by the model.
*
* - `"none"` means the model will not call a function and instead generates a message.
* - `"auto"` means the model can pick between generating a message or calling a function.
* - Specifying a particular function via `{"name": "my_function"}` forces the model to call that
* function.
*
* `"none"` is the default when no functions are present. `"auto"` is the default if functions are
* present.
*
* Deprecated: `function_call` has been deprecated by OpenAI in favor of `tool_choice`.
*/
export interface ChatsFunctionCall {
/**
* 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.
*/
argument: string;
/** Name of the function to call. */
name: string;
}
//# sourceMappingURL=tools.d.mts.map