import json import openai def get_initial_message(): with open("prompts/amsa_smart_form.json", "r") as file: initial_prompt = str(json.load(file)) response = get_chatgpt_response([{ "role": "user", "content": f"[Assitant] Activando configuraciĆ³n. Iniciando configuraciĆ³n: {initial_prompt}", }]) return [{ "role": "assistant", "content": response }] def get_chatgpt_response(messages): response = openai.ChatCompletion.create( model="gpt-4", messages=messages, temperature=0, ) return response.choices[0]["message"]["content"] def update_chat(messages, role, content): messages.append( {"role": role, "content": content}, ) return messages