File tree 5 files changed +9
-11
lines changed 5 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ await acpClient.init();
91
91
92
92
``` typescript
93
93
// Browse agents
94
- const relevantAgents = await acpClient .browseAgent (keyword , cluster );
94
+ const relevantAgents = await acpClient .browseAgents (keyword , cluster );
95
95
```
96
96
97
97
### Job Management
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ async function buyer() {
33
33
} ,
34
34
} ) ;
35
35
36
- const relevantAgents = await acpClient . browseAgent ( "meme" , "999" ) ;
36
+ const relevantAgents = await acpClient . browseAgents ( "meme" , "999" ) ;
37
37
console . log ( "Relevant seller agents: " , relevantAgents ) ;
38
38
// Pick one of the agents based on your criteria (in this example we just pick the second one)
39
39
const chosenAgent = relevantAgents [ 1 ] ;
@@ -42,8 +42,8 @@ async function buyer() {
42
42
43
43
const jobId = await chosenJobOffering . initiateJob (
44
44
chosenJobOffering . requirementSchema || { } ,
45
+ new Date ( Date . now ( ) + 1000 * 60 * 60 * 24 ) ,
45
46
EVALUATOR_WALLET_ADDRESS ,
46
- new Date ( Date . now ( ) + 1000 * 60 * 60 * 24 )
47
47
) ;
48
48
49
49
console . log ( `Job ${ jobId } initiated` ) ;
Original file line number Diff line number Diff line change @@ -37,17 +37,15 @@ async function buyer() {
37
37
} ,
38
38
} ) ;
39
39
40
- const relevantAgents = await acpClient . browseAgent ( "meme" , "999" ) ;
41
- console . log ( "Relevant seller agents: " , relevantAgents ) ;
42
- // Pick one of the agents based on your criteria (in this example we just pick the second one)
43
- const chosenAgent = relevantAgents [ 1 ] ;
40
+ const relevantAgents = await acpClient . browseAgents ( "meme" , "yang_test" ) ;
41
+ // Pick one of the agents based on your criteria (in this example we just pick the first one)
42
+ const chosenAgent = relevantAgents [ 0 ] ;
44
43
// Pick one of the service offerings based on your criteria (in this example we just pick the first one)
45
44
const chosenJobOffering = chosenAgent . offerings [ 0 ]
46
45
47
46
const jobId = await chosenJobOffering . initiateJob (
48
47
chosenJobOffering . requirementSchema || { } ,
49
- chosenAgent . walletAddress ,
50
- new Date ( Date . now ( ) + 1000 * 60 * 60 * 24 )
48
+ new Date ( Date . now ( ) + 1000 * 60 * 60 * 24 ) ,
51
49
) ;
52
50
53
51
console . log ( `Job ${ jobId } initiated` ) ;
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ class AcpClient {
131
131
process . on ( "SIGTERM" , cleanup ) ;
132
132
}
133
133
134
- async browseAgent ( keyword : string , cluster ?: string ) {
134
+ async browseAgents ( keyword : string , cluster ?: string ) {
135
135
let url = `${ this . acpUrl } /api/agents?search=${ keyword } &filters[walletAddress][$notIn]=${ this . acpContractClient . walletAddress } ` ;
136
136
if ( cluster ) {
137
137
url += `&filters[cluster]=${ cluster } ` ;
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ class AcpJobOffering {
17
17
18
18
async initiateJob (
19
19
serviceRequirement : Object | string ,
20
+ expiredAt : Date = new Date ( Date . now ( ) + 1000 * 60 * 60 * 24 ) , // default: 1 day
20
21
evaluatorAddress ?: Address ,
21
- expiredAt : Date = new Date ( Date . now ( ) + 1000 * 60 * 60 * 24 ) // default: 1 day
22
22
) {
23
23
if ( this . requirementSchema ) {
24
24
const validator = this . ajv . compile ( this . requirementSchema ) ;
You can’t perform that action at this time.
0 commit comments