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

Add Vercel AI SDK framework support #227

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

jasonhedman
Copy link

@jasonhedman jasonhedman commented Feb 1, 2025

What changed? Why?

Added vercel-ai-sdk folder in typescript/framework-extensions to support the Vercel AI SDK framework.

Added associated vercel-ai-sdk-cdp-chatbot folder in typescript/examples to demonstrate the package's functionality.

Both packages aim to mirror the analagous langchain and langchain-cdp-chatbot packages.

Qualified Impact

This addition will primarily facilitate the use of AgentKit in the Next.js web framework.

The vercel-ai-sdk-cdp-chatbot package depends on the vercel-ai-sdk package. Errors in vercel-ai-sdk would only affect vercel-ai-sdk-cdp-chatbot.

Example

import { getVercelAITools } from "@coinbase/agentkit-vercel-ai-sdk";

const agentKit = await AgentKit.from({ 
	walletProvider,
	actionProviders: [cdp, erc721, pyth, wallet],
});

const tools = getVercelAITools(agentKit);

const stream = streamText({
	model: openai("gpt-4-turbo-preview"),
	messages,
	tools,
	system,
	maxSteps: 10,
});

@cb-heimdall
Copy link

cb-heimdall commented Feb 1, 2025

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@jasonhedman jasonhedman marked this pull request as draft February 1, 2025 19:22
@jasonhedman jasonhedman marked this pull request as ready for review February 2, 2025 17:58
Copy link
Contributor

@John-peterson-coinbase John-peterson-coinbase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jasonhedman Thanks for the contribution! Overall LGTM. Left a few comments around branding and package naming.

Comment on lines 31 to 39
const account = privateKeyToAccount(
"0x4c0883a69102937d6231471b5dbb6208ffd70c02a813d7f2da1c54f2e3be9f38",
);

const client = createWalletClient({
account,
chain: baseSepolia,
transport: http(),
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the default wallet provider CdpWalletProvider

typescript/framework-extensions/vercel-ai-sdk/README.md Outdated Show resolved Hide resolved
typescript/framework-extensions/vercel-ai-sdk/README.md Outdated Show resolved Hide resolved

CDP integration with Vercel AI SDK to enable agentic workflows using the core primitives defined in `cdp-agentkit-core`.

This toolkit contains tools that enable an LLM agent to interact with the [Coinbase Developer Platform](https://docs.cdp.coinbase.com/) through Vercel AI SDK. The toolkit provides a wrapper around the CDP SDK, allowing agents to perform onchain operations like transfers, trades, and smart contract interactions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modify language to enable onchain actions. AgentKit is not only for interactions with CDP

Comment on lines 35 to 38
import { getVercelAITools } from "@coinbase/cdp-vercel-ai-sdk";
import { CdpAgentkit } from "@coinbase/cdp-agentkit-core";

// Initialize CDP AgentKit
const agentkit = await CdpAgentkit.configureWithWallet();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use 0.1.x packages. @coinbase/agentkit

typescript/framework-extensions/vercel-ai-sdk/package.json Outdated Show resolved Hide resolved
@John-peterson-coinbase
Copy link
Contributor

Please add test snippets for the example to the PR description

@John-peterson-coinbase
Copy link
Contributor

We require all commits to be signed before merging to master. Please rebase and follow these instructions

@jasonhedman jasonhedman force-pushed the jason-hedman/vercel-ai-sdk branch from ee56c98 to a97d157 Compare February 4, 2025 22:38
@jasonhedman
Copy link
Author

@John-peterson-coinbase all of your comments should be addressed and I signed each of my commits

@John-peterson-coinbase
Copy link
Contributor

@jasonhedman - the changes look reasonable. When I test locally, I receive It seems there was an error retrieving the wallet details. Could you please try again later? or equivalent for all actions.

Are you able to make tool calls successfully?

Please update to resolve and paste snippets of successful example tool calls in the PR description. Thanks!

@John-peterson-coinbase John-peterson-coinbase added triaged changes requested PR / Issue has changes requested banana framework extension New framework extension labels Feb 10, 2025
@0xRAG 0xRAG added typescript and removed triaged labels Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
banana changes requested PR / Issue has changes requested framework extension New framework extension typescript
Development

Successfully merging this pull request may close these issues.

4 participants