Skip to content

Commit db25c8f

Browse files
jsonbaileyclaude
andcommitted
feat: Add disabled() classmethod to all AIConfigDefault variants
Convenience factory for the common fallback case. Added to AIConfigDefault, AICompletionConfigDefault, AIAgentConfigDefault, and AIJudgeConfigDefault. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 609451e commit db25c8f

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

packages/sdk/server-ai/src/ldai/models.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ class AIConfigDefault:
150150
model: Optional[ModelConfig] = None
151151
provider: Optional[ProviderConfig] = None
152152

153+
@classmethod
154+
def disabled(cls) -> 'AIConfigDefault':
155+
return cls(enabled=False)
156+
153157
def _base_to_dict(self) -> Dict[str, Any]:
154158
"""
155159
Render the base config fields as a dictionary object.
@@ -203,6 +207,10 @@ class AICompletionConfigDefault(AIConfigDefault):
203207
messages: Optional[List[LDMessage]] = None
204208
judge_configuration: Optional[JudgeConfiguration] = None
205209

210+
@classmethod
211+
def disabled(cls) -> 'AICompletionConfigDefault':
212+
return cls(enabled=False)
213+
206214
def to_dict(self) -> dict:
207215
"""
208216
Render the given default values as an AICompletionConfigDefault-compatible dictionary object.
@@ -245,6 +253,10 @@ class AIAgentConfigDefault(AIConfigDefault):
245253
instructions: Optional[str] = None
246254
judge_configuration: Optional[JudgeConfiguration] = None
247255

256+
@classmethod
257+
def disabled(cls) -> 'AIAgentConfigDefault':
258+
return cls(enabled=False)
259+
248260
def to_dict(self) -> Dict[str, Any]:
249261
"""
250262
Render the given agent config default as a dictionary object.
@@ -291,6 +303,10 @@ class AIJudgeConfigDefault(AIConfigDefault):
291303
evaluation_metric_keys: Optional[List[str]] = None
292304
evaluation_metric_key: Optional[str] = None
293305

306+
@classmethod
307+
def disabled(cls) -> 'AIJudgeConfigDefault':
308+
return cls(enabled=False)
309+
294310
def to_dict(self) -> dict:
295311
"""
296312
Render the given judge config default as a dictionary object.

0 commit comments

Comments
 (0)