@@ -255,16 +255,13 @@ def prompt(
255255 validate_tlm_prompt (prompt )
256256 tlm_prompt_process_and_validate_kwargs (prompt , self ._task , kwargs )
257257 if isinstance (prompt , str ):
258- return cast (
259- TLMResponse ,
260- self ._event_loop .run_until_complete (
261- self ._prompt_async (
262- prompt ,
263- timeout = self ._timeout ,
264- capture_exceptions = False ,
265- constrain_outputs = kwargs .get (_TLM_CONSTRAIN_OUTPUTS_KEY ),
266- ),
267- ),
258+ return self ._event_loop .run_until_complete (
259+ self ._prompt_async (
260+ prompt ,
261+ timeout = self ._timeout ,
262+ capture_exceptions = False ,
263+ constrain_outputs = kwargs .get (_TLM_CONSTRAIN_OUTPUTS_KEY ),
264+ )
268265 )
269266
270267 return self ._event_loop .run_until_complete (
@@ -324,14 +321,13 @@ async def prompt_async(
324321
325322 async with aiohttp .ClientSession () as session :
326323 if isinstance (prompt , str ):
327- tlm_response = await self ._prompt_async (
324+ return await self ._prompt_async (
328325 prompt ,
329326 session ,
330327 timeout = self ._timeout ,
331328 capture_exceptions = False ,
332329 constrain_outputs = kwargs .get (_TLM_CONSTRAIN_OUTPUTS_KEY ),
333330 )
334- return cast (TLMResponse , tlm_response )
335331
336332 return await self ._batch_prompt (
337333 prompt ,
@@ -417,16 +413,13 @@ def get_trustworthiness_score(
417413 processed_response = tlm_score_process_response_and_kwargs (prompt , response , self ._task , kwargs )
418414
419415 if isinstance (prompt , str ) and isinstance (processed_response , dict ):
420- return cast (
421- TLMScore ,
422- self ._event_loop .run_until_complete (
423- self ._get_trustworthiness_score_async (
424- prompt ,
425- processed_response ,
426- timeout = self ._timeout ,
427- capture_exceptions = False ,
428- )
429- ),
416+ return self ._event_loop .run_until_complete (
417+ self ._get_trustworthiness_score_async (
418+ prompt ,
419+ processed_response ,
420+ timeout = self ._timeout ,
421+ capture_exceptions = False ,
422+ )
430423 )
431424
432425 assert isinstance (prompt , Sequence )
@@ -483,14 +476,13 @@ async def get_trustworthiness_score_async(
483476
484477 async with aiohttp .ClientSession () as session :
485478 if isinstance (prompt , str ) and isinstance (processed_response , dict ):
486- trustworthiness_score = await self ._get_trustworthiness_score_async (
479+ return await self ._get_trustworthiness_score_async (
487480 prompt ,
488481 processed_response ,
489482 session ,
490483 timeout = self ._timeout ,
491484 capture_exceptions = False ,
492485 )
493- return cast (TLMScore , trustworthiness_score )
494486
495487 assert isinstance (prompt , Sequence )
496488 assert isinstance (processed_response , Sequence )
@@ -598,16 +590,16 @@ class TLMOptions(TypedDict):
598590 - **base:** `num_candidate_responses` = 1, `num_consistency_samples` = 0, `use_self_reflection` = False.
599591 When using `get_trustworthiness_score()` on "base" preset, a cheaper self-reflection will be used to compute the trustworthiness score.
600592
601- By default, TLM uses the: "medium" `quality_preset`, "gpt-4o -mini" base `model`, and `max_tokens` is set to 512.
593+ By default, TLM uses the: "medium" `quality_preset`, "gpt-4.1 -mini" base `model`, and `max_tokens` is set to 512.
602594 You can set custom values for these arguments regardless of the quality preset specified.
603595
604596 Args:
605597 model ({"gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "o4-mini", "o3", "gpt-4.5-preview", "gpt-4o-mini", "gpt-4o", "o3-mini", \
606598 "o1", "o1-mini", "gpt-4", "gpt-3.5-turbo-16k", "claude-3.7-sonnet", "claude-3.5-sonnet-v2", "claude-3.5-sonnet", \
607- "claude-3.5-haiku", "claude-3-haiku", "nova-micro", "nova-lite", "nova-pro"}, default = "gpt-4o -mini"): \
599+ "claude-3.5-haiku", "claude-3-haiku", "nova-micro", "nova-lite", "nova-pro"}, default = "gpt-4.1 -mini"): \
608600 Underlying base LLM to use (better models yield better results, faster models yield faster/cheaper results).
609- - Models still in beta: "o3", "o1", "o4-mini", "o3-mini", "o1-mini", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "gpt-4. 5-preview", \
610- "claude-3.7-sonnet", "claude-3.5-sonnet-v2", "claude-3.5- haiku", "nova-micro", "nova-lite", "nova-pro ".
601+ - Models still in beta: "o3", "o1", "o4-mini", "o3-mini", "o1-mini", "gpt-4.5-preview", \
602+ "claude-3.7-sonnet", "claude-3.5-haiku".
611603 - Recommended models for accuracy: "gpt-4.1", "o4-mini", "o3", "claude-3.7-sonnet", "claude-3.5-sonnet-v2".
612604 - Recommended models for low latency/costs: "gpt-4.1-nano", "nova-micro".
613605
0 commit comments