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

Add o1 agents to bet simulation script #453

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

evangriffiths
Copy link
Contributor

And the results:

## DeployablePredictionProphetGPTo1PreviewAgent

73 bets

| strategy                                                  |   bet_amount |   bet_profit |      roi |   start_balance |   end_balance |
|:----------------------------------------------------------|-------------:|-------------:|---------:|----------------:|--------------:|
| original                                                  |      73      |      28.7079 | 39.3259  |             nan |      nan      |
| MaxAccuracyBettingStrategy(bet_amount=1)                  |      73      |      32.8702 | 45.0276  |              50 |       82.8702 |
| MaxAccuracyBettingStrategy(bet_amount=2)                  |     146      |      54.111  | 37.0624  |              50 |      104.111  |
| MaxAccuracyBettingStrategy(bet_amount=25)                 |    1825      |     -70.2807 | -3.851   |              50 |      -20.2807 |
| KellyBettingStrategy(max_bet_amount=1)                    |      43.4858 |      27.7156 | 63.7347  |              50 |       77.7156 |
| KellyBettingStrategy(max_bet_amount=2)                    |      81.8554 |      44.4763 | 54.3353  |              50 |       94.4763 |
| KellyBettingStrategy(max_bet_amount=25)                   |     307.877  |      55.6821 | 18.0858  |              50 |      105.682  |
| MaxAccuracyWithKellyScaledBetsStrategy(max_bet_amount=1)  |      53.0684 |      30.3835 | 57.2534  |              50 |       80.3835 |
| MaxAccuracyWithKellyScaledBetsStrategy(max_bet_amount=2)  |     100.826  |      48.8668 | 48.4665  |              50 |       98.8668 |
| MaxAccuracyWithKellyScaledBetsStrategy(max_bet_amount=25) |     479.854  |      22.5839 |  4.70642 |              50 |       72.5839 |
| MaxExpectedValueBettingStrategy(bet_amount=1)             |      73      |      31.6909 | 43.4121  |              50 |       81.6909 |
| MaxExpectedValueBettingStrategy(bet_amount=2)             |     146      |      51.7754 | 35.4626  |              50 |      101.775  |
| MaxExpectedValueBettingStrategy(bet_amount=25)            |    1825      |     -96.7996 | -5.30409 |              50 |      -46.7996 |

## DeployablePredictionProphetGPTo1MiniAgent

75 bets

| strategy                                                  |   bet_amount |   bet_profit |       roi |   start_balance |   end_balance |
|:----------------------------------------------------------|-------------:|-------------:|----------:|----------------:|--------------:|
| original                                                  |      77.3159 |     16.8776  |  21.8294  |             nan |      nan      |
| MaxAccuracyBettingStrategy(bet_amount=1)                  |      75      |     15.6186  |  20.8247  |              50 |       65.6186 |
| MaxAccuracyBettingStrategy(bet_amount=2)                  |     150      |     21.7638  |  14.5092  |              50 |       71.7638 |
| MaxAccuracyBettingStrategy(bet_amount=25)                 |    1875      |   -299.585   | -15.9779  |              50 |     -249.585  |
| KellyBettingStrategy(max_bet_amount=1)                    |      33.9869 |     15.5282  |  45.6888  |              50 |       65.5282 |
| KellyBettingStrategy(max_bet_amount=2)                    |      61.4724 |     24.2627  |  39.4693  |              50 |       74.2627 |
| KellyBettingStrategy(max_bet_amount=25)                   |     298.726  |     13.9392  |   4.66621 |              50 |       63.9392 |
| MaxAccuracyWithKellyScaledBetsStrategy(max_bet_amount=1)  |      56.6852 |     12.3016  |  21.7016  |              50 |       62.3016 |
| MaxAccuracyWithKellyScaledBetsStrategy(max_bet_amount=2)  |     108.736  |     15.0322  |  13.8245  |              50 |       65.0322 |
| MaxAccuracyWithKellyScaledBetsStrategy(max_bet_amount=25) |     698.646  |   -193.2     | -27.6534  |              50 |     -143.2    |
| MaxExpectedValueBettingStrategy(bet_amount=1)             |      75      |      9.00648 |  12.0086  |              50 |       59.0065 |
| MaxExpectedValueBettingStrategy(bet_amount=2)             |     150      |      6.5793  |   4.3862  |              50 |       56.5793 |
| MaxExpectedValueBettingStrategy(bet_amount=25)            |    1875      |   -548.406   | -29.2483  |              50 |     -498.406  |

Copy link

coderabbitai bot commented Oct 1, 2024

Walkthrough

The changes involve the addition of new agent configurations and an expansion of betting strategies within the match_bets_with_langfuse_traces.py script. Two new agents have been introduced in the agent_gcp_secret_map, enhancing the retrieval of private keys. Additionally, the list of betting strategies has been broadened to include various instances of existing strategies with different bet amounts, maintaining the script's overall structure and functionality.

Changes

