Spaces:
Sleeping
Sleeping
Add OpenAI client fallback for MindVisualizer explanations
Browse files92 unmodified lines9394959697989910010110210310410510610710810911011111211392 unmodified lines "Be concrete, not generic." )
if not hasattr(client, "responses"): # Older openai-python builds do not expose client.responses. Keep the # deployed Space useful instead of failing with "'OpenAI' has no # attribute 'responses'"; requirements should still install a newer SDK. chat = client.chat.completions.create( model=model, messages=[ {"role": "system", "content": instructions}, {"role": "user", "content": question}, ], temperature=0.3, max_tokens=1500, ) return (chat.choices[0].message.content or "").strip() or "[GPT ERROR] Chat API returned no visible text."
resp = client.responses.create( model=model, instructions=instructions,mindVisualizer/src/region_analyzer.py+15