datarobot_genai.core.router
router
merge_streaming_tool_calls
Merge streaming tool-call delta objects into complete tool-call dicts.
Each element of tool_calls_seen must have .index, .id,
and .function attributes matching the litellm/OpenAI streaming schema.
Returns a list of OpenAI-format tool-call dicts ready to forward to the
framework or serialize as JSON.
Source code in datarobot_genai/core/router.py
build_litellm_router
build_litellm_router(primary: LLMConfig, fallbacks: list[LLMConfig], router_settings: dict | None = None) -> litellm.Router
Build a litellm.Router with automatic failover.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
primary
|
LLMConfig
|
|
required |
fallbacks
|
list[LLMConfig]
|
Ordered list of |
required |
router_settings
|
dict | None
|
Extra keyword arguments forwarded to |
None
|
Returns
A configured ``litellm.Router`` that tries ``primary`` first and
cascades through ``fallback_0``, ``fallback_1``, … on failure.