-
Notifications
You must be signed in to change notification settings - Fork 2
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
469 missing information in ipfsagentresult #521
base: main
Are you sure you want to change the base?
Changes from 4 commits
10af4a8
1ed4389
dda8993
bcd2682
f353ff3
75228f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,7 @@ | |
MarketType, | ||
have_bet_on_market_since, | ||
) | ||
from prediction_market_agent_tooling.markets.omen.data_models import IPFSAgentResult | ||
from prediction_market_agent_tooling.markets.omen.omen import ( | ||
withdraw_wxdai_to_xdai_to_keep_balance, | ||
) | ||
|
@@ -334,6 +335,10 @@ def update_langfuse_trace_by_processed_market( | |
] | ||
) | ||
|
||
@property | ||
def agent_name(self) -> str: | ||
return self.__class__.__name__ | ||
|
||
def check_min_required_balance_to_operate(self, market_type: MarketType) -> None: | ||
api_keys = APIKeys() | ||
|
||
|
@@ -492,7 +497,15 @@ def after_process_market( | |
processed_market: ProcessedMarket, | ||
) -> None: | ||
keys = APIKeys() | ||
market.store_prediction(processed_market=processed_market, keys=keys) | ||
reasoning = ( | ||
processed_market.answer.reasoning | ||
if processed_market.answer.reasoning | ||
else "" | ||
) | ||
agent_result = IPFSAgentResult(reasoning=reasoning, agent_name=self.agent_name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved this logic from OmenAgentMarket -> DeployableTraderAgent because the property There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That refactoring was made based on Evan's comment because there were a lot of Omen-uniquess in the DeployableTraderAgent. Maybe it could be named Wdyt just passing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No strong preference here - passing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I would prefer to keep it as |
||
market.store_prediction( | ||
processed_market=processed_market, keys=keys, agent_result=agent_result | ||
) | ||
|
||
def before_process_markets(self, market_type: MarketType) -> None: | ||
""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
TokenAmount, | ||
) | ||
from prediction_market_agent_tooling.markets.market_fees import MarketFees | ||
from prediction_market_agent_tooling.markets.omen.data_models import IPFSAgentResult | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Missing IPFSAgentResult Parameter in Subclasses and Method Call Several areas in the codebase have not been updated to include the
Please update the 🔗 Analysis chainVerify implementation in subclasses and related components. The changes to the
Please run the following script to identify potential areas that need updates: Ensure that all identified areas are updated to accommodate the new Also applies to: 232-235 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Identify classes that inherit from AgentMarket and places where store_prediction is called.
# Find subclasses of AgentMarket
echo "Subclasses of AgentMarket:"
rg "class \w+\(.*AgentMarket.*\):" -g '*.py'
# Find calls to store_prediction
echo "\nCalls to store_prediction:"
rg "\.store_prediction\(" -g '*.py'
Length of output: 902 Script: #!/bin/bash
# Description: Verify that each subclass of AgentMarket has an updated store_prediction method with the IPFSAgentResult parameter.
# List of subclass files
subclasses=(
"prediction_market_agent_tooling/markets/polymarket/polymarket.py"
"prediction_market_agent_tooling/markets/omen/omen.py"
"prediction_market_agent_tooling/markets/metaculus/metaculus.py"
"prediction_market_agent_tooling/jobs/jobs_models.py"
"prediction_market_agent_tooling/jobs/omen/omen_jobs.py"
"prediction_market_agent_tooling/markets/manifold/manifold.py"
)
for file in "${subclasses[@]}"; do
echo "Checking store_prediction method in $file:"
rg "def store_prediction\s*\(" "$file" | while read -r line; do
# Check if the method includes 'IPFSAgentResult' as a parameter
if [[ "$line" =~ store_prediction\([^\)]*IPFSAgentResult[^\)]*\) ]]; then
echo " ✅ Updated store_prediction method found."
else
echo " ❌ store_prediction method missing IPFSAgentResult parameter."
fi
done
done
# Check the call in deploy/agent.py
echo -e "\nChecking store_prediction call in deploy/agent.py:"
rg "\.store_prediction\s*\(" prediction_market_agent_tooling/deploy/agent.py | while read -r line; do
# Check if the call includes 'IPFSAgentResult' argument
if [[ "$line" =~ store_prediction\([^\)]*IPFSAgentResult[^\)]*\) ]]; then
echo " ✅ store_prediction call includes IPFSAgentResult argument."
else
echo " ❌ store_prediction call is missing IPFSAgentResult argument."
fi
done
Length of output: 3078 |
||
from prediction_market_agent_tooling.tools.utils import ( | ||
DatetimeUTC, | ||
check_not_none, | ||
|
@@ -228,7 +229,10 @@ def verify_operational_balance(api_keys: APIKeys) -> bool: | |
raise NotImplementedError("Subclasses must implement this method") | ||
|
||
def store_prediction( | ||
self, processed_market: ProcessedMarket, keys: APIKeys | ||
self, | ||
processed_market: ProcessedMarket, | ||
keys: APIKeys, | ||
agent_result: IPFSAgentResult, | ||
) -> None: | ||
""" | ||
If market allows to upload predictions somewhere, implement it in this method. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid importing Omen-specific classes in a generic agent module
Importing
IPFSAgentResult
frommarkets.omen.data_models
introduces Omen-specific dependencies into the genericDeployableAgent
class hierarchy. This reduces modularity and reusability, potentially causing issues for other markets like Metaculus that do not require IPFS uploads.Consider abstracting the result handling to be market-agnostic. You could define a generic interface or base class for agent results and let market-specific implementations extend it. This way,
DeployableTraderAgent
remains decoupled from any specific market logic.