mellea.backends.watsonx
class mellea.backends.watsonx.WatsonxAIBackend(model_id: str | ModelIdentifier = model_ids.IBM_GRANITE_3_3_8B, formatter: Formatter | None = None, base_url: str | None = None, model_options: dict | None = None, api_key: str | None = None, project_id: str | None = None, **kwargs)
model_id
: Model id. Defaults to model_ids.IBM_GRANITE_3_3_8B.formatter
: input formatter. Defaults to TemplateFormatter in init.base_url
: url for watson ML deployment. Defaults to env(WATSONX_URL).model_options
: Global model options to pass to the model. Defaults to None.api_key
: watsonx API key. Defaults to None.project_id
: watsonx project ID. Defaults to None.mellea.backends.watsonx.WatsonxAIBackend._get_watsonx_model_id()
mellea.backends.watsonx.WatsonxAIBackend.filter_chat_completions_kwargs(model_options: dict)
mellea.backends.watsonx.WatsonxAIBackend._simplify_and_merge(model_options: dict[str, Any] | None, is_chat_context: bool)
model_options
: the model_options for this callmellea.backends.watsonx.WatsonxAIBackend._make_backend_specific_and_remove(model_options: dict[str, Any], is_chat_context: bool)
model_options
: the model_options for this callmellea.backends.watsonx.WatsonxAIBackend.generate_from_context(action: Component | CBlock, ctx: Context, format: type[BaseModelSubclass] | None = None, model_options: dict | None = None, generate_logs: list[GenerateLog] | None = None, tool_calls: bool = False)
generate_from_chat_context
.
mellea.backends.watsonx.WatsonxAIBackend.generate_from_chat_context(action: Component | CBlock, ctx: Context, format: type[BaseModelSubclass] | None = None, model_options: dict | None = None, generate_logs: list[GenerateLog] | None = None, tool_calls: bool = False)
Formatter
.
mellea.backends.watsonx.WatsonxAIBackend._generate_from_raw(actions: list[Component | CBlock], format: type[BaseModelSubclass] | None = None, model_options: dict | None = None, generate_logs: list[GenerateLog] | None = None)
mellea.backends.watsonx.WatsonxAIBackend._extract_model_tool_requests(tools: dict[str, Callable], chat_response: dict)