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

Deployable PredictionProphetAgents provide reasoning with their predictions #488

Conversation

evangriffiths
Copy link
Contributor

@evangriffiths evangriffiths commented Sep 27, 2024

See comparison reports below - 'prophet with reasoning' appears to be a little bit better (i.e. lower MSE vs crowd prediction) than without reasoning. Not the motivation of this feature, but still a small bonus!

To reproduce:

git checkout evan/benchmark-prophet-with-same-research
python scripts/benchmark.py --n 30

Copy link
Contributor

coderabbitai bot commented Sep 27, 2024

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock, !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The pull request modifies the load method in the PredictionProphetAgent class within the prediction_market_agent/agents/prophet_agent/deploy.py file. The change involves adding the parameter include_reasoning=True during the instantiation of the PredictionProphetAgent for several model configurations. This update is applied uniformly across multiple instances, indicating a consistent enhancement to the agent's initialization process.

Changes

Files Change Summary
prediction_market_agent/agents/prophet_agent/deploy.py Updated load method to include include_reasoning=True during PredictionProphetAgent instantiation for multiple models.

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
Contributor

@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 (2)
prediction_market_agent/agents/prophet_agent/deploy.py (2)

77-77: LGTM! Consider refactoring to reduce duplication.

The addition of include_reasoning=True is consistent with the changes in other agent classes, which is good. However, given that this parameter is being added to multiple similar classes, consider refactoring to reduce code duplication.

You might want to create a base class or a factory method that sets common parameters like include_reasoning. This would make future changes easier and reduce the risk of inconsistencies. For example:

class BasePredictionProphetAgent(DeployableTraderAgentER):
    def create_agent(self, model: str, **kwargs) -> None:
        self.agent = PredictionProphetAgent(
            model=model,
            include_reasoning=True,
            tavily_storage=TavilyStorage(agent_id=self.__class__.__name__),
            logger=logger,
            **kwargs
        )

class DeployablePredictionProphetGPT4TurboFinalAgent(BasePredictionProphetAgent):
    def load(self) -> None:
        super().load()
        self.create_agent("gpt-4-turbo-2024-04-09")

This approach would centralize the common configuration and make it easier to update all agents simultaneously in the future.


Line range hint 1-122: Summary: Consistent implementation of reasoning across all agent classes

The changes in this file consistently add include_reasoning=True to all PredictionProphetAgent initializations across different model configurations. This aligns well with the PR objective of providing reasoning with predictions.

Key points:

  1. The implementation is consistent across all agent classes.
  2. Model-specific settings (like temperature) are properly maintained alongside the new parameter.
  3. The changes should enable all agents to provide explanations for their predictions.

Suggestions for improvement:

  1. Consider refactoring to reduce code duplication, as mentioned in a previous comment.
  2. Ensure that the PredictionProphetAgent class properly handles this new parameter.
  3. Update tests and documentation to reflect this new capability.

To further improve the architecture:

  1. Implement a base class or factory method for creating agents with common parameters.
  2. Consider using a configuration file or environment variables for model-specific settings to make updates easier in the future.
  3. Ensure that the reasoning provided by the agents is properly logged or returned in a way that can be utilized by the system consuming these predictions.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 03c6298 and f498a49.

