Development Guide
AI Oracle is a pull-based oracle. This means users will get one response (an AI inference result) from one request (one prompt) on-demand. Our new batch mint feature enables one request t
Initiate Request: The user contract sends an inference request to AI Oracle by calling the
createOpenAILLMCallfunction.LLM Request: AI Oracle creates an request based on the user contract request.
Event Emission: AI Oracle emits a
createOpenAILLMCallevent collected by the theseus node.ML Inference: The theseus node performs the AI model computation.
Result Submission: The theseus node uploads the result on-chain.
Callback Execution: The result is dispatched to the user's smart contract via a callback function.

Simple Smart Contract Integration
To connect your smart contract with AI Oracle:
init({ initialOracleAddress }: { initialOracleAddress: AccountId })Write your callback function to handle the inference result from AI Oracle. Note that only the AI Oracle can call this function:
const promise = NearPromise.new(this.oracleAddress)
.functionCall(
"createOpenAiLlmCall",
JSON.stringify({
promptCallbackID: currentId,
config: this.config,
}),
BigInt(0),
THIRTY_TGAS
)Resources
Source code of AI Oracle: https://github.com/fabianferno/theseus
For supported models and deployment addresses, see references page.
Oracle contract account: oracletest2.testnet
Function calling contract account: functioncalltest1.testnet
Agent contract account: agentstaging.testnet
SimpleGPT contract account: simplegpttest.testnet
Last updated