Parameter Scheme

class ibm_watsonx_ai.foundation_models.schema.BaseSchema[source]

Bases: object

classmethod get_sample_params()[source]

Override this method in subclasses to provide example values for parameters.

classmethod show()[source]

Displays a table with the parameter name, type, and example value.

Chat Parameters

class ibm_watsonx_ai.foundation_models.schema.TextChatParameters(frequency_penalty: float | None = None, logprobs: bool | None = None, top_logprobs: int | None = None, presence_penalty: float | None = None, response_format: dict | ibm_watsonx_ai.foundation_models.schema._api.TextChatResponseFormat | None = None, temperature: float | None = None, max_tokens: int | None = None, time_limit: int | None = None, top_p: float | None = None, n: int | None = None)[source]

Bases: BaseSchema

frequency_penalty = None
logprobs = None
max_tokens = None
n = None
presence_penalty = None
response_format = None
temperature = None
time_limit = None
top_logprobs = None
top_p = None
class ibm_watsonx_ai.foundation_models.schema.TextChatResponseFormat(type: str | ibm_watsonx_ai.foundation_models.schema._api.TextChatResponseFormatType | None = None)[source]

Bases: BaseSchema

type = None
class ibm_watsonx_ai.foundation_models.schema.TextChatResponseFormatType(value)[source]

Bases: StrEnum

An enumeration.

JSON_OBJECT = 'json_object'

Generate Parameters

class ibm_watsonx_ai.foundation_models.schema.TextGenParameters(decoding_method: str | ibm_watsonx_ai.foundation_models.schema._api.TextGenDecodingMethod | None = None, length_penalty: dict | ibm_watsonx_ai.foundation_models.schema._api.TextGenLengthPenalty | None = None, temperature: float | None = None, top_p: float | None = None, top_k: int | None = None, random_seed: int | None = None, repetition_penalty: float | None = None, min_new_tokens: int | None = None, max_new_tokens: int | None = None, stop_sequences: list[str] | None = None, time_limit: int | None = None, truncate_input_tokens: int | None = None, return_options: dict | ibm_watsonx_ai.foundation_models.schema._api.ReturnOptionProperties | None = None, include_stop_sequence: bool | None = None, prompt_variables: dict | None = None)[source]

Bases: BaseSchema

decoding_method = None
include_stop_sequence = None
length_penalty = None
max_new_tokens = None
min_new_tokens = None
prompt_variables = None
random_seed = None
repetition_penalty = None
return_options = None
stop_sequences = None
temperature = None
time_limit = None
top_k = None
top_p = None
truncate_input_tokens = None
class ibm_watsonx_ai.foundation_models.schema.ReturnOptionProperties(input_text: bool | None = None, generated_tokens: bool | None = None, input_tokens: bool | None = None, token_logprobs: bool | None = None, token_ranks: bool | None = None, top_n_tokens: bool | None = None)[source]

Bases: BaseSchema

generated_tokens = None
input_text = None
input_tokens = None
token_logprobs = None
token_ranks = None
top_n_tokens = None
class ibm_watsonx_ai.foundation_models.schema.TextGenLengthPenalty(decay_factor: float | None = None, start_index: int | None = None)[source]

Bases: object

decay_factor = None
start_index = None
class ibm_watsonx_ai.foundation_models.schema.TextGenDecodingMethod(value)[source]

Bases: StrEnum

An enumeration.

GREEDY = 'greedy'
SAMPLE = 'sample'

Rerank Parameters

class ibm_watsonx_ai.foundation_models.schema.RerankParameters(truncate_input_tokens: int | None = None, return_options: dict | ibm_watsonx_ai.foundation_models.schema._api.RerankReturnOptions | None = None)[source]

Bases: BaseSchema

return_options = None
truncate_input_tokens = None
class ibm_watsonx_ai.foundation_models.schema.RerankReturnOptions(top_n: int | None = None, inputs: bool | None = None, query: bool | None = None)[source]

Bases: BaseSchema

inputs = None
query = None
top_n = None

TSModelInference Parameters

class ibm_watsonx_ai.foundation_models.schema.TSForecastParameters(timestamp_column, prediction_length=None, id_columns=None, freq=None, target_columns=None, observable_columns=None, control_columns=None, conditional_columns=None, static_categorical_columns=None)[source]

Bases: BaseSchema

Parameters:
  • timestamp_column (str) – A valid column in the data that should be treated as the timestamp. if using calendar dates (simple integer time offsets are also allowed), users should consider using a format such as ISO 8601 that includes a UTC offset (e.g., ‘2024-10-18T01:09:21.454746+00:00’). This will avoid potential issues such as duplicate dates appearing due to daylight savings change overs. There are many date formats in existence and inferring the correct one can be a challenge so please do consider adhering to ISO 8601.

  • prediction_length (int, optional) – The prediction length for the forecast. The service will return this many periods beyond the last timestamp in the inference data payload. If specified, prediction_length must be an integer >=1 and no more than the model default prediction length. When omitted the model default prediction_length will be used.

  • id_columns (list[str], optional) – Columns that define a unique key for time series. This is similar to a compound primary key in a database table.

  • freq (str, optional) – A freqency indicator for the given timestamp_column. See https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#period-aliases for a description of the allowed values. If not provided, we will attempt to infer it from the data. Possible values: 0 ≤ length ≤ 100, Value must match regular expression ^d+(B|D|W|M|Q|Y|h|min|s|ms|us|ns)$|^s*$

  • target_columns (list[str], optional) – An array of column headings which constitute the target variables. These are the data that will be forecasted.

conditional_columns = None
control_columns = None
freq = None
id_columns = None
observable_columns = None
prediction_length = None
static_categorical_columns = None
target_columns = None
timestamp_column