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

Cheaper think thoroughly prophet agent #539

Merged
merged 1 commit into from
Nov 4, 2024
Merged

Cheaper think thoroughly prophet agent #539

merged 1 commit into from
Nov 4, 2024

Conversation

kongzii
Copy link
Contributor

@kongzii kongzii commented Nov 1, 2024

I think we can safely make think thoroughly prophet cheaper, by using gpt 4o on its prophet-research part.

Looking at Dune, gpt-4o prophet agent is among the best:

Screenshot by Dropbox Capture

So if we switch to 4o only in the prophet-research part, it should still be good (if not better).

Copy link
Contributor

coderabbitai bot commented Nov 1, 2024

Walkthrough

The pull request modifies the DeployableThinkThoroughlyAgentBase and its derived classes by removing the model attribute from their definitions and simplifying the agent initialization process. In think_thoroughly_agent.py, the ThinkThoroughlyBase class and its subclasses have been updated to introduce new model attributes while removing the model parameter from constructors. The changes also enhance error handling and adjust method signatures to streamline model usage, ultimately restructuring how models are managed within the agent classes.

Changes

File Path Change Summary
prediction_market_agent/agents/think_thoroughly_agent/deploy.py Removed model attribute from DeployableThinkThoroughlyAgentBase and derived classes. Updated load method to exclude model parameter.
prediction_market_agent/agents/think_thoroughly_agent/think_thoroughly_agent.py Added model and model_for_generate_prediction_for_one_outcome attributes in ThinkThoroughlyBase. Removed model parameter from constructor. Updated generate_prediction_for_one_outcome method to use new attributes. Enhanced error handling in ThinkThoroughlyWithPredictionProphetResearch.

Possibly related PRs

Suggested reviewers

  • evangriffiths

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: 1

🧹 Outside diff range and nitpick comments (1)
prediction_market_agent/agents/think_thoroughly_agent/deploy.py (1)

Line range hint 1-70: Consider architectural implications of hardcoded model selection.

Moving model selection from deployment configuration to base classes reduces flexibility. This architectural change makes it harder to:

  1. Override model choice at deployment time
  2. A/B test different models
  3. Quickly respond to model deprecations or upgrades

Consider maintaining deployment-time model configuration capability while defaulting to gpt-4o.

Consider adding an optional model parameter to maintain flexibility:

 def load(self) -> None:
-    self.agent = self.agent_class(enable_langfuse=self.enable_langfuse)
+    self.agent = self.agent_class(
+        enable_langfuse=self.enable_langfuse,
+        model=getattr(self, 'model', None)  # Use default if not specified
+    )
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 678b589 and 8487771.

📒 Files selected for processing (2)
  • prediction_market_agent/agents/think_thoroughly_agent/deploy.py (1 hunks)
  • prediction_market_agent/agents/think_thoroughly_agent/think_thoroughly_agent.py (4 hunks)
🔇 Additional comments (4)
prediction_market_agent/agents/think_thoroughly_agent/deploy.py (1)

24-24: Verify model configuration in base classes.

The removal of the model parameter from agent initialization suggests that model configuration has been moved to the base classes. While this aligns with the PR objective to use gpt-4o, ensure that the model is properly configured in ThinkThoroughlyBase or its subclasses.

✅ Verification successful

Model configuration is properly handled in base classes

The removal of the model parameter from agent initialization is correct as the model configuration is properly defined in the class hierarchy:

  • ThinkThoroughlyBase declares the model attributes
  • ThinkThoroughlyWithPredictionProphetResearch sets model_for_generate_prediction_for_one_outcome = "gpt-4o-2024-08-06" as intended by the PR
  • The change aligns with the goal of making the prophet agent cheaper while maintaining the architecture
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify model configuration in base classes
# Expected: Find model configuration in ThinkThoroughlyBase or its subclasses

# Search for model configuration in the base classes
rg -A 5 "gpt-4" prediction_market_agent/agents/think_thoroughly_agent/think_thoroughly_agent.py

Length of output: 539


Script:

#!/bin/bash
# Let's verify the class hierarchy and model configuration
ast-grep --pattern 'class $_ {
  $$$
  model = $_
  $$$
}'

Length of output: 60


Script:

#!/bin/bash
# Let's check the class definitions and their inheritance
rg -A 5 "^class.*ThinkThoroughly" prediction_market_agent/agents/think_thoroughly_agent/think_thoroughly_agent.py

Length of output: 817

prediction_market_agent/agents/think_thoroughly_agent/think_thoroughly_agent.py (3)

108-109: LGTM! Good separation of model configurations.

The addition of separate model attributes for different operations provides flexibility and allows derived classes to optimize their model usage independently.


343-343: LGTM! Correct model attribute usage.

The method now correctly uses the specialized model attribute for prediction generation, aligning with the PR's objective of optimizing model usage.


378-379: LGTM! Consistent model usage for research-based agent.

Using the same GPT-4 Turbo model for all operations in this research-based agent is appropriate, as it maintains consistency in the quality of both research and predictions.

Comment on lines +445 to +446
model = "gpt-4-turbo-2024-04-09"
model_for_generate_prediction_for_one_outcome = "gpt-4o-2024-08-06"
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Model version inconsistency detected in codebase

The model version "gpt-4o-2024-08-06" appears to be consistently used across multiple files as a default model, suggesting it's an intentional configuration rather than a typo. However, this model version is dated August 2024, which is beyond the current date. Consider:

  • Using the available "gpt-4-turbo-2024-04-09" model which is consistently used in other parts of the codebase
  • Updating the model version to match currently available OpenAI models
🔗 Analysis chain

Verify the availability and correctness of the model version.

While using different models for research and predictions aligns with the PR's cost optimization goal, the model version "gpt-4o-2024-08-06" appears to be from a future date. Please verify:

  1. Is this model currently available?
  2. Is this the correct version string?

Let's verify the model availability:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other occurrences of this model version to ensure consistency
rg "gpt-4o-2024-08-06"

# Search for model version patterns to see what other versions are in use
rg -e "gpt-[0-9a-z-]+-[0-9]{4}-[0-9]{2}-[0-9]{2}"

Length of output: 2088

@kongzii kongzii merged commit d9086d4 into main Nov 4, 2024
9 checks passed
@kongzii kongzii deleted the peter/cheaper-ttp branch November 4, 2024 11:06
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