Skip to content

Commit 5a02742

Browse files
committed
fix: linting
1 parent 13cb8bc commit 5a02742

3 files changed

Lines changed: 10 additions & 34 deletions

File tree

src/uipath/_cli/_evals/_configurable_factory.py

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
"""Configurable runtime factory that supports model settings overrides."""
22

3+
import inspect
34
import json
5+
import logging
46
import os
57
import tempfile
6-
import logging
78
from pathlib import Path
8-
from typing import Any
99

1010
from uipath.runtime import UiPathRuntimeFactoryProtocol, UiPathRuntimeProtocol
1111

@@ -15,8 +15,7 @@
1515

1616

1717
class ConfigurableRuntimeFactory:
18-
"""
19-
Wrapper factory that supports model settings overrides for evaluation runs.
18+
"""Wrapper factory that supports model settings overrides for evaluation runs.
2019
2120
This factory wraps an existing UiPathRuntimeFactoryProtocol implementation
2221
and allows applying model settings overrides when creating runtimes.
@@ -29,17 +28,15 @@ def __init__(self, base_factory: UiPathRuntimeFactoryProtocol):
2928
self._temp_files: list[str] = []
3029

3130
def set_model_settings_override(self, settings: EvaluationSetModelSettings | None) -> None:
32-
"""
33-
Set model settings to override when creating runtimes.
31+
"""Set model settings to override when creating runtimes.
3432
3533
Args:
3634
settings: The model settings to apply, or None to clear overrides
3735
"""
3836
self.model_settings_override = settings
3937

4038
async def new_runtime(self, entrypoint: str, runtime_id: str) -> UiPathRuntimeProtocol:
41-
"""
42-
Create a new runtime with optional model settings overrides.
39+
"""Create a new runtime with optional model settings overrides.
4340
4441
If model settings override is configured, creates a temporary modified
4542
entrypoint file with the overridden settings.
@@ -66,8 +63,7 @@ async def new_runtime(self, entrypoint: str, runtime_id: str) -> UiPathRuntimePr
6663
return await self.base_factory.new_runtime(entrypoint, runtime_id)
6764

6865
def _apply_overrides(self, entrypoint: str, settings: EvaluationSetModelSettings) -> str | None:
69-
"""
70-
Apply model settings overrides to an agent entrypoint.
66+
"""Apply model settings overrides to an agent entrypoint.
7167
7268
Creates a temporary modified version of the entrypoint file with
7369
the specified model settings overrides applied.
@@ -150,17 +146,4 @@ async def dispose(self) -> None:
150146

151147
# Delegate disposal to base factory
152148
if hasattr(self.base_factory, 'dispose'):
153-
await self.base_factory.dispose()
154-
155-
# Delegate other factory protocol methods to base factory
156-
async def discover_entrypoints(self) -> list[str]:
157-
"""Discover available entrypoints from the base factory."""
158-
if hasattr(self.base_factory, 'discover_entrypoints'):
159-
return await self.base_factory.discover_entrypoints()
160-
return []
161-
162-
async def discover_runtimes(self) -> list[UiPathRuntimeProtocol]:
163-
"""Discover available runtimes from the base factory."""
164-
if hasattr(self.base_factory, 'discover_runtimes'):
165-
return await self.base_factory.discover_runtimes()
166-
return []
149+
await self.base_factory.dispose()

src/uipath/_cli/_evals/_models/_evaluation_set.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class ModelSettings(BaseModel):
7070
"""Model Generation Parameters."""
7171

7272
model: str = Field(..., alias="model")
73-
temperature: float | None = Field(default=None, alias="temperature")
73+
temperature: float | str | None = Field(default=None, alias="temperature")
7474
top_p: float | None = Field(default=None, alias="topP")
7575
top_k: int | None = Field(default=None, alias="topK")
7676
frequency_penalty: float | None = Field(default=None, alias="frequencyPenalty")
@@ -79,17 +79,9 @@ class ModelSettings(BaseModel):
7979

8080

8181
class EvaluationSetModelSettings(ModelSettings):
82-
"""Model settings configuration for evaluation sets with ID and special values support.
83-
84-
Extends ModelSettings to add an ID field and support for "same-as-agent" special value
85-
in model and temperature fields for evaluation-specific overrides.
86-
"""
82+
"""Model setting overrides within evaluation sets with ID"""
8783

8884
id: str = Field(..., alias="id")
89-
# Override model to keep it required and support "same-as-agent"
90-
model: str = Field(..., alias="model") # Can be "same-as-agent" or actual model name
91-
# Override temperature to support "same-as-agent" as string
92-
temperature: float | str | None = Field(default=None, alias="temperature") # Can be "same-as-agent", float, or None
9385

9486

9587
class LLMMockingStrategy(BaseMockingStrategy):

src/uipath/_cli/_utils/_eval_set.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def migrate_evaluation_item(
149149
migrate_evaluation_item(evaluation, eval_set.evaluator_refs)
150150
for evaluation in eval_set.evaluations
151151
],
152+
model_settings=eval_set.model_settings,
152153
)
153154
except ValidationError as e:
154155
raise ValueError(

0 commit comments

Comments
 (0)