functions = [
{
"type": "function",
"function": {
"name": "call_rest_api",
"description": "Sends a request to the REST API",
"parameters": {
"type": "object",
"properties": {
"method": {
"type": "string",
"description": "The HTTP method to be used",
"enum": ["GET", "POST", "PUT", "DELETE"],
},
"url": {
"type": "string",
"description": "The URL of the endpoint. Value placeholders must be replaced with actual values.",
},
"body": {
"type": "string",
"description": "A string representation of the JSON that should be sent as the request body.",
},
},
"required": ["method", "url"],
},
}
}
]
def call_rest_api(self, arguments):
arguments = json.loads(arguments)
# reques.in is a hosted, fake REST API that we can use for testing
url = 'https://reqres.in' + arguments['url']
body = arguments.get('body', {})
response = None
if arguments['method'] ==...
functions = [
{
"type": "function",
"function": {
"name": "call_rest_api",
"description": "Sends a request to the REST API",
"parameters": {
"type": "object",
"properties": {
"method": {
"type": "string",
"description": "The HTTP method to be used",
"enum": ["GET", "POST", "PUT", "DELETE"],
},
"url": {
"type": "string",
"description": "The URL of the endpoint. Value placeholders must be replaced with actual values.",
},
"body": {
"type": "string",
"description": "A string representation of the JSON that should be sent as the request body.",
},
},
"required": ["method", "url"],
},
}
}
]
def call_rest_api(self, arguments):
arguments = json.loads(arguments)
# reques.in is a hosted, fake REST API that we can use for testing
url = 'https://reqres.in' + arguments['url']
body = arguments.get('body', {})
response = None
if arguments['method'] ==...