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

feat: Add OpenGradient Action Provider #475

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

Conversation

kylexqian
Copy link

What changed?

  • Documentation
  • Bug fix
  • New Action
  • New Action Provider
  • Other

Why was this change implemented?

OpenGradient is a Decentralized AI platform that enables end-to-end model storage and secure inference on the OpenGradient blockchain (currently in testnet).

We hope to add a few tools to the coinbase action provider repository:

  • Hard-coded quantitative models (live volatility forecasting and price returns for BTC, ETH, SOL, etc.)

These can be used in financial based AI agents with goals like optimizing a defi portfolio, using volatility to automatically adjust buy / sell stops, lending USDC, yield farming, etc.

  • OpenGradient network LLM access (on-chain LLM prompting to models such as SentientAGI/Dobby-Mini-Unhinged-Llama-3.1-8B and Qwen/Qwen2.5-72B-Instruct)

Allow users to access different on-chain LLMs from the current LLM used by the agent itself. This can eventually include custom system prompts, but currently set as Dobby (who is great for creative-writing and general humor) and Qwen. These independent LLMs can even interact with one another!

All of these tools will be run through the OpenGradient blockchain, allowing for transaction tracking through our block explorer.

We are hoping this PR can act as a stepping stone to add OpenGradient agent toolkit functions (see Notes at the end for more details).

Network support

  • All EVM
  • Base
  • Base Sepolia
  • Other

Wallet support

  • CDP Wallet
  • EVM Wallet
  • Other

