diff --git a/poetry.lock b/poetry.lock index cc7fe144..fb5074a0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "aiohttp" @@ -3718,13 +3718,13 @@ poetry-core = ">=1.7.0,<2.0.0" [[package]] name = "prediction-market-agent-tooling" -version = "0.9.1" +version = "0.9.3" description = "Tools to benchmark, deploy and monitor prediction market agents." optional = false python-versions = "<3.12,>=3.10" files = [ - {file = "prediction_market_agent_tooling-0.9.1-py3-none-any.whl", hash = "sha256:3617607dd01f2ef1cdda0b264a933c6f5203ad88226c3451625db1dbc55b2b20"}, - {file = "prediction_market_agent_tooling-0.9.1.tar.gz", hash = "sha256:c8dd4ab9183d6e57dd90ecdc60939a1fe8f2a6094b1a25b6e19fc3a0f0f11565"}, + {file = "prediction_market_agent_tooling-0.9.3-py3-none-any.whl", hash = "sha256:7d2b18ef01091b05d8b43bf74093948d572f166b4c317171f18783de394dff02"}, + {file = "prediction_market_agent_tooling-0.9.3.tar.gz", hash = "sha256:31988b3a8f0b780fd92f130cffd1cf15e32e6c06dbc81d7c60522dfc10bf70f2"}, ] [package.dependencies] @@ -5350,13 +5350,13 @@ urllib3 = ">=2" [[package]] name = "typing-extensions" -version = "4.10.0" +version = "4.11.0" description = "Backported and Experimental Type Hints for Python 3.8+" optional = false python-versions = ">=3.8" files = [ - {file = "typing_extensions-4.10.0-py3-none-any.whl", hash = "sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475"}, - {file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"}, + {file = "typing_extensions-4.11.0-py3-none-any.whl", hash = "sha256:c1f94d72897edaf4ce775bb7558d5b79d8126906a14ea5ed1635921406c0387a"}, + {file = "typing_extensions-4.11.0.tar.gz", hash = "sha256:83f085bd5ca59c80295fc2a82ab5dac679cbe02b9f33f7d83af68e241bea51b0"}, ] [[package]] @@ -5883,4 +5883,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "~3.10.0" -content-hash = "2c7297123c99f345ce9315b102e123effec13043076f3271d45dc3e1ba6518ee" +content-hash = "19fce4c337b4407be6353efd8af7e4eb296fd4575b3ea1967aeda289c58c8939" diff --git a/prediction_market_agent/agents/known_outcome_agent/deploy.py b/prediction_market_agent/agents/known_outcome_agent/deploy.py index 63b071bc..ed85667f 100644 --- a/prediction_market_agent/agents/known_outcome_agent/deploy.py +++ b/prediction_market_agent/agents/known_outcome_agent/deploy.py @@ -7,14 +7,13 @@ from prediction_market_agent_tooling.deploy.constants import OWNER_KEY from prediction_market_agent_tooling.gtypes import SecretStr, private_key_type from prediction_market_agent_tooling.markets.agent_market import AgentMarket -from prediction_market_agent_tooling.markets.data_models import BetAmount, Currency +from prediction_market_agent_tooling.markets.data_models import BetAmount from prediction_market_agent_tooling.markets.markets import MarketType from prediction_market_agent_tooling.markets.omen.omen import OmenAgentMarket from prediction_market_agent_tooling.tools.utils import ( check_not_none, get_current_git_commit_sha, get_current_git_url, - should_not_happen, ) from prediction_market_agent.agents.known_outcome_agent.known_outcome_agent import ( @@ -28,7 +27,7 @@ def market_is_saturated(market: AgentMarket) -> bool: class DeployableKnownOutcomeAgent(DeployableAgent): - model = "gpt-4-1106-preview" + model = "gpt-4-turbo-preview" def load(self) -> None: self.markets_with_known_outcomes: dict[str, Result] = {} @@ -36,6 +35,11 @@ def load(self) -> None: def pick_markets(self, markets: list[AgentMarket]) -> list[AgentMarket]: picked_markets: list[AgentMarket] = [] for market in markets: + if not isinstance(market, OmenAgentMarket): + raise NotImplementedError( + "This agent only supports predictions on Omen markets" + ) + print(f"Looking at market {market.id=} {market.question=}") # Assume very high probability markets are already known, and have @@ -45,6 +49,10 @@ def pick_markets(self, markets: list[AgentMarket]) -> list[AgentMarket]: print( f"Skipping market {market.id=} {market.question=}, because it is already saturated." ) + elif market.get_liquidity_in_xdai() < 5: + print( + f"Skipping market {market.id=} {market.question=}, because it has insufficient liquidity." + ) else: picked_markets.append(market) @@ -83,17 +91,7 @@ def answer_binary_market(self, market: AgentMarket) -> bool | None: def calculate_bet_amount(self, answer: bool, market: AgentMarket) -> BetAmount: if isinstance(market, OmenAgentMarket): - if market.currency != Currency.xDai: - should_not_happen() - return BetAmount( - # On markets without liquidity, bet just a small amount for benchmarking. - amount=( - Decimal(1.0) - if market.get_liquidity_in_xdai() > 5 - else market.get_tiny_bet_amount().amount - ), - currency=Currency.xDai, - ) + return BetAmount(amount=(Decimal(1.0)), currency=market.currency) else: raise NotImplementedError("This agent only supports xDai markets") diff --git a/prediction_market_agent/agents/known_outcome_agent/known_outcome_agent.py b/prediction_market_agent/agents/known_outcome_agent/known_outcome_agent.py index 6833cbc9..8389abaf 100644 --- a/prediction_market_agent/agents/known_outcome_agent/known_outcome_agent.py +++ b/prediction_market_agent/agents/known_outcome_agent/known_outcome_agent.py @@ -216,7 +216,7 @@ def get_known_outcome(model: str, question: str, max_tries: int) -> Answer: ).format_messages(date_str=date_str, question=question) print(f"Invoking LLM for {search_prompt=}") search_query = str(llm.invoke(search_prompt).content).strip('"') - print(f"Searchig for {search_query=}") + print(f"Searching for {search_query=}") search_results = web_search(query=search_query, max_results=5) if not search_results: raise ValueError("No search results found.") diff --git a/pyproject.toml b/pyproject.toml index c49e39a4..a8ca72e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ poetry = "^1.7.1" poetry-plugin-export = "^1.6.0" functions-framework = "^3.5.0" cron-validator = "^1.0.8" -prediction-market-agent-tooling = "^0.9.1" +prediction-market-agent-tooling = "^0.9.3" pydantic-settings = "^2.1.0" autoflake = "^2.2.1" isort = "^5.13.2"