mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
style(fusion): ruff format
This commit is contained in:
parent
3045762c73
commit
eb75783f2f
1 changed files with 6 additions and 7 deletions
|
|
@ -95,6 +95,7 @@ FusionStrategy = Literal["single_judge", "majority_vote", "best_of_n"]
|
|||
# Helpers
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def _build_judge_messages(
|
||||
original_messages: list[dict],
|
||||
panel_responses: list[ModelResponse],
|
||||
|
|
@ -193,10 +194,7 @@ async def _run_panel(
|
|||
panel_kwargs: dict,
|
||||
) -> tuple[list[ModelResponse], list[str]]:
|
||||
"""Fan out to all panel models in parallel; filter failed calls."""
|
||||
tasks = [
|
||||
litellm.acompletion(model=m, messages=messages, stream=False, **panel_kwargs)
|
||||
for m in models
|
||||
]
|
||||
tasks = [litellm.acompletion(model=m, messages=messages, stream=False, **panel_kwargs) for m in models]
|
||||
raw: list = list(await asyncio.gather(*tasks, return_exceptions=True))
|
||||
|
||||
valid_responses: list[ModelResponse] = []
|
||||
|
|
@ -218,6 +216,7 @@ async def _run_panel(
|
|||
# Overloads for precise return-type inference
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@overload
|
||||
async def afusion(
|
||||
models: List[str],
|
||||
|
|
@ -252,6 +251,7 @@ async def afusion(
|
|||
# Core async implementation
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
async def afusion(
|
||||
models: List[str],
|
||||
messages: list,
|
||||
|
|
@ -291,9 +291,7 @@ async def afusion(
|
|||
if not models:
|
||||
raise ValueError("fusion: `models` must be a non-empty list")
|
||||
if strategy not in _JUDGE_PROMPTS:
|
||||
raise ValueError(
|
||||
f"fusion: unknown strategy {strategy!r}. Choose from {list(_JUDGE_PROMPTS)}"
|
||||
)
|
||||
raise ValueError(f"fusion: unknown strategy {strategy!r}. Choose from {list(_JUDGE_PROMPTS)}")
|
||||
|
||||
panel_kwargs: dict = dict(kwargs)
|
||||
if temperature is not None:
|
||||
|
|
@ -345,6 +343,7 @@ async def afusion(
|
|||
# Sync overloads
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@overload
|
||||
def fusion(
|
||||
models: List[str],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue