File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -198,12 +198,12 @@ def get_answers_from_calltranscripts(
198198 ]
199199 }
200200 )
201- answer = copy . deepcopy ( completion .choices [0 ])
201+ answer = completion .choices [0 ]
202202
203203 # Limit the content inside citations to 300 characters to minimize load
204- if 'citations' in answer .message .context :
205- for citation in answer .message .context [ 'citations' ] :
206- if 'content' in citation :
204+ if hasattr ( answer . message , 'context' ) and 'citations' in answer .message .context :
205+ for citation in answer .message .context . get ( 'citations' , []) :
206+ if isinstance ( citation , dict ) and 'content' in citation :
207207 citation ['content' ] = citation ['content' ][:300 ] + '...' if len (citation ['content' ]) > 300 else citation ['content' ]
208208 except BaseException :
209209 answer = 'Details could not be retrieved. Please try again later.'
You can’t perform that action at this time.
0 commit comments