tommy24 commited on
Commit
0a3bd18
·
1 Parent(s): f6c7a0c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -19
app.py CHANGED
@@ -953,32 +953,32 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
953
  # "model": model_llm
954
  # }).json()
955
 
956
- def add_decimal_values(arguments):
957
- value1 = int(re.search(r'"value1": (\d+)', str(arguments)).group(1))
958
- value2 = int(re.search(r'"value2": (\d+)', str(arguments)).group(1))
959
-
960
- result = value1 + value2
961
- print(f"{value1} + {value2} = {result} (decimal)")
962
-
963
- return "Let's goooo", value1 + value2
 
 
 
964
 
965
  functions = [
966
  {
967
- "name": "add_decimal_values",
968
- "description": "Add two decimal values",
969
  "parameters": {
970
  "type": "object",
971
  "properties": {
972
- "value1": {
973
- "type": "integer",
974
- "description": "The first decimal value to add. For example, 5",
975
- },
976
- "value2": {
977
- "type": "integer",
978
- "description": "The second decimal value to add. For example, 10",
979
  },
 
980
  },
981
- "required": ["value1", "value2"],
982
  },
983
  }
984
  ]
@@ -989,7 +989,7 @@ def classify(platform, UserInput, Images, Textbox2, Textbox3):
989
  functions = functions,
990
  function_choice = "auto",
991
  function_call = {
992
- "name": "getRandomInt"
993
  }
994
  )
995
 
 
953
  # "model": model_llm
954
  # }).json()
955
 
956
+ def get_current_weather(location, unit):
957
+ params = {
958
+ 'appid': '334f89b7998e8df818503b0f33085621',
959
+ 'q': location,
960
+ 'units': unit
961
+ }
962
+ response = requests.get('https://api.openweathermap.org/data/2.5/weather', params=params)
963
+ if response.status_code == 200:
964
+ return response.json()
965
+ else:
966
+ return None
967
 
968
  functions = [
969
  {
970
+ "name": "get_current_weather",
971
+ "description": "Get the current weather in a given location",
972
  "parameters": {
973
  "type": "object",
974
  "properties": {
975
+ "location": {
976
+ "type": "string",
977
+ "description": "The city and state, e.g. San Francisco, CA",
 
 
 
 
978
  },
979
+ "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]},
980
  },
981
+ "required": ["location"],
982
  },
983
  }
984
  ]
 
989
  functions = functions,
990
  function_choice = "auto",
991
  function_call = {
992
+ "name": "get_current_weather"
993
  }
994
  )
995