Saqib772 commited on
Commit
aed0f44
·
verified ·
1 Parent(s): 070d885

Error: 'ChatCompletion' object is not subscriptable"

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -58,7 +58,7 @@ def estimate_repair_cost(damage_type, company, model, year, country):
58
  max_tokens=100
59
  )
60
  # Correctly access the response content
61
- return response['choices'][0]['message']['content'].strip()
62
  except Exception as e:
63
  print(f"Error in GPT-4.0 API call: {e}")
64
  return f"Error: {e}"
 
58
  max_tokens=100
59
  )
60
  # Correctly access the response content
61
+ return response.choices[0].message.content.strip()
62
  except Exception as e:
63
  print(f"Error in GPT-4.0 API call: {e}")
64
  return f"Error: {e}"