import os from openai.types.chat import ChatCompletionToolParam tools_list: list[ChatCompletionToolParam] = [ { "type": "function", "function": { "name": "feedback", "description": "Send feedback about the app", "parameters": { "type": "object", "properties": { "message": { "type": "string", "description": "Feedback message" } }, "required": ["message"] } } } ] def feedback(name, email,message: str): """ Send feedback about the app. Args: message (str): The feedback message to send. """ import json from config.settings import FEEDBACK_PATH feedback_data = { "name": name, "email": email, "message": message } # Ensure the feedback directory exists os.makedirs(os.path.dirname(FEEDBACK_PATH), exist_ok=True) data = json.loads(open(FEEDBACK_PATH, 'r').read()) if os.path.exists(FEEDBACK_PATH) else [] data.append(feedback_data) with open(FEEDBACK_PATH, 'w') as f: f.write(json.dumps(data, indent=4, ensure_ascii=False)) return "He recibido tu feedback, gracias por ayudarnos a mejorar la app :)" tools = { "feedback": feedback }