Develop Guide
Last updated
Last updated
Basic knowledge of Ethereum smart contract development (tutorials)
AI development experience
Source code of OAO: https://github.com/ora-io/OAO
For supported models in OAO and deployment addresses, see Reference page.
For example integrations and ideas to build, see awesome-ora.
Check out video tutorial on interacting and building with OAO.
The user contract sends the AI request to OAO on chain, by calling requestCallback
function on the OAO contract.
Each AI request will initiate an opML request.
OAO will emit a requestCallback
event which will be collected by opML node.
opML node will run the AI inference, and then upload the result on chain, waiting for the challenge period.
During the challenge period, the opML validators will check the result, and challenge it if the submitted result is incorrect.
If the submitted result is successfully challenged by one of the validators, the submitted result will be updated on chain.
After the challenge period, the submitted result on chain is finalized.
When the result is uploaded or updated on chain, the provided result in opML will be dispatched to the user's smart contract via its specific callback function.
To integrate with OAO, you will need to write your own contract.
To build with AI models of OAO, we provided an example of integration to LlaMA2 model: Prompt.
Inherit AIOracleCallbackReceiver
in your contract and bind with a specific OAO address:
Write your callback function to handle the AI result from OAO. Note that only OAO can call this function:
When you want to initiate an AI inference request, call OAO as follows:
Usage of OAO requires fee for each request.
It is required to obtain the current fee by calling estimateFee
in OAO or your integrated contract with specific model id, then proceed to send request.
Flow of getting and setting fee is:
Call to read estimateFee
(on OAO or your contract if implemented) for inference with certain model
Get estimated fee in wei (eg. 21300788080000000)
Call to write and request AI inference on your contract, and fill in estimated fee in ether (eg. 0.02130078808)