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

Bump PMAT, prophet, and remove dead code #550

Merged
merged 5 commits into from
Nov 21, 2024
Merged

Bump PMAT, prophet, and remove dead code #550

merged 5 commits into from
Nov 21, 2024

Conversation

kongzii
Copy link
Contributor

@kongzii kongzii commented Nov 16, 2024

No description provided.

Copy link
Contributor

coderabbitai bot commented Nov 16, 2024

Walkthrough

This pull request involves the deletion of several files related to AI models within the prediction_market_agent package. Specifically, it removes the abstract_ai_models.py, llama_ai_models.py, and openai_ai_models.py files, which included definitions for various classes and methods used for AI chat interactions. Additionally, the associated unit tests for the Llama AI model have been removed. The changes eliminate the Message class, abstract model classes, and their implementations, along with related testing functionalities.

Changes

File Path Change Summary
prediction_market_agent/ai_models/abstract_ai_models.py Removed Message class, AbstractAiChatModel class, and its complete method.
prediction_market_agent/ai_models/llama_ai_models.py Removed LlamaRole enum, ChatReplicateLLamaModel class, its complete method, and construct_llama_prompt function.
prediction_market_agent/ai_models/openai_ai_models.py Removed ChatOpenAIModel class, OpenAiRole enum, its complete method, and constructor.
tests/ai_models/test_llama_ai_models.py Removed unit tests for construct_llama_prompt function, including three test functions.
prediction_market_agent/tools/web_scrape/markdown.py Updated web_scrape function to modify the @db_cache decorator to include ignore_args=["timeout"].
prediction_market_agent/agents/social_media_agent/deploy.py Updated deploy_local method call to change parameter timeout to run_time.
prediction_market_agent/agents/think_thoroughly_agent/deploy.py Renamed store_prediction to store_predictions and timeout to run_time in __main__.
scripts/agent_app.py Renamed parameter store_prediction to store_predictions in predict function.

Possibly related PRs

  • ThinkThoroughly powered by Prophet #315: The changes in the main PR involve the removal of the AbstractAiChatModel class, which is directly related to the ChatReplicateLLamaModel and ChatOpenAIModel classes that extend it in the retrieved PRs. This indicates a structural change affecting all subclasses.
  • Migrate prophet #366: The modifications in the main PR, particularly the removal of the complete method in AbstractAiChatModel, directly impact the DeployableTraderAgentER and its subclasses, which rely on this method for their functionality.
  • Tavily storage #381: The changes in the main PR regarding the Message class and the complete method are relevant to the answer_binary_market method in the DeployableTraderAgentER class, as it utilizes similar structures for processing messages.
  • Update DeployableTraderAgent betting stategies for max profit, based on historical simulations #494: The update in the main PR that removes the complete method in AbstractAiChatModel affects the betting strategies in the DeployableTraderAgentER and its subclasses, which are designed to handle predictions and market interactions.
  • Update prophet with reduced false errors #552: The changes in the main PR regarding the removal of the complete method in AbstractAiChatModel are relevant to the modifications in the answer_binary_market method of DeployableTraderAgentER, which now reflects a more streamlined approach to handling predictions.

Suggested reviewers

  • evangriffiths

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d0b34aa and f1e5424.

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

62-62: LGTM! Parameter name change improves clarity.

The rename from store_prediction to store_predictions is more accurate as it likely handles multiple predictions.


67-67: Verify the parameter rename across the codebase.

The rename from timeout to run_time is more descriptive and clearer. Let's verify this change is consistent across the codebase.

✅ Verification successful

Parameter rename is consistent across the codebase

The search results show that run_time is consistently used in both instances where deploy_local is called:

  • In prediction_market_agent/agents/think_thoroughly_agent/deploy.py
  • In prediction_market_agent/agents/social_media_agent/deploy.py

