@@ -72,27 +72,30 @@ def completion_config(
7272 self ,
7373 key : str ,
7474 context : Context ,
75- default_value : AICompletionConfigDefault ,
75+ default_value : Optional [ AICompletionConfigDefault ] = None ,
7676 variables : Optional [Dict [str , Any ]] = None ,
7777 ) -> AICompletionConfig :
7878 """
7979 Get the value of a completion configuration.
8080
8181 :param key: The key of the completion configuration.
8282 :param context: The context to evaluate the completion configuration in.
83- :param default_value: The default value of the completion configuration.
83+ :param default_value: The default value of the completion configuration. When not provided,
84+ a disabled config is used as the fallback.
8485 :param variables: Additional variables for the completion configuration.
8586 :return: The completion configuration with a tracker used for gathering metrics.
8687 """
8788 self ._client .track (_TRACK_USAGE_COMPLETION_CONFIG , context , key , 1 )
8889
89- return self ._completion_config (key , context , default_value , variables )
90+ return self ._completion_config (
91+ key , context , default_value or AICompletionConfigDefault .disabled (), variables
92+ )
9093
9194 def config (
9295 self ,
9396 key : str ,
9497 context : Context ,
95- default_value : AICompletionConfigDefault ,
98+ default_value : Optional [ AICompletionConfigDefault ] = None ,
9699 variables : Optional [Dict [str , Any ]] = None ,
97100 ) -> AICompletionConfig :
98101 """
@@ -152,27 +155,30 @@ def judge_config(
152155 self ,
153156 key : str ,
154157 context : Context ,
155- default_value : AIJudgeConfigDefault ,
158+ default_value : Optional [ AIJudgeConfigDefault ] = None ,
156159 variables : Optional [Dict [str , Any ]] = None ,
157160 ) -> AIJudgeConfig :
158161 """
159162 Get the value of a judge configuration.
160163
161164 :param key: The key of the judge configuration.
162165 :param context: The context to evaluate the judge configuration in.
163- :param default_value: The default value of the judge configuration.
166+ :param default_value: The default value of the judge configuration. When not provided,
167+ a disabled config is used as the fallback.
164168 :param variables: Additional variables for the judge configuration.
165169 :return: The judge configuration with a tracker used for gathering metrics.
166170 """
167171 self ._client .track (_TRACK_USAGE_JUDGE_CONFIG , context , key , 1 )
168172
169- return self ._judge_config (key , context , default_value , variables )
173+ return self ._judge_config (
174+ key , context , default_value or AIJudgeConfigDefault .disabled (), variables
175+ )
170176
171177 async def create_judge (
172178 self ,
173179 key : str ,
174180 context : Context ,
175- default_value : AIJudgeConfigDefault ,
181+ default_value : Optional [ AIJudgeConfigDefault ] = None ,
176182 variables : Optional [Dict [str , Any ]] = None ,
177183 default_ai_provider : Optional [str ] = None ,
178184 ) -> Optional [Judge ]:
@@ -222,7 +228,9 @@ async def create_judge(
222228 extended_variables ['message_history' ] = '{{message_history}}'
223229 extended_variables ['response_to_evaluate' ] = '{{response_to_evaluate}}'
224230
225- judge_config = self ._judge_config (key , context , default_value , extended_variables )
231+ judge_config = self ._judge_config (
232+ key , context , default_value or AIJudgeConfigDefault .disabled (), extended_variables
233+ )
226234
227235 if not judge_config .enabled or not judge_config .tracker :
228236 return None
@@ -346,7 +354,7 @@ def agent_config(
346354 self ,
347355 key : str ,
348356 context : Context ,
349- default_value : AIAgentConfigDefault ,
357+ default_value : Optional [ AIAgentConfigDefault ] = None ,
350358 variables : Optional [Dict [str , Any ]] = None ,
351359 ) -> AIAgentConfig :
352360 """
@@ -374,7 +382,8 @@ def agent_config(
374382
375383 :param key: The agent configuration key.
376384 :param context: The context to evaluate the agent configuration in.
377- :param default_value: Default agent values.
385+ :param default_value: Default agent values. When not provided, a disabled config is used
386+ as the fallback.
378387 :param variables: Variables for interpolation.
379388 :return: Configured AIAgentConfig instance.
380389 """
@@ -385,7 +394,9 @@ def agent_config(
385394 1
386395 )
387396
388- return self .__evaluate_agent (key , context , default_value , variables )
397+ return self .__evaluate_agent (
398+ key , context , default_value or AIAgentConfigDefault .disabled (), variables
399+ )
389400
390401 def agent (
391402 self ,
@@ -457,7 +468,7 @@ def agent_configs(
457468 agent = self .__evaluate_agent (
458469 config .key ,
459470 context ,
460- config .default_value ,
471+ config .default_value or AIAgentConfigDefault . disabled () ,
461472 config .variables
462473 )
463474 result [config .key ] = agent
0 commit comments