Last updated
Last updated
The "algorithm" and "AP" in method and variable names refer to "model" and "MP" respectively.
You can invoke the models of your choice available via Orange by sending invocation requests from your dApp to the system using the .
The general sequence in which you would call the methods to send an invocation request by specifying an model and a dataset is:
Call GetAlgorithmProviders
and GetDataProviders
to go through the available model and data providers.
Choose an MP and DP, and call GetAlgorithmMethods
and GetDataMethods
to fetch the method details on available models and datasets.
Choose an MP method and a DP method ensuring the schemas match, then call RequestOrangeScore
to send an invocation request along with authorized and signed wallet information.
Call GetUserTask
to fetch the invocation results, or the status of a task.
The results can be exported in the form of . Refer to the for more details on how that can be implemented.
The Orange server uses GraphQL for its interface design. You can use the methods defined below to perform actions such as fetching MP and DP schema details and sending calculation requests using a model-data pair for specific wallets and DIDs.
To use the SDK you need a DID for your dApp. You can get one by creating a wallet using .
Add this dependency in the go.mod
file in your project.
The major schemas defined for the interface are described below.
Returns the details of all the currently registered model providers.
Method: GetAlgorithmProviders
Parameters: none
Returns: []*AlgorithmProvider
Returns all the currently available models and the associated schemas as defined by an MP.
Method: GetAlgorithmMethods
Parameters
apdid
- The DID of specified MP
Returns: []*ProviderMethod
Returns the details of all the currently registered data providers.
Method: GetDataProviders
Parameters: none
Returns: []*DataProvider
Returns all the currently available datasets and the associated schemas as defined by a DP.
Method: GetDataMethods
Parameters
dpdid
- The DID of specified DP
Returns: []*ProviderMethod
Sends a request to generate the score or report for the specified wallet addresses using the specified model and dataset, or MP and DP method respectively. Returns a taskId
.
Calculation requests are handled asynchronously. You can use the returned task ID to fetch the generated result. Please note that certain types of data or volume may take some time to fetch, and so the calculation may take up to an hour in certain extreme cases after a request is sent successfully.
Method: RequestOrangeScore
Parameters
*RequestOrangeScoreReq
- defined below
Returns: int64
Method: GetUserTask
Parameters
key
- API key
taskId
- task ID
Returns: *UserTasks
Refer to the sample code below that invokes the GetAlgorithmProviders
method.
An SDK to integrate Orange to your dApp