From 5fe7dfd40ecb9cf088c4a9c42d5f78fbfc3a3605 Mon Sep 17 00:00:00 2001 From: Evan Griffiths <56087052+evangriffiths@users.noreply.github.com> Date: Fri, 20 Sep 2024 09:41:08 +0100 Subject: [PATCH] Remove timestamp check when matching bets with traces (#421) --- examples/monitor/match_bets_with_langfuse_traces.py | 9 ++++++--- .../tools/langfuse_client_utils.py | 5 ----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/examples/monitor/match_bets_with_langfuse_traces.py b/examples/monitor/match_bets_with_langfuse_traces.py index 07c07390..218c1183 100644 --- a/examples/monitor/match_bets_with_langfuse_traces.py +++ b/examples/monitor/match_bets_with_langfuse_traces.py @@ -16,7 +16,7 @@ if __name__ == "__main__": api_keys = APIKeys() assert api_keys.bet_from_address == Web3.to_checksum_address( - "0xe7aa88a1d044e5c987ecce55ae8d2b562a41b72d" # prophetgpt4 + "0xA8eFa5bb5C6ad476c9E0377dbF66cC41CB6D5bdD" # prophet_gpt4_final ) start_time = datetime(2024, 9, 13) langfuse = Langfuse( @@ -44,7 +44,6 @@ start_time=start_time, end_time=None, ) - print(f"All bets: {len(bets)}") # All bets should have a trace, but not all traces should have a bet # (e.g. if all markets are deemed unpredictable), so iterate over bets @@ -54,4 +53,8 @@ if trace: bets_with_traces.append(ResolvedBetWithTrace(bet=bet, trace=trace)) - print(f"Matched bets with traces: {len(bets_with_traces)}") + print(f"Number of bets since {start_time}: {len(bets_with_traces)}") + if len(bets_with_traces) != len(bets): + raise ValueError( + f"{len(bets) - len(bets_with_traces)} bets do not have a corresponding trace" + ) diff --git a/prediction_market_agent_tooling/tools/langfuse_client_utils.py b/prediction_market_agent_tooling/tools/langfuse_client_utils.py index 0f99d75b..db01d0e4 100644 --- a/prediction_market_agent_tooling/tools/langfuse_client_utils.py +++ b/prediction_market_agent_tooling/tools/langfuse_client_utils.py @@ -150,10 +150,5 @@ def get_trace_for_bet( add_utc_timezone_validator(bet.created_time), [t.timestamp for t in traces_for_bet], ) - # Sanity check - the trace should be after the bet - if traces_for_bet[closest_trace_index].timestamp < add_utc_timezone_validator( - bet.created_time - ): - return None return traces_for_bet[closest_trace_index]