Skip to content

Commit 8d1a868

Browse files
committed
lint, cursor feedback
1 parent a386a27 commit 8d1a868

4 files changed

Lines changed: 6 additions & 12 deletions

File tree

packages/optimization/src/ldai_optimization/client.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from typing import Any, Dict, List, Literal, Optional, Union
1111

1212
from coolname import generate_slug
13-
1413
from ldai import AIAgentConfig, AIJudgeConfig, AIJudgeConfigDefault, LDAIClient
1514
from ldai.models import LDMessage, ModelConfig
1615
from ldclient import Context
@@ -1366,10 +1365,6 @@ async def optimize_from_config(
13661365
raise ValueError(
13671366
"LAUNCHDARKLY_API_KEY is not set, so optimize_from_config is not available"
13681367
)
1369-
if options.auto_commit and not self._has_api_key:
1370-
raise ValueError(
1371-
"auto_commit requires LAUNCHDARKLY_API_KEY to be set"
1372-
)
13731368

13741369
assert self._api_key is not None
13751370
api_client = LDApiClient(
@@ -1465,11 +1460,10 @@ def _build_options_from_config(
14651460

14661461
raw_ground_truth: List[str] = config.get("groundTruthResponses") or []
14671462
has_ground_truth = bool(raw_ground_truth)
1468-
if not judges and not has_ground_truth and options.on_turn is None:
1463+
if not judges and options.on_turn is None:
14691464
raise ValueError(
1470-
"The optimization config has no acceptance statements, judges, or ground truth "
1471-
"responses, and no on_turn callback was provided. At least one is required to "
1472-
"evaluate optimization results."
1465+
"The optimization config has no acceptance statements or judges, and no on_turn "
1466+
"callback was provided. At least one is required to evaluate optimization results."
14731467
)
14741468

14751469
project_key = options.project_key

packages/optimization/src/ldai_optimization/dataclasses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
Sequence,
1515
Union,
1616
)
17-
from typing_extensions import Protocol
1817

1918
from ldai import AIAgentConfig
2019
from ldai.models import LDMessage, ModelConfig
2120
from ldai.tracker import TokenUsage
2221
from ldclient import Context
22+
from typing_extensions import Protocol
2323

2424

2525
@dataclass

packages/optimization/src/ldai_optimization/prompts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def variation_prompt_acceptance_criteria(
204204
"## *** ACCEPTANCE CRITERIA (MUST BE MET) ***",
205205
"The improved configuration MUST produce responses that satisfy ALL of the following criteria.",
206206
"These criteria are non-negotiable — every generated variation will be evaluated against them.",
207-
"All variables must be used in the new instructions."
207+
"All variables must be used in the new instructions.",
208208
"",
209209
]
210210
for key, statement in statements:

packages/optimization/tests/test_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1949,7 +1949,7 @@ def test_acceptance_statements_and_judges_merged(self):
19491949

19501950
def test_raises_when_no_judges_no_ground_truth_no_on_turn(self):
19511951
config = dict(_API_CONFIG, acceptanceStatements=[], judges=[])
1952-
with pytest.raises(ValueError, match="no acceptance statements, judges, or ground truth"):
1952+
with pytest.raises(ValueError, match="no acceptance statements or judges"):
19531953
self._build(config=config)
19541954

19551955
def test_ground_truth_responses_alone_does_not_pass_no_criteria_check(self):

0 commit comments

Comments
 (0)