Update code snippets for adding new tools

This commit is contained in:
Damjan
2024-12-27 16:41:46 +01:00
parent e79dc2ab65
commit 5ba8df51d4

View File

@@ -104,6 +104,10 @@ if (customTool) {
const result = await customTool._call("your-input");
console.log(result);
}
// or alternatively
const result = await agent.customFunction("your-input"); // assuming you have a `customFunction` method in SolanaAgentKit
console.log(result);
```
## Best Practices
@@ -170,6 +174,21 @@ export class SolanaAgentKit {
}
```
Then it can be used as such:
```typescript
import { SolanaAgentKit } from "solana-agent-kit";
const agent = new SolanaAgentKit(
"your-wallet-private-key-as-base58",
"https://api.mainnet-beta.solana.com",
"your-openai-api-key"
);
const result = await agent.getTokenPrice("SOL");
console.log(result);
```
## Need Help?
If you encounter any issues while implementing your custom tool: