AI related operations with apictl¶
To ensure that the Marketplace Assistant is fully informed about all published APIs and API Products, it is essential to update the vector database. You can use the WSO2 API Controller (apictl) to keep the vector database upto date.
First you have to download and initialize the apictl.
- Make sure that the WSO2 API-M is started and that the corresponding version of apictl is set up.
For more information, see Download and Initialize the apictl. - Log in to the WSO2 API-M in the environment by following the instructions in Login to an Environment.
- Run the corresponding apictl commands below to delete and upload APIs and API Products from a logged in user's tenant.
Set token as a config variable¶
Using the token which was generated for Marketplace Assistant set the ai-token as shown below.
-
Command
Delete APIs and API Products from vector database.¶
Run the following command to delete all the APIs and API Products from the vector database from the currently logged-in user's tenant within a specified environment.
-
Command
apictl ai delete artifacts --token "<use token that you generated>" --endpoint "<endpoint of ai service>" -e "<environment>"
Info
Flags:
- Required :
--environment
or-e
: Environment to be searched - Optional :
--token
: On prem key of AI services
--endpoint
: Endpoint url of AI services
Example
Note
- Note that if you have already set the token to the config variable, you dont have to use the --token flag
- Required :
Upload APIs to vector database.¶
Run the following command to upload all the APIs to the vector database from the currently logged-in user's tenant within a specified environment.
-
Command
apictl ai upload apis --token "<use token that you generated>" --endpoint "<endpoint of ai service>" -e "<environment>"
Info
Flags:
- Required :
--environment
or-e
: Environment to be searched - Optional :
--token
: On prem key of AI services
--endpoint
: Endpoint url of AI services
--all
: Upload both APIs and API Products.
Example
Note
- Note that if you have already set the token to the config variable, you dont have to use the --token flag
- Required :
Upload API Products to vector database.¶
Run the following command to upload all the API Products to the vector database from the currently logged-in user's tenant within a specified environment.
-
Command
apictl ai upload api-products --token "<use token that you generated>" --endpoint "<endpoint of ai service>" -e "<environment>"
Info
Flags:
- Required :
--environment
or-e
: Environment to be searched - Optional :
--token
: On prem key of AI services
--endpoint
: Endpoint url of AI services
--all
: Upload both APIs and API Products.
Example
Note
- Note that if you have already set the token to the config variable, you dont have to use the --token flag
- Required :
This process can be repeated for all tenants.
If you intend to use the same access token across different deployments, you can continue using it without generating a new one each time.
This process ensures that the Marketplace Assistant is up-to-date with all published APIs, enhancing its ability to provide accurate and relevant assistance.