# GPT에게 함수 호출 요청 생성 response = client.chat.completions.create( model="gpt-4", messages=messages, functions=functions, function_call="auto" ) message = response.choices[0].message if message.function_call: function_name = message.function_call.name arguments = json.loads(message.function_call.arguments) location = arguments["location"] # OpenWeatherMap은 영어 도시명을 더 잘 인식하므로 한글을 영문으로 변환 # 간단한 매핑 예시 korean_to_english = { "서울": "Seoul", "부산": "Busan", "대구": "Daegu", "인천": "Incheon", "광주": "Gwangju", "대전": "Daejeon", "울산": "Ulsan", "제주": "Jeju" } location_eng = korean_to_english.get(location, location)