@@ -162,7 +162,7 @@ def _lite_call_func(tc,ns,raise_on_err=True):
162162# %% ../nbs/00_core.ipynb
163163def _has_search (m ):
164164 i = get_model_info (m )
165- return bool (i [ 'search_context_cost_per_query' ] or i [ 'supports_web_search' ] )
165+ return bool (i . get ( 'search_context_cost_per_query' ) or i . get ( 'supports_web_search' ) )
166166
167167# %% ../nbs/00_core.ipynb
168168def cite_footnote (msg ):
@@ -216,7 +216,7 @@ def _prep_msg(self, msg=None, prefill=None):
216216 def _call (self , msg = None , prefill = None , temp = None , think = None , search = None , stream = False , max_steps = 2 , step = 1 , final_prompt = None , tool_choice = None , ** kwargs ):
217217 "Internal method that always yields responses"
218218 if step > max_steps : return
219- if not get_model_info (self .model )[ "supports_assistant_prefill" ] : prefill = None
219+ if not get_model_info (self .model ). get ( "supports_assistant_prefill" ) : prefill = None
220220 if _has_search (self .model ) and (s := ifnone (search ,self .search )): kwargs ['web_search_options' ] = {"search_context_size" : effort [s ]}
221221 else : _ = kwargs .pop ('web_search_options' ,None )
222222 res = completion (model = self .model , messages = self ._prep_msg (msg , prefill ), stream = stream ,
@@ -311,7 +311,7 @@ async def astream_with_complete(self, agen, postproc=noop):
311311class AsyncChat (Chat ):
312312 async def _call (self , msg = None , prefill = None , temp = None , think = None , search = None , stream = False , max_steps = 2 , step = 1 , final_prompt = None , tool_choice = None , ** kwargs ):
313313 if step > max_steps + 1 : return
314- if not get_model_info (self .model )[ "supports_assistant_prefill" ] : prefill = None
314+ if not get_model_info (self .model ). get ( "supports_assistant_prefill" ) : prefill = None
315315 if _has_search (self .model ) and (s := ifnone (search ,self .search )): kwargs ['web_search_options' ] = {"search_context_size" : effort [s ]}
316316 else : _ = kwargs .pop ('web_search_options' ,None )
317317 res = await acompletion (model = self .model , messages = self ._prep_msg (msg , prefill ), stream = stream ,
0 commit comments