Spaces:
Sleeping
Sleeping
| import os | |
| from groq import Groq | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| def final_output(input_string, weather_data_final): | |
| client = Groq(api_key=os.getenv("GROQ_API_KEY")) | |
| response = client.chat.completions.create( | |
| model="llama3-70b-8192", | |
| messages=[ | |
| { | |
| "role": "system", | |
| "content": ''' | |
| given a query and weather details of a city | |
| Describe what the weather conditions are like, | |
| describe what can be done or not and if it is pleasant or not. | |
| Mention 5 precautions (dont use bold font for anything) | |
| Temperature is in celsius | |
| ''' | |
| }, | |
| { | |
| "role": "user", | |
| "content": "User entered query: " + input_string + "Weather data of the city: " + str(weather_data_final) | |
| } | |
| ], | |
| temperature=1, | |
| max_tokens=2400, | |
| top_p=1, | |
| # stream=True, | |
| stop=None, | |
| ) | |
| final_response = response.choices[0].message.content | |
| return final_response | |