Skip to content

Commit

Permalink
chore: prompt optimization to pass 'pytest --count=2 -n 32 agent_traj…
Browse files Browse the repository at this point in the history
…ectory/*.py --alluredir allure-results --model=gpt-3.5-turbo

'
  • Loading branch information
naaive committed Aug 21, 2024
1 parent 1ee0bb0 commit 3c73f3b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion openagent/executors/funding_rate_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class ARGS(BaseModel):
exchange: str = Field(description="Name of the exchange (ccxt supported), e.g., 'binance'")
symbol: str = Field(description="Trading pair symbol, e.g., 'BTC/USDT:USDT'")
symbol: str = Field(description="Trading pair symbol, e.g., 'BTC/USDT'")


class FundingRateExecutor(BaseTool):
Expand Down Expand Up @@ -46,6 +46,8 @@ async def _arun(

def fetch_funding_rate(exchange_name: str, symbol: str) -> float:
try:
if not symbol.endswith(":USDT"):
symbol = f"{symbol}:USDT"
exchange_class = getattr(ccxt, exchange_name)
exchange = exchange_class()

Expand Down
2 changes: 1 addition & 1 deletion openagent/executors/price_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


class ARGS(BaseModel):
token: str = Field(description="token symbol")
token: str = Field(description="token symbol, e.g., 'ETH', 'BTC'")


class PriceExecutor(BaseTool):
Expand Down
4 changes: 2 additions & 2 deletions tests/agent_trajectory/market_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def test_query_eth_price(market_analysis_agent):
@pytest.mark.asyncio
async def test_query_funding_rate(market_analysis_agent):
events = market_analysis_agent.astream_events(
{"messages": [HumanMessage(content="What's the funding rate for BTC/USDT in binance?", name="human")]}, version="v1"
{"messages": [HumanMessage(content="What's the funding rate for BTC in binance?", name="human")]}, version="v1"
)

tool_end_count = 0
Expand All @@ -76,7 +76,7 @@ async def test_query_nft_ranking(market_analysis_agent):
async for event in events:
if event["event"] == "on_tool_end":
tool_end_count += 1
# assert event["name"] == "NFTRankingExecutor"
assert event["name"] == "NFTRankingExecutor"

assert tool_end_count > 0, "The on_tool_end event did not occur"

Expand Down

0 comments on commit 3c73f3b

Please sign in to comment.