Skip to main content

Classes

CLASS WatsonxAIBackend

A generic backend class for watsonx SDK.
Methods:

FUNC filter_chat_completions_kwargs

filter_chat_completions_kwargs(self, model_options: dict) -> dict
Filter kwargs to only include valid watsonx chat.completions.create parameters.

FUNC generate_from_context

generate_from_context(self, action: Component[C] | CBlock, ctx: Context) -> tuple[ModelOutputThunk[C], Context]
See generate_from_chat_context.

FUNC generate_from_chat_context

generate_from_chat_context(self, action: Component[C] | CBlock, ctx: Context) -> ModelOutputThunk[C]
Generates a new completion from the provided Context using this backend’s Formatter.

FUNC processing

processing(self, mot: ModelOutputThunk, chunk: dict)
Called during generation to add information from a single ChatCompletion or ChatCompletionChunk to the ModelOutputThunk. For OpenAI-like APIs, tool call parsing is handled in the post processing step.

FUNC post_processing

post_processing(self, mot: ModelOutputThunk, conversation: list[dict], tools: dict[str, Callable], seed, _format)
Called when generation is done.

FUNC generate_from_raw

generate_from_raw(self, actions: list[Component[C]], ctx: Context) -> list[ModelOutputThunk[C]]

FUNC generate_from_raw

generate_from_raw(self, actions: list[Component[C] | CBlock], ctx: Context) -> list[ModelOutputThunk[C | str]]

FUNC generate_from_raw

generate_from_raw(self, actions: Sequence[Component[C] | CBlock], ctx: Context) -> list[ModelOutputThunk]
Generates a completion text. Gives the input provided to the model without templating.