There are no remaining instances of timeout parameter in deploy_local calls, confirming the rename was applied consistently.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining instances of 'timeout' parameter in deploy_local calls
# and verify the consistency of 'run_time' parameter usage

# Search for any remaining timeout parameters in deploy_local calls
ast-grep --pattern 'deploy_local($$$timeout$$$)'

# Search for the new run_time parameter usage for consistency
ast-grep --pattern 'deploy_local($$$run_time$$$)'

Length of output: 102


Script:

#!/bin/bash
# Let's try a broader search to find all occurrences of deploy_local function calls
# and their parameter patterns

# Search for deploy_local function definition and usages
rg "deploy_local" -A 5 -B 5

# Also search for files containing both timeout and run_time to catch any rename patterns
rg -l "timeout.*run_time|run_time.*timeout"

Length of output: 1546

prediction_market_agent/agents/social_media_agent/deploy.py (2)

91-91: LGTM! Parameter rename aligns with codebase standardization.

The change from timeout to run_time is consistent with similar changes in other agent classes, improving parameter naming consistency across the codebase.


Line range hint 1-91: Verify impact of AI models removal on this class.

While this class still uses GPT-4 for social media text generation, let's verify that the removal of AI model files (abstract_ai_models.py, llama_ai_models.py, openai_ai_models.py) doesn't affect this class's functionality.

✅ Verification successful

Let me check the implementation of these functions to fully verify the impact.


No impact from AI models removal - class uses Autogen for LLM interactions

The DeployableSocialMediaAgent class and its dependencies are not affected by the removal of AI model files. The social media text generation is handled through Microsoft's Autogen library (autogen) for LLM interactions, not through the removed AI model files. The implementation in social_agent.py shows direct usage of Autogen's AssistantAgent and UserProxyAgent with OpenAI's API, without any dependencies on the removed files.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any dependencies on removed AI model files

# Check for any remaining imports or usage of removed AI models
rg -l "abstract_ai_models|llama_ai_models|openai_ai_models" 

# Check for any references to Message class or AI model abstractions
ast-grep --pattern 'from prediction_market_agent.ai_models.$_ import $_'

# Check the build_social_media_text and build_reply_tweet implementations
rg -A 10 "def build_social_media_text|def build_reply_tweet" 

Length of output: 2474


Script:

#!/bin/bash
# Get the full implementation of build_social_media_text and build_reply_tweet
cat prediction_market_agent/agents/social_media_agent/social_agent.py

Length of output: 7189

scripts/agent_app.py (2)

82-82: LGTM! Parameter rename improves clarity.

The rename from store_prediction to store_predictions is a good change that better reflects the possibility of storing multiple predictions.


Line range hint 27-40: Verify the consistency with AI summary.

The AI summary mentions removal of AI model files, but this file still imports and uses various AI model agents. This might indicate that either:

  1. The removals mentioned in the summary haven't been fully completed
  2. These are different AI models than the ones being removed

Let's verify which AI model files were actually removed:


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.

@kongzii kongzii changed the title Bump PMAT and remove dead code Bump PMAT, prophet, and remove dead code Nov 16, 2024
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 (1)
prediction_market_agent/tools/web_scrape/markdown.py (1)

25-25: LGTM! Good optimization of the caching strategy.

The change to ignore the timeout parameter in the cache key is a good optimization. Since timeout is an operational parameter that doesn't affect the response content, different timeout values shouldn't create separate cache entries for the same URL.

This change will:

  • Reduce cache fragmentation
  • Improve cache hit rates
  • Maintain correct caching semantics since timeout doesn't influence the response content
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 66028f4 and d0b34aa.

📒 Files selected for processing (1)
  • prediction_market_agent/tools/web_scrape/markdown.py (1 hunks)

@kongzii kongzii merged commit a785d76 into main Nov 21, 2024
9 checks passed
@kongzii kongzii deleted the peter/bump-deadcode branch November 21, 2024 14:25
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