File size: 1,187 Bytes
473d99a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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