File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ def calculate_cost_and_tokens(result):
157157 extraction_result = result .get ("extraction_result" , [])
158158
159159 if not extraction_result :
160- return None , None , None , None
160+ return total_embedding_cost , total_llm_cost , total_embedding_tokens , total_llm_tokens
161161
162162 extraction_data = extraction_result [0 ].get ("result" , "" )
163163
@@ -175,15 +175,15 @@ def calculate_cost_and_tokens(result):
175175 extraction_llm = metadata .get ("extraction_llm" ) if metadata else None
176176
177177 #Process embedding costs and tokens if embedding_llm list exists and is not empty
178- if embedding_llm and not [] :
178+ if embedding_llm :
179179 total_embedding_cost = 0.0
180180 total_embedding_tokens = 0
181181 for item in embedding_llm :
182182 total_embedding_cost += float (item .get ("cost_in_dollars" , "0" ))
183183 total_embedding_tokens += item .get ("embedding_tokens" , 0 )
184184
185185 #Process embedding costs and tokens if extraction_llm list exists and is not empty
186- if extraction_llm and not [] :
186+ if extraction_llm :
187187 total_llm_cost = 0.0
188188 total_llm_tokens = 0
189189 for item in extraction_llm :
You can’t perform that action at this time.
0 commit comments