Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/accessibility improvements #86

Conversation

Isreal-Oparanti
Copy link

@Isreal-Oparanti Isreal-Oparanti commented Dec 28, 2024

Pull Request Description

This pull request addresses the issue related to improving accessibility within the Solana Agent Kit, maximizing OpenAI(vercel-ai-sdk) to improve user experience on the overall application

Related Issue

Fixes # (issue number)

Fixes #54

Changes Made

This PR adds the following changes:

  • Adds support for the Vercel AI SDK.

Implementation Details

  • Developed a set of functions to send data to the Vercel AI endpoints, handle the responses, and parse the data to fit the toolkit’s structure. These functions allow the toolkit to interact with AI models in real-time, but using the following packages, ai, @ai-sdk/openai, and zod.
  • Integrated the Vercel AI SDK into the Solana Agent Kit. This involved setting up the SDK within the project, configuring API keys, and writing helper functions to send requests to Vercel's AI services. Now, the Solana Agent Kit can send requests to AI models hosted on Vercel and receive responses in a structured format.

Transaction executed by agent

Example transaction:

[email protected] test:vercel-ai C:\Users\USER\Desktop\SolanaAgentKit\solana-agent-kit
ts-node test/agent_sdks/vercel_ai.ts

bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)
Starting Solana Agent...

Select a Mode:

  1. Chat Mode - Interactive conversations.
  2. Auto Mode - Fully autonomous actions.
    Enter your choice (1/2): (node:16476) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
    (Use node --trace-deprecation ... to show where the warning was created)
    Enter your choice (1/2): 2
    Starting autonomous mode...
    Alright, let's execute a series of actions on the Solana blockchain. First, I will create a new token.

Action 1: Deploy a Token on Solana Blockchain

I will now initiate the solanaDeployTokenTool to deploy a new token on the Solana blockchain.

The parameters for the token are as follows:

Let's execute this action now.

const deployTokenResult = functions.solanaDeployTokenTool({
  name: "Assistant Token",
  uri: "https://assistanttoken.example.com",
  symbol: "AST"
});

The result of this function call will be a new token deployment on the Solana blockchain. The token will be named "Assistant Token" with the symbol "AST".

Action 2: Request Funds

In order to perform meaningful transactions on the Solana blockchain, we need to have some funds. Therefore, I will request funds from the Solana faucet.

const requestFundsResult = functions.solanaRequestFundsTool();

This will add some SOL to our wallet, which we can use to perform transactions on the Solana blockchain.

Action 3: Register a .sol domain

Now, let's register a .sol domain for our wallet. The domain name will be "assistantwallet".

const registerDomainResult = functions.solanaRegisterDomainTool({
  name: "assistantwallet"
});

This function call will register a new .sol domain named "assistantwallet" for our wallet.

Prompt Used

o integrate the Vercel AI SDK and achieve the functionality required for the Solana Agent Kit, I used the following configurations and prompts to communicate with the gpt-4 AI model
prompt =
Be creative and demonstrate your capabilities by executing meaningful actions on the Solana blockchain.
You can:
- Deploy tokens or interact with programs.
- Request funds when necessary.
- Log and provide concise details about your actions.

Additional Notes

Checklist

  • I have tested these changes locally
  • I have updated the documentation
  • I have added a transaction link
  • I have added the prompt used to test it

@thearyanag
Copy link
Member

hey - closing this as similar have already merged, thanks for taking the time to contribute! can you share you tg handle pls?

@thearyanag thearyanag closed this Jan 9, 2025
@Isreal-Oparanti
Copy link
Author

Isreal-Oparanti commented Jan 10, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implenent vercel ai sdk
2 participants