url = 'https://petstore3.swagger.io/api/v3/openapi.json'
filename = 'oas.json'
response = requests.get(url)
with open(filename, 'wb') as file:
    file.write(response.content)
with open('oas.json', 'r') as f:
    oas = jsonref.loads(f.read()) # it's important to load with jsonref, as explained below
for path, methods in oas["paths"].items():
    for method, spec_with_ref in methods.items():
        print(path, ":", method, ":", spec_with_ref['operationId'], ":", spec_with_ref['summary'])
/pet : put : updatePet : Update an existing pet
/pet : post : addPet : Add a new pet to the store
/pet/findByStatus : get : findPetsByStatus : Finds Pets by status
/pet/findByTags : get : findPetsByTags : Finds Pets by tags
/pet/{petId} : get : getPetById : Find pet by ID
/pet/{petId} : post : updatePetWithForm : Updates a pet in the store with form data
/pet/{petId} : delete : deletePet : Deletes a pet
/pet/{petId}/uploadImage : post : uploadFile : uploads an image
/store/inventory : get : getInventory : Returns pet inventories by status
/store/order : post : placeOrder : Place an order for a pet
/store/order/{orderId} : get : getOrderById : Find purchase order by ID
/store/order/{orderId} : delete : deleteOrder : Delete purchase order by ID
/user : post : createUser : Create user
/user/createWithList : post : createUsersWithListInput : Creates list of users with given input array
/user/login : get : loginUser : Logs user into the system
/user/logout : get : logoutUser : Logs out current logged in user session
/user/{username} : get : getUserByName : Get user by user name
/user/{username} : put : updateUser : Update user
/user/{username} : delete : deleteUser : Delete user

source

oas_to_fc

 oas_to_fc (openapi_spec)
tools = oas_to_fc(oas)
messages = [{"role":"system", "content":"You are a helpful system administrator. Use the supplied tools to assist the user."}]
complete(messages, "user", "Hi, how many pets are sold?", tools=tools, aux_fn=generate_request_by_operation_id)
https://petstore3.swagger.io/api/v3/store/inventory None
('assistant',
 "It seems that I couldn't retrieve the inventory information at the moment. Please try again later or check if there is any issue with the system.")