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

Use PMAT from Pypi #30

Merged
merged 2 commits into from
Feb 22, 2024
Merged

Use PMAT from Pypi #30

merged 2 commits into from
Feb 22, 2024

Conversation

kongzii
Copy link
Contributor

@kongzii kongzii commented Feb 22, 2024

Summary by CodeRabbit

  • New Features
    • Enhanced the bet placement functionality to align with the market's currency and improved user prompts for a more intuitive betting experience.
  • Refactor
    • Updated import statements across multiple agent files to reflect the reorganization of the module structure, ensuring a more streamlined codebase.
  • Bug Fixes
    • Adjusted the currency display in betting strategies and fixed inconsistencies in API key parameter usage for improved reliability.
  • Tests
    • Updated test cases to align with the latest code changes, ensuring the robustness of betting strategies.

Copy link
Contributor

coderabbitai bot commented Feb 22, 2024

Walkthrough

The updates across various files primarily focus on reorganizing import statements due to module restructuring, specifically moving from data_models to agent_market in the prediction_market_agent_tooling.markets package. Additionally, there are enhancements in handling currency displays and API key parameters to improve consistency and clarity in user prompts and function calls. These changes collectively aim to streamline the codebase and adapt to the evolving structure of the prediction market agent tooling.

Changes

File(s) Summary
main.py Modified main function to use market object for placing bets and updated currency display in bet amount prompt.
prediction_market_agent/agents/abstract.py, .../agents/always_yes.py, .../agents/autogen_agent.py, .../agents/crewai_agent.py, .../agents/custom_agent.py, .../agents/langchain_agent.py, .../agents/llamaindex_agent.py, .../agents/metagpt_agent.py Updated import statements from ...markets.data_models to ...markets.agent_market. In custom_agent.py, also adjusted function call to specify tool parameters.
prediction_market_agent/tools/betting_strategies.py Updated to import OmenAgentMarket from a new location and use it in various functions, passing market object as market_agent and modifying currency display.
prediction_market_agent/tools/google_search.py Modified to use serp_api_key instead of serp for the API key parameter.
prediction_market_agent/utils.py Removed type ignore comments and adjusted formatting in properties and functions related to API keys and result parsing.
tests/tools/test_betting_strategies.py Updated import statement for omen and modified TEST_OMEN_MARKET.get_outcome_index to TEST_OMEN_MARKET.outcomes.index for consistency.

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 49d9b28 and aa148d1.
Files ignored due to path filters (2)
  • poetry.lock is excluded by: !**/*.lock
  • pyproject.toml is excluded by: !**/*.toml
Files selected for processing (13)
  • main.py (3 hunks)
  • prediction_market_agent/agents/abstract.py (1 hunks)
  • prediction_market_agent/agents/always_yes.py (1 hunks)
  • prediction_market_agent/agents/autogen_agent.py (1 hunks)
  • prediction_market_agent/agents/crewai_agent.py (1 hunks)
  • prediction_market_agent/agents/custom_agent.py (2 hunks)
  • prediction_market_agent/agents/langchain_agent.py (2 hunks)
  • prediction_market_agent/agents/llamaindex_agent.py (1 hunks)
  • prediction_market_agent/agents/metagpt_agent.py (1 hunks)
  • prediction_market_agent/tools/betting_strategies.py (4 hunks)
  • prediction_market_agent/tools/google_search.py (1 hunks)
  • prediction_market_agent/utils.py (2 hunks)
  • tests/tools/test_betting_strategies.py (3 hunks)
Additional comments: 12
prediction_market_agent/agents/always_yes.py (1)
  • 1-1: The update to the import statement correctly reflects the new location of AgentMarket, ensuring the AlwaysYesAgent class can utilize it as intended.
prediction_market_agent/agents/abstract.py (1)
  • 1-1: The update to the import statement in abstract.py is correctly implemented, ensuring that subclasses of AbstractAgent can utilize AgentMarket as intended.
prediction_market_agent/tools/google_search.py (1)
  • 7-7: The update to use serp_api_key for the API key parameter in the google_search function enhances clarity and consistency with the utils.APIKeys class.
prediction_market_agent/agents/langchain_agent.py (2)
  • 3-3: The update to the import statement in langchain_agent.py correctly reflects the new location of AgentMarket.
  • 16-18: The modification in the load_tools function call to use serpapi_api_key aligns with the updated naming convention in the utils.APIKeys class, enhancing clarity and consistency.
prediction_market_agent/utils.py (3)
  • 16-16: The removal of type ignore comments and formatting adjustments in the serp_api_key property improve code readability and maintainability.
  • 22-22: The removal of type ignore comments and formatting adjustments in the openai_api_key property enhance code readability and maintainability.
  • 37-37: The logic in the parse_result_to_boolean function is correctly implemented, providing a clear and concise way to convert a string result into a boolean value.
prediction_market_agent/tools/betting_strategies.py (4)
  • 9-11: The import statements have been updated to reflect the new location of OmenAgentMarket and the function omen_calculate_buy_amount. This change aligns with the PR objectives to update import paths following the reorganization within the PMAT package. Ensure that all references to these entities throughout the codebase have been updated accordingly.
  • 61-61: The replacement of OmenMarket with OmenAgentMarket via OmenAgentMarket.from_data_model(market) is a significant change. This adjustment is presumably made to align with the updated structure of the PMAT package. It's crucial to verify that OmenAgentMarket.from_data_model correctly transforms an OmenMarket instance into an OmenAgentMarket instance, preserving all necessary data and properties for subsequent operations.
  • 103-103: The change in how the market object is passed to omen_calculate_buy_amount as market_agent is noted. This modification likely reflects the updated usage and expectations within the PMAT package. It's important to ensure that omen_calculate_buy_amount is fully compatible with receiving an OmenAgentMarket instance and that this change does not affect the function's behavior or expected outcomes.
Verification successful

The findings confirm that omen_calculate_buy_amount is called with a market parameter, which is consistent with the change noted in the review comment. This suggests that the function is expected to handle an instance of OmenAgentMarket, aligning with the updated usage within the package. However, without direct access to the function's definition and documentation, a full assessment of compatibility based solely on parameter naming is not definitive. The evidence supports the notion that the change is likely appropriate and aligns with expected usage patterns.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Verify the compatibility of omen_calculate_buy_amount with OmenAgentMarket instances.
ast-grep --lang python --pattern $'omen_calculate_buy_amount($_, market_agent=$_, $_, $_)'

Length of output: 91



Script:

#!/bin/bash
# Search for any usage of omen_calculate_buy_amount to understand its context and parameters.
ast-grep --lang python --pattern $'omen_calculate_buy_amount($$$)'

Length of output: 689

* 119-119: The modification in currency display within the print statement to use `market_agent.currency` is a minor but important change for consistency and clarity in user-facing messages. This adjustment ensures that the currency displayed matches the market's currency, enhancing the user experience. It's a good practice to ensure that all user-facing messages are consistent and clear regarding currency and other financial information.

@kongzii kongzii merged commit 79e4887 into main Feb 22, 2024
6 checks passed
@kongzii kongzii deleted the peter/use-pmat-package-from-pypi branch February 22, 2024 13:34
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