Skip to content

Commit

Permalink
test and prompt fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nerfZael committed May 31, 2024
1 parent c1ed593 commit 3c7c422
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion autotx/agents/SwapTokensAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ def swap(autotx: AutoTx, token_to_sell: str, token_to_buy: str) -> list[models.T
)

if len(sell_parts) == 2 and len(buy_parts) == 2:
raise InvalidInput(f"Invalid input: \"{token_to_sell} to {token_to_buy}\". Only one token amount should be provided. IMPORTANT: Take another look at the user's goal, and try again.")
sell_amount = Decimal(sell_parts[0])
buy_amount = Decimal(buy_parts[0])
sell_token = sell_parts[1]
buy_token = buy_parts[1]

raise InvalidInput(f"Invalid input: \"{token_to_sell} to {token_to_buy}\". Only one token amount should be provided. Choose between '{sell_amount} {sell_token} to {buy_token}' or '{sell_token} to {buy_amount} {buy_token}'.")

if len(sell_parts) < 2 and len(buy_parts) < 2:
raise InvalidInput(f"Invalid input: \"{token_to_sell} to {token_to_buy}\". Token amount is missing. Only one token amount should be provided.")
Expand Down
2 changes: 1 addition & 1 deletion autotx/tests/agents/token/research/test_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_research_and_swap_many_tokens_subjective_simple(configuration, auto_tx)
gaming_token_address = get_top_token_addresses_by_market_cap("gaming", "MAINNET", 1, auto_tx)[0]
gaming_token_balance_in_safe = manager.balance_of(gaming_token_address)

ai_token_address = get_top_token_addresses_by_market_cap("ai-themed-coins", "MAINNET", 1, auto_tx)[0]
ai_token_address = get_top_token_addresses_by_market_cap("artificial-intelligence", "MAINNET", 1, auto_tx)[0]
ai_token_balance_in_safe = manager.balance_of(ai_token_address)

meme_token_address = get_top_token_addresses_by_market_cap("meme-token", "MAINNET", 1, auto_tx)[0]
Expand Down

0 comments on commit 3c7c422

Please sign in to comment.