Checklist

  • Changelog updated
  • Commits are signed. See instructions
  • Doc strings
  • Readme updates
  • Rebased against master
  • Relevant exports added (Added OpenGradient to poetry.lock as it's necessary to use the OpenGradient SDK. Our SDK is open-sourced here, PyPI link here).

How has it been tested?

  • Agent tested
  • Unit tests

Unit tests added under tests/action_providers/opengradient

Example usecase of quantitative model:

Prompt: How will the price of Bitcoin change in an hour?

-------------------
5.0650831312%
Block Explorer: https://explorer.opengradient.ai/address/0x5DbC2b798501d08cF2957f005e25a5C34FAC2b1c
-------------------
The model predicts that the price of Bitcoin will increase by approximately 5.07% over the next hour. You can view the details of this forecast on the [block explorer](https://explorer.opengradient.ai/address/0x5DbC2b798501d08cF2957f005e25a5C34FAC2b1c).
-------------------

Prompt: How will the price of Ethereum change in the next hour?

-------------------
6.7401513457%
Block Explorer: https://explorer.opengradient.ai/address/0x2064718C8AB2b725Ff54bdAdB1A007A8C0420316
-------------------
The model predicts that the price of Ethereum will increase by approximately 6.74% over the next hour. You can view the details of this forecast on the [block explorer](https://explorer.opengradient.ai/address/0x2064718C8AB2b725Ff54bdAdB1A007A8C0420316).
-------------------

Prompt: How will the price of Solana change in the next hour?

-------------------
11.3267429173%
Block Explorer: https://explorer.opengradient.ai/address/0x7b7833492BcC9F76dc27a3D7AF2eAD1885E327d5
-------------------
The model predicts that the price of Solana will increase by approximately 11.33% over the next hour. You can view the details of this forecast on the [block explorer](https://explorer.opengradient.ai/address/0x7b7833492BcC9F76dc27a3D7AF2eAD1885E327d5).
-------------------

Example usecase of LLM prompting (From Agent test):

Prompt: Ask Dobby how the weather is

-------------------
It’s fucking hot, bro. Like, "I forgot water exists" hot. Stay hydrated or cry later.
Block Explorer: https://explorer.opengradient.ai/tx/0xbd26ecedcab775f0f387fdc63f7fcfbc8dc9a15b8b099e38449b16a4aeb012f3
-------------------
Dobby says: "It’s fucking hot, bro. Like, 'I forgot water exists' hot. Stay hydrated or cry later."

You can check the transaction on the block explorer: [Link](https://explorer.opengradient.ai/tx/0xbd26ecedcab775f0f387fdc63f7fcfbc8dc9a15b8b099e38449b16a4aeb012f3)
-------------------

Prompt: Ask Qwen how the weather is

-------------------
I don't have real-time data access, so I can't check the current weather. However, you can easily find out by checking a weather app or website like Weather.com, or by asking a smart home device like an Amazon Echo or Google Home. If you tell me your location, I can suggest a good source for local weather updates!
Block Explorer: https://explorer.opengradient.ai/tx/0xba508cee9eaff80e57df9f5f2fb0d88a678d615c4347fc90aeb01bb60f0c4e98
-------------------
Qwen says: "I don't have real-time data access, so I can't check the current weather. However, you can easily find out by checking a weather app or website like Weather.com, or by asking a smart home device like an Amazon Echo or Google Home. If you tell me your location, I can suggest a good source for local weather updates!"

You can check the transaction on the block explorer: [Link](https://explorer.opengradient.ai/tx/0xba508cee9eaff80e57df9f5f2fb0d88a678d615c4347fc90aeb01bb60f0c4e98)
-------------------

Prompt: Ask Dobby what it thinks of Qwen's answer

-------------------
Qwen’s answer is solid as fuck. No bullshit, no excuses—just practical solutions. If you’re looking for real-time weather, check a fucking app or ask your smart home device, simple as that. Bonus points for offering to help with local updates if you share your location. That’s what I call a win for clarity and utility.
Block Explorer: https://explorer.opengradient.ai/tx/0x48623302395f09b337344018daedf1db08da097a7c4268062231dbb812afa0fa
-------------------
Dobby says: "Qwen’s answer is solid as fuck. No bullshit, no excuses—just practical solutions. If you’re looking for real-time weather, check a fucking app or ask your smart home device, simple as that. Bonus points for offering to help with local updates if you share your location. That’s what I call a win for clarity and utility."

You can check the transaction on the block explorer: [Link](https://explorer.opengradient.ai/tx/0x48623302395f09b337344018daedf1db08da097a7c4268062231dbb812afa0fa)
-------------------

Prompt: 

Developer note: The Dobby model is pretty funny

Notes to reviewers

Using any of these OpenGradient tools will require an OpenGradient private key (this can be generated through our SDK, generally users should have their own).

Question

For the README Update under the checklist, we may need some guidance on how you want our logos formatted under the providers list? Is there other updates needed for this file?

Future features

We're hoping to eventually include AlphaSense into the coinbase agent kit.

Alphasense is OpenGradient's langchain compatible toolkit for developing OG based tools. The reasoning behind providing this developer tool is that model inferences can end up being huge. For example, if your input is a 1000 int array that needs to be copied into the AI agent, it can easily pollute agent context window. By adding these tools in the coinbase agent kit we hope to allow users to write custom (essentially hard-coded) tools similar to the ones added in this PR.

Let us know what you think of this!

Overwriting all commits in order to make them verified. Here's a sum of the list of changes that lead up to this commit:
- Add OpenGradient action provider
- Add hard-coded OpenGradient tool functions for ML workflow
- Add prompt OpenGradient tools for Dobby and Qwen
- Add unit tests for OpenGradient tools
- Add block explorer links to each tool output
- Update CHANGELOG
- Add OpenGradient logo asset (might need to fix)
- Add OpenGradient to poetry.lock
Still need to update their function descriptions, but the unit tests are added and passing.
@cb-heimdall
Copy link

🟡 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

@github-actions github-actions bot added documentation Improvements or additions to documentation action provider New action provider wallet provider New wallet provider example New example agent python needs triage labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action provider New action provider documentation Improvements or additions to documentation example New example agent needs triage python wallet provider New wallet provider
Development

Successfully merging this pull request may close these issues.

2 participants