Spaces:
Sleeping
Sleeping
| from groq import Groq | |
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| def find_city(input_string): | |
| client = Groq(api_key=os.getenv("GROQ_API_KEY")) | |
| completion = client.chat.completions.create( | |
| model="llama3-8b-8192", | |
| messages=[ | |
| { | |
| "role": "system", | |
| "content": "you are a geography expert. return just a one word city name from the sentence given to you" | |
| }, | |
| { | |
| "role": "user", | |
| "content": input_string, | |
| } | |
| ], | |
| max_tokens=100, | |
| ) | |
| city = completion.choices[0].message.content | |
| return city | |