Spaces:
Runtime error
Runtime error
| # from openai import OpenAI | |
| # | |
| # | |
| # client = OpenAI( | |
| # api_key='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' | |
| # ) | |
| # | |
| # system_prompt = '''You are a professional geographer. Your task is to extract all geopolitical entities from a given text. Geopolitical entities can include countries, regions, cities, autonomous regions, or other administrative divisions. For each geopolitical entity, wrap the name in a unique character sequence, such as [###ENTITY###]. If there are multiple entities, output them in the following format:\n[###ENTITY1###, ###ENTITY2###, ###ENTITY3###]\nHere is an example:\n Example:\n\nText:\n"China and India are two of the most populous countries in Asia."\n\nExpected Output:\n[###China###, ###India###]''' | |
| # sent = 'Where is France?' | |
| # | |
| # math_bot_messages = [ | |
| # {"role": "system", | |
| # "content": system_prompt}, | |
| # {"role": "user", "content": sent}, | |
| # ] | |
| # | |
| # chat_completion = client.chat.completions.create( | |
| # messages=math_bot_messages, | |
| # model="gpt-3.5-turbo", | |
| # ) | |
| # | |
| # result = chat_completion.choices[0].message.content | |
| # | |
| # | |
| # print(result) | |
| # | |
| # | |
| import ../reregex_spatial | |
| regex_spatial.get_level1_regex() |