extract function GPT function