Error: 'ChatCompletion' object is not subscriptable"
Browse files
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
|
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}"
|