From ffc3aaa378b05d7d7ee7b0751e712228a65488a2 Mon Sep 17 00:00:00 2001 From: John Peterson <98187317+John-peterson-coinbase@users.noreply.github.com> Date: Thu, 7 Nov 2024 18:49:44 -0500 Subject: [PATCH] chore: Improve Prompts V0 (#31) --- cdp-agentkit-core/cdp_agentkit_core/actions/get_balance.py | 2 +- cdp-agentkit-core/cdp_agentkit_core/actions/mint_nft.py | 2 +- .../cdp_agentkit_core/actions/register_basename.py | 4 +++- .../cdp_agentkit_core/actions/request_faucet_funds.py | 5 ++++- cdp-agentkit-core/cdp_agentkit_core/actions/trade.py | 2 +- cdp-agentkit-core/cdp_agentkit_core/actions/transfer.py | 2 +- .../cdp_agentkit_core/actions/uniswap_v3/__init__.py | 0 cdp-langchain/examples/chatbot/chatbot.py | 2 +- 8 files changed, 12 insertions(+), 7 deletions(-) delete mode 100644 cdp-agentkit-core/cdp_agentkit_core/actions/uniswap_v3/__init__.py diff --git a/cdp-agentkit-core/cdp_agentkit_core/actions/get_balance.py b/cdp-agentkit-core/cdp_agentkit_core/actions/get_balance.py index f1b22c2c8..d279a0afa 100644 --- a/cdp-agentkit-core/cdp_agentkit_core/actions/get_balance.py +++ b/cdp-agentkit-core/cdp_agentkit_core/actions/get_balance.py @@ -6,7 +6,7 @@ from cdp_agentkit_core.actions import CdpAction GET_BALANCE_PROMPT = """ -This tool will get the balance of all the addresses in the wallet for a given asset. It takes the asset ID as input.""" +This tool will get the balance of all the addresses in the wallet for a given asset. It takes the asset ID as input. Always use `eth` for the native asset ETH and `usdc` for USDC.""" class GetBalanceInput(BaseModel): diff --git a/cdp-agentkit-core/cdp_agentkit_core/actions/mint_nft.py b/cdp-agentkit-core/cdp_agentkit_core/actions/mint_nft.py index 5d5656fd8..8e1ea4eff 100644 --- a/cdp-agentkit-core/cdp_agentkit_core/actions/mint_nft.py +++ b/cdp-agentkit-core/cdp_agentkit_core/actions/mint_nft.py @@ -6,7 +6,7 @@ from cdp_agentkit_core.actions import CdpAction MINT_NFT_PROMPT = """ -This tool will mint an NFT (ERC-721) to a specified destination address onchain via a contract invocation. It takes the contract address of the NFT onchain and the destination address onchain that will receive the NFT as inputs.""" +This tool will mint an NFT (ERC-721) to a specified destination address onchain via a contract invocation. It takes the contract address of the NFT onchain and the destination address onchain that will receive the NFT as inputs. Do not use the contract address as the destination address. If you are unsure of the destination address, please ask the user before proceeding.""" class MintNftInput(BaseModel): diff --git a/cdp-agentkit-core/cdp_agentkit_core/actions/register_basename.py b/cdp-agentkit-core/cdp_agentkit_core/actions/register_basename.py index 93566457b..85cbfb51f 100644 --- a/cdp-agentkit-core/cdp_agentkit_core/actions/register_basename.py +++ b/cdp-agentkit-core/cdp_agentkit_core/actions/register_basename.py @@ -10,7 +10,9 @@ # Constants REGISTER_BASENAME_PROMPT = """ This tool will register a Basename for the agent. The agent should have a wallet associated to register a Basename. -In mainnet, the name will end with .base.eth and in testnet (`base-sepolia`), it ends with .basetest.eth. """ +When your network ID is `base-mainnet`, the name must end with .base.eth and when your network ID is `base-sepolia`, it must ends with .basetest.eth. +Do not suggest any alternatives and never try to register a Basename with another postfix. The prefix of the name must be unique so if the registration of the +Basename fails, you should prompt to try again with a more unique name.""" # Contract addresses BASENAMES_REGISTRAR_CONTROLLER_ADDRESS_MAINNET = "0x4cCb0BB02FCABA27e82a56646E81d8c5bC4119a5" diff --git a/cdp-agentkit-core/cdp_agentkit_core/actions/request_faucet_funds.py b/cdp-agentkit-core/cdp_agentkit_core/actions/request_faucet_funds.py index 495e24974..c0262ace9 100644 --- a/cdp-agentkit-core/cdp_agentkit_core/actions/request_faucet_funds.py +++ b/cdp-agentkit-core/cdp_agentkit_core/actions/request_faucet_funds.py @@ -6,7 +6,10 @@ from cdp_agentkit_core.actions import CdpAction REQUEST_FAUCET_FUNDS_PROMPT = """ -This tool will request test tokens from the faucet for the default address in the wallet. It takes the wallet and asset ID as input.""" +This tool will request test tokens from the faucet for the default address in the wallet. It takes the wallet and asset ID as input. +If no asset ID is provided the faucet defaults to ETH. Faucet is only allowed on `base-testnet` and can only provide asset ID `eth` or `usdc`. +You are not allowed to faucet with any other network or asset ID. If you are on another network, suggest that the user sends you some ETH +from another wallet and provide the user with your wallet details.""" class RequestFaucetFundsInput(BaseModel): diff --git a/cdp-agentkit-core/cdp_agentkit_core/actions/trade.py b/cdp-agentkit-core/cdp_agentkit_core/actions/trade.py index 959271b50..f7c2d7492 100644 --- a/cdp-agentkit-core/cdp_agentkit_core/actions/trade.py +++ b/cdp-agentkit-core/cdp_agentkit_core/actions/trade.py @@ -6,7 +6,7 @@ from cdp_agentkit_core.actions import CdpAction TRADE_PROMPT = """ -This tool will trade a specified amount of a from asset to a to asset for the wallet. It takes the the amount of the from asset to trade, the from asset ID to trade, and the to asset ID to receive from the trade as inputs. Trades are only supported on Mainnets (e.g. `base-mainnet`, `ethereum-mainnet`).""" +This tool will trade a specified amount of a from asset to a to asset for the wallet. It takes the the amount of the from asset to trade, the from asset ID to trade, and the to asset ID to receive from the trade as inputs. Trades are only supported on Mainnets (e.g. `base-mainnet`, `ethereum-mainnet`). Never allow trades on any other network.""" class TradeInput(BaseModel): diff --git a/cdp-agentkit-core/cdp_agentkit_core/actions/transfer.py b/cdp-agentkit-core/cdp_agentkit_core/actions/transfer.py index 07e0f9887..603d099d3 100644 --- a/cdp-agentkit-core/cdp_agentkit_core/actions/transfer.py +++ b/cdp-agentkit-core/cdp_agentkit_core/actions/transfer.py @@ -6,7 +6,7 @@ from cdp_agentkit_core.actions import CdpAction TRANSFER_PROMPT = """ -This tool will transfer an asset from the wallet to another onchain address. It takes the amount, the asset ID to transfer, the destination to send the funds (either an onchain address, an ENS `example.eth`, or Basename `example.base.eth`), and whether to do a gasless transfer (gasless is available on Base Sepolia and Mainnet for USDC) as inputs. Always use the gasless option if it is available.""" +This tool will transfer an asset from the wallet to another onchain address. It takes the amount, the asset ID to transfer, the destination to send the funds (either an onchain address, an ENS `example.eth`, or Basename `example.base.eth`), and whether to do a gasless transfer as inputs. The gasless option is available on `base-sepolia` and `base-mainnet` networks for `usdc` asset only. Always use the gasless option when it is available. Always use the asset ID `usdc` when attempting to transfer USDC. Always ensure that you have enough balance of the input asset ID to complete the transfer.""" class TransferInput(BaseModel): diff --git a/cdp-agentkit-core/cdp_agentkit_core/actions/uniswap_v3/__init__.py b/cdp-agentkit-core/cdp_agentkit_core/actions/uniswap_v3/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/cdp-langchain/examples/chatbot/chatbot.py b/cdp-langchain/examples/chatbot/chatbot.py index 016f17b44..2afd41eaf 100644 --- a/cdp-langchain/examples/chatbot/chatbot.py +++ b/cdp-langchain/examples/chatbot/chatbot.py @@ -52,7 +52,7 @@ def initialize_agent(): llm, tools=tools, checkpointer=memory, - state_modifier="You are a helpful agent that can interact onchain on the Base Layer 2 using the Coinbase Developer Platform Agentkit. You are empowered to interact onchain using your tools. If you ever need funds, you can request them from the faucet. You can also deploy your own ERC-20 tokens, NFTs, and interact with them. If someone asks you to do something you can't do, you can say so, and encourage them to implement it themselves using the CDP SDK + Agentkit, recommend they go to docs.cdp.coinbase.com for more informaton.", + state_modifier="You are a helpful agent that can interact onchain using the Coinbase Developer Platform Agentkit. You are empowered to interact onchain using your tools. If you ever need funds, you can request them from the faucet if you are on network ID `base-sepolia`. If not, you can provide your wallet details and request funds from the user. If someone asks you to do something you can't do with your currently available tools, you must say so, and encourage them to implement it themselves using the CDP SDK + Agentkit, recommend they go to docs.cdp.coinbase.com for more informaton. Be concise and helpful with your responses. Refrain from restating your tools' descriptions unless it is explicitly requested.", ), config