Spaces:
Runtime error
Runtime error
Commit ·
7af8c4a
1
Parent(s): b44dadb
Update app.py
Browse files
app.py
CHANGED
|
@@ -102,7 +102,18 @@ def generate_knowledge_graph(api_key, user_input):
|
|
| 102 |
)
|
| 103 |
|
| 104 |
response_data = completion.choices[0]["message"]["function_call"]["arguments"]
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
# Convert to dictionary if it's a string
|
| 107 |
if isinstance(response_data, str):
|
| 108 |
response_data = json.loads(response_data)
|
|
|
|
| 102 |
)
|
| 103 |
|
| 104 |
response_data = completion.choices[0]["message"]["function_call"]["arguments"]
|
| 105 |
+
# Debugging: Print the type and value of response_data
|
| 106 |
+
print(f"Type of response_data: {type(response_data)}")
|
| 107 |
+
print(f"Value of response_data: {response_data}")
|
| 108 |
+
|
| 109 |
+
try:
|
| 110 |
+
# Convert to dictionary if it's a string
|
| 111 |
+
if isinstance(response_data, str):
|
| 112 |
+
response_data = json.loads(response_data)
|
| 113 |
+
except json.JSONDecodeError as e:
|
| 114 |
+
print(f"JSON Decode Error: {e}")
|
| 115 |
+
return "Error in decoding JSON"
|
| 116 |
+
|
| 117 |
# Convert to dictionary if it's a string
|
| 118 |
if isinstance(response_data, str):
|
| 119 |
response_data = json.loads(response_data)
|