Support config AI models and providers

This commit is contained in:
ngoc 2026-01-02 13:07:47 +07:00
parent a779177958
commit 5a66f56f11
No known key found for this signature in database
GPG Key ID: 51FE6110113A5C32
4 changed files with 29 additions and 9 deletions

View File

@ -34,6 +34,9 @@ Options:
--private-key <key> Your private key (required)
--deployment <path> Path to deployment file (default: ./cli/deployments/localhost.json)
--rpc-url <url> RPC URL (default: from deployment file)
--arbitration-provider <name> Arbitration provider (default: OpenAI)
--arbitration-model <model> Arbitration model (default: gpt-4o-mini)
--arbitration-prompt <text> Custom arbitration prompt (optional)
--help, -h Display this help message
Environment Variables (alternative to CLI options):
@ -67,6 +70,9 @@ function parseCliArgs() {
"private-key": { type: "string" },
"deployment": { type: "string" },
"rpc-url": { type: "string" },
"arbitration-provider": { type: "string" },
"arbitration-model": { type: "string" },
"arbitration-prompt": { type: "string" },
"help": { type: "boolean", short: "h" },
},
strict: true,
@ -92,6 +98,16 @@ async function main() {
const oracleAddress = args.oracle;
const privateKey = args["private-key"] || process.env.PRIVATE_KEY;
const deploymentPath = args.deployment || "./cli/deployments/localhost.json";
// Arbitration configuration with defaults
const arbitrationProvider = args["arbitration-provider"] || "OpenAI";
const arbitrationModel = args["arbitration-model"] || "gpt-4o-mini";
const arbitrationPrompt = args["arbitration-prompt"] ||
`Evaluate the fulfillment against the demand and decide whether the demand was validly fulfilled
Demand: {{demand}}
Fulfillment: {{obligation}}`;
// Validate required parameters
if (!demand) {
@ -194,13 +210,9 @@ async function main() {
const encodedDemand = client.arbiters.general.trustedOracle.encode({
oracle: oracleAddress as `0x${string}`,
data: llmClient.llm.encodeDemand({
arbitrationProvider: "OpenAI",
arbitrationModel: "gpt-4.1",
arbitrationPrompt: `Evaluate the fulfillment against the demand and decide whether the demand was validly fulfilled
Demand: {{demand}}
Fulfillment: {{obligation}}`,
arbitrationProvider,
arbitrationModel,
arbitrationPrompt,
demand: demand
})
});

View File

@ -2,7 +2,7 @@
"network": "localhost",
"chainId": 31337,
"rpcUrl": "http://localhost:8545",
"deployedAt": "2026-01-02T05:54:03.735Z",
"deployedAt": "2026-01-02T06:06:32.864Z",
"deployer": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"addresses": {
"easSchemaRegistry": "0x5fbdb2315678afecb367f032d93f642f64180aa3",

View File

@ -36,6 +36,9 @@ Options (vary by command):
--private-key <key> Private key (all commands)
--rpc-url <url> RPC URL (default: http://localhost:8545)
--deployment <file> Load addresses from deployment file
--arbitration-provider <name> Arbitration provider (create, default: OpenAI)
--arbitration-model <model> Arbitration model (create, default: gpt-4o-mini)
--arbitration-prompt <text> Custom arbitration prompt (create, optional)
Environment Variables:
PRIVATE_KEY Private key for transactions
@ -107,6 +110,9 @@ function parseCliArgs() {
"private-key": { type: "string" },
"rpc-url": { type: "string" },
"deployment": { type: "string" },
"arbitration-provider": { type: "string" },
"arbitration-model": { type: "string" },
"arbitration-prompt": { type: "string" },
},
strict: true,
});

View File

@ -371,7 +371,9 @@ async function main() {
console.log(` --demand "The sky is blue" \\`);
console.log(` --amount 10 \\`);
console.log(` --token ${addresses.mockERC20A} \\`);
console.log(` --oracle 0x70997970C51812dc3A010C7d01b50e0d17dc79C8`);
console.log(` --oracle 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 \\`);
console.log(` --arbitration-provider "OpenAI" \\`);
console.log(` --arbitration-model "gpt-4o-mini"`);
} catch (error) {
console.error("❌ Deployment failed:", error);