⛔ Files ignored due to path filters (2)
  • poetry.lock is excluded by !**/*.lock, !**/*.lock
  • pyproject.toml is excluded by !**/*.toml
📒 Files selected for processing (1)
  • prediction_market_agent/agents/prophet_agent/deploy.py (5 hunks)
🔇 Additional comments (4)
prediction_market_agent/agents/prophet_agent/deploy.py (4)

64-64: LGTM! Consistent implementation across agent classes.

The addition of include_reasoning=True is consistent with the changes in other agent classes. This uniformity is good for code maintainability and ensures that all agent configurations provide reasoning with their predictions.


103-103: LGTM! Model-specific settings properly maintained.

The addition of include_reasoning=True is consistent with other agent classes. It's good to see that the model-specific temperature settings (1.0 for both research and prediction) are maintained alongside this new parameter.


119-119: LGTM! Consistent implementation across all agent classes.

The addition of include_reasoning=True is consistent across all agent classes, including this final instance. The model-specific temperature settings are correctly maintained.

To ensure the changes have been applied consistently and correctly across all agent classes, please run the following verification script:

#!/bin/bash
# Description: Verify consistent application of include_reasoning across all agent classes

echo "Checking for consistent application of include_reasoning parameter:"
rg --type python "PredictionProphetAgent\(" prediction_market_agent/agents/prophet_agent/deploy.py

echo "Checking for any instances where include_reasoning might be missing:"
rg --type python "PredictionProphetAgent\(" prediction_market_agent/agents/prophet_agent/deploy.py | grep -v "include_reasoning"

echo "Verifying that all DeployablePredictionProphet*Agent classes have been updated:"
rg --type python "class DeployablePredictionProphet" prediction_market_agent/agents/prophet_agent/deploy.py

This script will help ensure that the include_reasoning parameter has been added consistently to all relevant agent classes and that no instances have been missed.


51-51: LGTM! Verify the impact of including reasoning.

The addition of include_reasoning=True aligns with the PR objective of providing reasoning with predictions. This change should enable the agent to explain its decision-making process.

To ensure this change is properly implemented and doesn't have unintended side effects, please run the following verification script:

@evangriffiths
Copy link
Contributor Author

Comparison Report

Market Results

Number of markets Proportion resolved Proportion YES Proportion NO
29 0 0.310345 0.689655

Agent Results

Summary Statistics

Agents MSE for p_yes Mean confidence % within +-0.05 % within +-0.1 % within +-0.2 % correct outcome % precision for yes % precision for no % recall for yes % recall for no confidence/p_yes error correlation Mean info_utility Proportion answerable Proportion answered Mean cost ($) Mean time (s)
random 0.208596 0.500779 0 6.89655 10.3448 37.931 26.3158 60 55.5556 30 -0.07497 nan 1 1
prediction_prophet_gpt-4o-no-reasoning 0.0662538 0.767857 28.5714 50 71.4286 78.5714 60 88.8889 75 80 -0.181556 0.839286 0.965517 0.965517
prediction_prophet_gpt-4o-reasoning 0.0535608 0.780357 35.7143 53.5714 78.5714 82.1429 66.6667 89.4737 75 85 0.105153 0.858929 0.965517 0.965517

Markets

Market Question random p_yes prediction_prophet_gpt-4o-no-reasoning p_yes prediction_prophet_gpt-4o-reasoning p_yes reference p_yes
Will the LK-99 room temp, ambient pressure superconductivity pre-print replicate before 2025? 0.26 [NO] 0.10 [NO] 0.05 [NO] 0.02 [NO]
In early 2028, will an AI be able to generate a full high-quality movie to a prompt? 0.80 [YES] 0.30 [NO] 0.30 [NO] 0.44 [NO]
Will Andrew Tate be found guilty of human (sex) trafficking? 0.86 [YES] 0.30 [NO] 0.40 [NO] 0.62 [YES]
Will AI be a major topic during the 2024 presidential debates in the United States? (please read criteria) 0.82 [YES] 0.80 [YES] 0.85 [YES] 0.09 [NO]
Will an AI get gold on any International Math Olympiad by the end of 2025? 0.50 [YES] 0.65 [YES] 0.60 [YES] 0.74 [YES]
Will Biden finish his term? 0.20 [NO] 0.80 [YES] 0.75 [YES] 0.91 [YES]
Will the average global temperature in 2024 exceed 2023? 0.69 [YES] 0.95 [YES] 0.95 [YES] 0.97 [YES]
Will either Joe Biden or Donald Trump be elected President in 2024? 0.94 [YES] 0.00 [NO] 0.50 [NO] 0.46 [NO]
Will OpenAI hint at or claim to have AGI by 2025 end? 0.76 [YES] 0.65 [YES] 0.40 [NO] 0.23 [NO]
Will Jimmy Carter become a centenarian? 0.76 [YES] 0.70 [YES] 0.85 [YES] 1.00 [YES]
Will Joe Biden resign in his first term? 0.51 [YES] 0.10 [NO] 0.10 [NO] 0.09 [NO]
Will the US enter a recession by the end of 2024? 0.89 [YES] 0.30 [NO] 0.40 [NO] 0.17 [NO]
Will a large language model beat a super grandmaster playing chess by 2028? 0.22 [NO] 0.10 [NO] 0.10 [NO] 0.62 [YES]
Will Trump win the popular vote in the 2024 Election? 0.34 [NO] 0.35 [NO] 0.30 [NO] 0.23 [NO]
Will Joe Biden get impeached in his first term? 0.52 [YES] 0.10 [NO] 0.10 [NO] 0.01 [NO]
Will Aella be romantically or sexually involved with Destiny by the end of 2024? 0.96 [YES] 0.10 [NO] 0.10 [NO] 0.05 [NO]
Will AI wipe out humanity before the year 2030? 0.13 [NO] 0.05 [NO] 0.05 [NO] 0.07 [NO]
Will Threads have more daily active users than Twitter by the end of 2024? 0.53 [YES] 0.10 [NO] 0.10 [NO] 0.04 [NO]
Will Harris and Trump have a second debate? 0.57 [YES] 0.30 [NO] 0.30 [NO] 0.27 [NO]
Will a Democrat win the 2024 US presidential election? 0.86 [YES] 0.55 [YES] 0.55 [YES] 0.56 [YES]
Will AI pass the Longbets version of the Turing test by the end of 2029? 0.11 [NO] 0.70 [YES] 0.70 [YES] 0.60 [YES]
Will Donald Trump win the 2024 US Presidential Election? 0.77 [YES] 0.42 [NO] 0.42 [NO] 0.46 [NO]
Will a room-temperature, atmospheric pressure superconductor be discovered before 2030? 0.68 [YES] 0.20 [NO] 0.20 [NO] 0.12 [NO]
Will AI wipe out humanity before the year 2100 0.41 [NO] 0.10 [NO] 0.10 [NO] 0.12 [NO]
Will Kamala Harris flip a state? 0.27 [NO] S S 0.51 [YES]
By the end of 2026, will we have transparency into any useful internal pattern within a Large Language Model whose semantics would have been unfamiliar to AI and cognitive science in 2006? 0.24 [NO] 0.70 [YES] 0.70 [YES] 0.29 [NO]
Will "GPT" be said by anyone in a presidential debate in 2024? 0.94 [YES] 0.20 [NO] 0.20 [NO] 0.09 [NO]
Will there be an AI language model that strongly surpasses ChatGPT and other OpenAI models before the end of 2024? 0.45 [NO] 0.65 [YES] 0.65 [YES] 0.18 [NO]
Will China launch a full-scale invasion of Taiwan before 2030? 0.64 [YES] 0.35 [NO] 0.35 [NO] 0.32 [NO]

@evangriffiths
Copy link
Contributor Author

Comparison Report

Market Results

Number of markets Proportion resolved Proportion YES Proportion NO
15 0 0.333333 0.666667

Agent Results

Summary Statistics

Agents MSE for p_yes Mean confidence % within +-0.05 % within +-0.1 % within +-0.2 % correct outcome % precision for yes % precision for no % recall for yes % recall for no confidence/p_yes error correlation Mean info_utility Proportion answerable Proportion answered Mean cost ($) Mean time (s)
random 0.39034 0.508463 6.66667 6.66667 13.3333 40 33.3333 66.6667 80 20 -0.192604 nan 1 1
prediction_prophet_gpt-4o-no-reasoning 0.0891317 0.82 20 40 73.3333 86.6667 71.4286 100 100 80 -0.181848 0.906667 1 1
prediction_prophet_gpt-4o-reasoning 0.0803818 0.843333 40 60 80 86.6667 71.4286 100 100 80 -0.401814 0.88 1 1

Markets

Market Question random p_yes prediction_prophet_gpt-4o-no-reasoning p_yes prediction_prophet_gpt-4o-reasoning p_yes reference p_yes
Will Biden's approval rating be 40% or higher at the end of September 2024? 0.62 [YES] 0.85 [YES] 0.95 [YES] 0.99 [YES]
Will Claude 3.5 Haiku release before the end of September? 0.85 [YES] 0.20 [NO] 0.20 [NO] 0.01 [NO]
Will Donald Trump still be alive when September ends? 0.80 [YES] 0.85 [YES] 0.95 [YES] 0.99 [YES]
Will Russia launch an armed attack against a NATO member by the end of September 2024? 0.69 [YES] 0.10 [NO] 0.10 [NO] 0.01 [NO]
Will Joe Biden still be alive when September ends? 0.04 [NO] 0.85 [YES] 0.95 [YES] 0.99 [YES]
Will Ukraine take control of the Kursk Nuclear Power Plant by the end of this month? 0.64 [YES] 0.20 [NO] 0.10 [NO] 0.01 [NO]
Will Anthropic add voice support to Claude within ~3 months? (before October 2024) 0.23 [NO] 0.65 [YES] 0.40 [NO] 0.02 [NO]
Will the NASDAQ Composite Index fall below 13,000 by the end of September 2024? 0.91 [YES] 0.05 [NO] 0.05 [NO] 0.01 [NO]
Will the UK outright maximum temperature record be broken in 2024? 0.74 [YES] 0.30 [NO] 0.65 [YES] 0.02 [NO]
Will Waymo work on highways in 2024? 0.80 [YES] 0.75 [YES] 0.75 [YES] 0.78 [YES]
Will Truth Social shares (DJT) fall below $10 by the end of September? 0.46 [NO] 0.80 [YES] 0.75 [YES] 0.01 [NO]
Will Lady Gaga sing an original song in Joker: Folie à Deux? 🃏🎤🎶 0.63 [YES] 0.80 [YES] 0.75 [YES] 0.86 [YES]
Will Adobe's senior management team say that generative AI is a headwind to Adobe by Sep 2024? 0.77 [YES] 0.10 [NO] 0.05 [NO] 0.07 [NO]
Will Donald Trump be sentenced to prison in September of 2024? 0.87 [YES] 0.10 [NO] 0.10 [NO] 0.01 [NO]
Will there be another story about RFK Jr. and an unusual situation with a dead animal before October 1st? 0.61 [YES] 0.30 [NO] 0.20 [NO] 0.01 [NO]

@evangriffiths evangriffiths merged commit fcd219c into main Sep 30, 2024
9 checks passed
@evangriffiths evangriffiths deleted the evan/PredictionProphetAgent-provides-reasoning-with-prediction branch September 30, 2024 20: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