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 get jobs from PMAT #474

Merged
merged 5 commits into from
Sep 19, 2024
Merged

Use get jobs from PMAT #474

merged 5 commits into from
Sep 19, 2024

Conversation

kongzii
Copy link
Contributor

@kongzii kongzii commented Sep 18, 2024

No description provided.

Copy link
Contributor

coderabbitai bot commented Sep 18, 2024

Caution

Review failed

The pull request is closed.

Walkthrough

The changes involve a refactoring of the GetTasks class to GetJobs, reflecting a shift in functionality from tasks to jobs. The example_args method was updated to return a maximum bond value, which is now a required parameter for the __call__ method that dynamically retrieves jobs. A new file, jobs_functions.py, was introduced to manage job-related functionalities, and terminology related to tasks was updated throughout the codebase to align with the new job-centric focus.

Changes

Files Change Summary
prediction_market_agent/agents/microchain_agent/call_api.py Renamed GetTasks to GetJobs, modified example_args to return a list of integers, and updated __call__ to require max_bond.
prediction_market_agent/agents/microchain_agent/jobs_functions.py Introduced JobFunction and GetJobs classes, with GetJobs implementing job retrieval logic.
prediction_market_agent/agents/microchain_agent/microchain_agent.py Added logic to include job functions based on configuration in the build_agent_functions method.
prediction_market_agent/agents/microchain_agent/prompts.py Updated prompts and references from "task" to "job", including renaming TASK_AGENT to JOB_AGENT.

Possibly related PRs

  • Tasks PoC #360: The main PR introduces a new class GetTasks, which is related to the changes in the call_api.py file, indicating a shift from task management to job management, aligning with the renaming of GetTasks to GetJobs.
  • Do not register 'agent functions' for microchain trader agent #426: The addition of the include_agent_functions attribute in the FunctionsConfig class in this PR relates to the main PR's changes in functionality, as it modifies how agent functions are included based on system prompt choices, which is relevant to the overall restructuring of agent functionalities.
  • Use FunctionsConfig.include_agent_functions in build_agent_functions logic #452: This PR's focus on using FunctionsConfig.include_agent_functions in the build_agent_functions logic directly ties into the main PR's modifications regarding the management of functions available to the agent, ensuring that only necessary functions are included based on configuration.

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/microchain_agent/market_functions.py (2)

17-17: Provide more context on the simplification of the Kelly bet calculation.

The get_kelly_bet function is replaced with get_kelly_bet_simplified. While the name suggests a simplification or optimization, it would be helpful to understand:

  • What specific changes were made in the get_kelly_bet_simplified implementation compared to get_kelly_bet?
  • How do these changes impact the correctness and performance of the betting strategy?
  • Were there any trade-offs or assumptions made in the simplified version?

Adding comments or a docstring to explain the changes would improve the maintainability of this code.


Line range hint 423-428: Verify the usage of the hardcoded confidence value.

The get_kelly_bet_simplified function is called with a hardcoded confidence value of 0.5. Based on the comment, this seems to be a temporary placeholder until the actual confidence score is available.

Please confirm if this understanding is correct. If so, consider adding a TODO comment to revisit this once the confidence score feature is implemented. This will help track and update this part of the code in the future.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6aa5200 and 69f274c.

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/microchain_agent/call_api.py (2 hunks)
  • prediction_market_agent/agents/microchain_agent/market_functions.py (2 hunks)
  • prediction_market_agent/agents/microchain_agent/prompts.py (4 hunks)
Files skipped from review due to trivial changes (1)
  • prediction_market_agent/agents/microchain_agent/prompts.py
Additional comments not posted (4)
prediction_market_agent/agents/microchain_agent/call_api.py (4)

6-7: LGTM!

The import statements for xDai and get_jobs are correctly added.


78-83: LGTM!

The renaming of the class from GetTasks to GetJobs aligns with the updated functionality. The description is clear and concise, explaining the purpose of the class and the required input parameter.


86-88: LGTM!

The changes to the example_args method to return a list containing a single integer representing the maximum bond value are consistent with the updated __call__ method signature.


89-91: LGTM!

The changes to the __call__ method to accept a max_bond argument and retrieve jobs based on the bond value using the get_jobs function are well-implemented. Converting the retrieved jobs to a JSON format using json.dumps before returning them is a good practice for easy consumption by the clients.


def __call__(self, max_bond: xDai) -> str:
jobs = get_jobs(max_bond)
return json.dumps([j.model_dump() for j in jobs], indent=2, default=str)
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

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/agents/microchain_agent/microchain_agent.py (1)

124-125: Changes look good!

The conditional block correctly includes the job functions based on the functions_config.include_job_functions flag. The job functions are properly extended to the existing list of functions using a list comprehension, and each job function is invoked with the required parameters.

Consider adding a brief comment above the conditional block to explain its purpose, such as:

# Include job functions if configured
if functions_config.include_job_functions:
    functions.extend([f(market_type=market_type, keys=keys) for f in JOB_FUNCTIONS])
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 69f274c and 19a0263.

Files ignored due to path filters (2)
  • poetry.lock is excluded by !**/*.lock, !**/*.lock
  • pyproject.toml is excluded by !**/*.toml
Files selected for processing (4)
  • prediction_market_agent/agents/microchain_agent/call_api.py (0 hunks)
  • prediction_market_agent/agents/microchain_agent/jobs_functions.py (1 hunks)
  • prediction_market_agent/agents/microchain_agent/microchain_agent.py (2 hunks)
  • prediction_market_agent/agents/microchain_agent/prompts.py (5 hunks)
Files not reviewed due to no reviewable changes (1)
  • prediction_market_agent/agents/microchain_agent/call_api.py
Files skipped from review as they are similar to previous changes (1)
  • prediction_market_agent/agents/microchain_agent/prompts.py
Additional comments not posted (3)
prediction_market_agent/agents/microchain_agent/jobs_functions.py (2)

12-20: LGTM!

The JobFunction class is well-structured and follows object-oriented principles. The currency property provides a convenient way to access the currency associated with the market type. The implementation looks good.


23-40: LGTM!

The GetJobs class is well-structured and provides a convenient way to fetch and process jobs within the prediction market framework. The description and example_args properties provide clear documentation and usage examples. The __call__ method implements the core functionality effectively, and the use of json.dumps ensures well-formatted output. The implementation looks good.

prediction_market_agent/agents/microchain_agent/microchain_agent.py (1)

31-31: LGTM!

The import statement for JOB_FUNCTIONS is correctly added.

@kongzii kongzii merged commit 1b3afe6 into main Sep 19, 2024
8 of 9 checks passed
@kongzii kongzii deleted the peter/getjobs branch September 19, 2024 11:57
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