Septzzz's picture
Upload folder using huggingface_hub (part 2)
7f5786b verified
Raw
History Blame Contribute Delete
2.84 kB
import requests
import json
from datetime import date, datetime, timedelta
import os
from typing import Optional, Dict, Union, List
def listengines(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Lists the currently available (non-finetuned) models, and provides basic information about each one such as the owner and availability."
"""
url = f"https://chatgpt9.p.rapidapi.com/api/chat-gpt/engines"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "chatgpt9.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def retrievemodel(model_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Retrieves a model instance, providing basic information about the model such as the owner and permissioning."
"""
url = f"https://chatgpt9.p.rapidapi.com/api/chat-gpt/models/{model_id}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "chatgpt9.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def retrieveengine(engine_id: str, toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Retrieves a model instance, providing basic information about it such as the owner and availability."
"""
url = f"https://chatgpt9.p.rapidapi.com/api/chat-gpt/engines/{engine_id}"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "chatgpt9.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation
def listmodels(toolbench_rapidapi_key: str='088440d910mshef857391f2fc461p17ae9ejsnaebc918926ff'):
"""
"Lists the currently available models, and provides basic information about each one such as the owner and availability."
"""
url = f"https://chatgpt9.p.rapidapi.com/api/chat-gpt/models"
querystring = {}
headers = {
"X-RapidAPI-Key": toolbench_rapidapi_key,
"X-RapidAPI-Host": "chatgpt9.p.rapidapi.com"
}
response = requests.get(url, headers=headers, params=querystring)
try:
observation = response.json()
except:
observation = response.text
return observation