development #1
@ -212,7 +212,7 @@ class ReginaldCog(PermissionsMixin, BlacklistMixin, MemoryMixin, commands.Cog):
|
|||||||
'content': response.choices[0].message.content,
|
'content': response.choices[0].message.content,
|
||||||
'tool_calls': tool_calls
|
'tool_calls': tool_calls
|
||||||
})
|
})
|
||||||
if tool_calls:
|
if isinstance(tool_calls, list) and tool_calls:
|
||||||
for i_call in tool_calls:
|
for i_call in tool_calls:
|
||||||
# Calling for necessary functions
|
# Calling for necessary functions
|
||||||
func_name = i_call.function.name
|
func_name = i_call.function.name
|
||||||
|
|||||||
@ -3,7 +3,7 @@ from os import environ
|
|||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
|
|
||||||
WEATHER_API_KEY = environ.get('WEATHER_API_KEY')
|
#WEATHER_API_KEY = environ.get('WEATHER_API_KEY')
|
||||||
URL = 'http://api.weatherapi.com/v1'
|
URL = 'http://api.weatherapi.com/v1'
|
||||||
|
|
||||||
|
|
||||||
@ -24,6 +24,7 @@ def get_weather_forecast(location: str, days: int = 14, dt: str = '2025-03-24')
|
|||||||
class Weather:
|
class Weather:
|
||||||
def __init__(self, location: str):
|
def __init__(self, location: str):
|
||||||
self.__location = location
|
self.__location = location
|
||||||
|
self.api_key = environ.get('WEATHER-API_KEY')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def location(self) -> str:
|
def location(self) -> str:
|
||||||
@ -37,7 +38,7 @@ class Weather:
|
|||||||
def realtime(self):
|
def realtime(self):
|
||||||
method = '/current.json'
|
method = '/current.json'
|
||||||
params = {
|
params = {
|
||||||
'key': WEATHER_API_KEY,
|
'key': self.api_key,
|
||||||
'q': self.location,
|
'q': self.location,
|
||||||
}
|
}
|
||||||
return self.make_request(method=method, params=params)
|
return self.make_request(method=method, params=params)
|
||||||
@ -45,7 +46,7 @@ class Weather:
|
|||||||
def forecast(self, days: int = 14, dt: str = '2025-03-24'):
|
def forecast(self, days: int = 14, dt: str = '2025-03-24'):
|
||||||
method = '/forecast.json'
|
method = '/forecast.json'
|
||||||
params = {
|
params = {
|
||||||
'key': WEATHER_API_KEY,
|
'key': self.api_key,
|
||||||
'q': self.location,
|
'q': self.location,
|
||||||
'days': days,
|
'days': days,
|
||||||
'dt': dt,
|
'dt': dt,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user