Files Change Summary
examples/monitor/match_bets_with_langfuse_traces.py Added new agents DeployablePredictionProphetGPTo1PreviewAgent and DeployablePredictionProphetGPTo1MiniAgent to agent_gcp_secret_map. Expanded betting strategies with multiple instances of MaxAccuracyBettingStrategy, KellyBettingStrategy, MaxAccuracyWithKellyScaledBetsStrategy, and MaxExpectedValueBettingStrategy with varying bet amounts.

Possibly related PRs


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
examples/monitor/match_bets_with_langfuse_traces.py (1)

89-90: LGTM! Consider improving readability.

The addition of new agents to the agent_gcp_secret_map is consistent with the existing pattern and naming conventions.

To improve readability, consider grouping related agents together or adding comments to separate different types of agents. For example:

agent_gcp_secret_map = {
    # GPT-4 based agents
    "DeployablePredictionProphetGPT4TurboFinalAgent": "pma-prophetgpt4turbo-final",
    "DeployablePredictionProphetGPT4TurboPreviewAgent": "pma-prophetgpt4",
    "DeployablePredictionProphetGPT4oAgent": "pma-prophetgpt3",
    
    # GPT-3.5 based agents
    "DeployablePredictionProphetGPTo1PreviewAgent": "pma-prophet-o1-preview",
    "DeployablePredictionProphetGPTo1MiniAgent": "pma-prophet-o1-mini",
    
    # Other specialized agents
    "DeployableOlasEmbeddingOAAgent": "pma-evo-olas-embeddingoa",
    "DeployableThinkThoroughlyAgent": "pma-think-thoroughly",
    "DeployableThinkThoroughlyProphetResearchAgent": "pma-think-thoroughly-prophet-research",
    "DeployableKnownOutcomeAgent": "pma-knownoutcome",
}

This organization makes it easier to understand the different types of agents at a glance.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 1a7b2ed and b9b89c6.

📒 Files selected for processing (1)
  • examples/monitor/match_bets_with_langfuse_traces.py (1 hunks)
🔇 Additional comments (2)
examples/monitor/match_bets_with_langfuse_traces.py (2)

Line range hint 1-214: Overall assessment: Changes enhance script capabilities with room for minor improvements.

The additions to this file significantly expand its capabilities for testing and comparing different betting strategies across various agent configurations. The new agent entries and the comprehensive set of betting strategies are well-integrated with the existing code structure.

Key points:

  1. New agent configurations added to agent_gcp_secret_map.
  2. Expanded set of betting strategies with varying bet amounts.

While the changes are generally good, there are opportunities for improvement:

  1. Consider grouping related agents in agent_gcp_secret_map for better readability.
  2. Refactor the strategy initialization to reduce code duplication and improve maintainability.

These changes align well with the PR objectives of introducing new betting strategies and comparing their performance across different agent configurations.


Line range hint 101-114: LGTM! Consider refactoring for improved maintainability.

The addition of multiple betting strategies with varying bet amounts provides a comprehensive set for testing and comparison. This approach allows for a thorough analysis of strategy performance across different scales.

To improve maintainability and reduce code duplication, consider refactoring the strategy initialization. Here's a suggestion:

def create_strategies(bet_amounts):
    strategy_classes = [
        MaxAccuracyBettingStrategy,
        KellyBettingStrategy,
        MaxAccuracyWithKellyScaledBetsStrategy,
        MaxExpectedValueBettingStrategy
    ]
    
    strategies = []
    for strategy_class in strategy_classes:
        for amount in bet_amounts:
            if strategy_class in [KellyBettingStrategy, MaxAccuracyWithKellyScaledBetsStrategy]:
                strategies.append(strategy_class(max_bet_amount=amount))
            else:
                strategies.append(strategy_class(bet_amount=amount))
    
    return strategies

bet_amounts = [1, 2, 25]
strategies = create_strategies(bet_amounts)

This refactoring makes it easier to add new strategies or modify bet amounts in the future. It also reduces the risk of errors when initializing multiple similar strategies.

To ensure that all necessary imports are available for this refactoring, let's verify the imports:

This will help confirm that all required strategy classes are properly imported.

✅ Verification successful

Verification Successful

The imports for betting strategies are correctly handled. The proposed refactoring improves maintainability without introducing import issues.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify imports for betting strategies

rg --type python "from prediction_market_agent_tooling.deploy.betting_strategy import" -A 10

Length of output: 125


Script:

#!/bin/bash
# Description: Verify imports for betting strategies using corrected file type

rg --type py "from prediction_market_agent_tooling.deploy.betting_strategy import" -A 10

Length of output: 3611


Script:

#!/bin/bash
# Description: Alternative method to verify imports using grep

grep -r "from prediction_market_agent_tooling.deploy.betting_strategy import" .

Length of output: 555

@evangriffiths evangriffiths merged commit 29224f8 into main Oct 1, 2024
14 checks passed
@evangriffiths evangriffiths deleted the evan/add-o1-agents-to-bet-simulations branch October 1, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants