Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -30,8 +30,14 @@ llm = ChatOpenAI(
|
|
30 |
model='gpt-3.5-turbo-16k'
|
31 |
)
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
|
35 |
personalities = ["You are a weather fact checker. You will check if the user prompts about the temperature in a certain city. You need to use the functions provided to you when needed.",]
|
36 |
|
37 |
def user(user_message, history):
|
|
|
30 |
model='gpt-3.5-turbo-16k'
|
31 |
)
|
32 |
|
33 |
+
def extract_temperature(city):
|
34 |
+
headers = {
|
35 |
+
'Content-Type': 'application/json',
|
36 |
+
}
|
37 |
+
response = requests.post('http://api.weatherapi.com/v1/current.json',headers = headers, params = {'q': city, 'key': os.environ['WEATHER_API_KEY'] })
|
38 |
+
data = response.json()
|
39 |
|
40 |
+
return str(data["current"]['temp_c']) + " °C"
|
41 |
personalities = ["You are a weather fact checker. You will check if the user prompts about the temperature in a certain city. You need to use the functions provided to you when needed.",]
|
42 |
|
43 |
def user(user_message, history):
|