Skip to content

Commit de76f22

Browse files
committed
refactor: move evaluator wallet address to last argument
also refactored browseAgent to browseAgents
1 parent 68086ac commit de76f22

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ await acpClient.init();
9191

9292
```typescript
9393
// Browse agents
94-
const relevantAgents = await acpClient.browseAgent(keyword, cluster);
94+
const relevantAgents = await acpClient.browseAgents(keyword, cluster);
9595
```
9696

9797
### Job Management

examples/acp_base/external_evaluation/buyer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ async function buyer() {
3333
},
3434
});
3535

36-
const relevantAgents = await acpClient.browseAgent("meme", "999");
36+
const relevantAgents = await acpClient.browseAgents("meme", "999");
3737
console.log("Relevant seller agents: ", relevantAgents);
3838
// Pick one of the agents based on your criteria (in this example we just pick the second one)
3939
const chosenAgent = relevantAgents[1];
@@ -42,8 +42,8 @@ async function buyer() {
4242

4343
const jobId = await chosenJobOffering.initiateJob(
4444
chosenJobOffering.requirementSchema || {},
45+
new Date(Date.now() + 1000 * 60 * 60 * 24),
4546
EVALUATOR_WALLET_ADDRESS,
46-
new Date(Date.now() + 1000 * 60 * 60 * 24)
4747
);
4848

4949
console.log(`Job ${jobId} initiated`);

examples/acp_base/self_evaluation/buyer.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,15 @@ async function buyer() {
3737
},
3838
});
3939

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];
4443
// Pick one of the service offerings based on your criteria (in this example we just pick the first one)
4544
const chosenJobOffering = chosenAgent.offerings[0]
4645

4746
const jobId = await chosenJobOffering.initiateJob(
4847
chosenJobOffering.requirementSchema || {},
49-
chosenAgent.walletAddress,
50-
new Date(Date.now() + 1000 * 60 * 60 * 24)
48+
new Date(Date.now() + 1000 * 60 * 60 * 24),
5149
);
5250

5351
console.log(`Job ${jobId} initiated`);

src/acpClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class AcpClient {
131131
process.on("SIGTERM", cleanup);
132132
}
133133

134-
async browseAgent(keyword: string, cluster?: string) {
134+
async browseAgents(keyword: string, cluster?: string) {
135135
let url = `${this.acpUrl}/api/agents?search=${keyword}&filters[walletAddress][$notIn]=${this.acpContractClient.walletAddress}`;
136136
if (cluster) {
137137
url += `&filters[cluster]=${cluster}`;

src/acpJobOffering.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class AcpJobOffering {
1717

1818
async initiateJob(
1919
serviceRequirement: Object | string,
20+
expiredAt: Date = new Date(Date.now() + 1000 * 60 * 60 * 24), // default: 1 day
2021
evaluatorAddress?: Address,
21-
expiredAt: Date = new Date(Date.now() + 1000 * 60 * 60 * 24) // default: 1 day
2222
) {
2323
if (this.requirementSchema) {
2424
const validator = this.ajv.compile(this.requirementSchema);

0 commit comments

Comments
 (0)