Skip to content

Commit

Permalink
Merge pull request #93 from valory-xyz/feat/configs
Browse files Browse the repository at this point in the history
Feat/configs
  • Loading branch information
Adamantios authored Sep 20, 2023
2 parents 86969cf + 89d0594 commit e8bf5b1
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 17 deletions.
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ export ALL_PARTICIPANTS='["YOUR_AGENT_ADDRESS"]'
export SAFE_CONTRACT_ADDRESS="YOUR_SAFE_ADDRESS"
export OMEN_CREATORS='["0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec"]'

export MECH_TOOL="prediction-online"

export BET_AMOUNT_PER_THRESHOLD_000=0
export BET_AMOUNT_PER_THRESHOLD_010=0
export BET_AMOUNT_PER_THRESHOLD_020=0
Expand All @@ -117,12 +115,6 @@ These are the description of the variables used by the Trader service:
- `SAFE_CONTRACT_ADDRESS`: address of the agents multisig wallet created [in the previous section](#prepare-the-keys-and-the-safe).
- `OMEN_CREATORS`: addresses of the market creator(s) that the service will track
for placing bets on Omen. The address `0x89c5cc945dd550BcFfb72Fe42BfF002429F46Fec` corresponds to the Market creator agent for the Hackathon.
- `MECH_TOOL`: the tool that the service will use to get the prediction when performing requests to the AI Mech.
You may find all the available Mech scripts [here](https://github.com/valory-xyz/mech/tree/v0.5.0/tools)
for Mech's version `v0.5.0`.
Each script contains one or more tools.
For example, you may find all the `prediction_request` tools
[here](https://github.com/valory-xyz/mech/blob/v0.5.0/tools/prediction_request.py#L37-L40).
- `BET_AMOUNT_PER_THRESHOLD_X`: amount (wei) to bet when the prediction returned by the AI Mech surpasses a threshold of `X`% confidence for a given prediction market. In the values provided above the amounts vary between 0.03 xDAI (60% confidence) and 0.1 xDAI (100% confidence).
- `BET_THRESHOLD`: threshold (wei) for placing a bet. A bet will only be placed if `potential_net_profit - BET_THRESHOLD >= 0`. [See below](#some-notes-on-the-service).
- `PROMPT_TEMPLATE`: prompt to be used with the prediction AI Mech. Please keep it as a single line including the placeholders `@{question}`, `@{yes}` and `@{no}`.
Expand Down
6 changes: 5 additions & 1 deletion packages/valory/agents/trader/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ models:
multisend_address: ${str:0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761}
drand_public_key: ${str:868f005eb8e6e4ca0a47c8a77ceaa5309a47978a7c71bc5cce96366b5d7a569937c529eeda66c7293784a9402801af31}
service_registry_address: ${str:null}
agent_registry_address: ${str:null}
share_tm_config_on_startup: ${bool:false}
sleep_time: ${int:10}
tendermint_p2p_url: ${str:localhost:26656}
Expand All @@ -161,7 +162,6 @@ models:
average_block_time: ${int:5}
abt_error_mult: ${int:5}
mech_agent_address: ${str:0xff82123dfb52ab75c417195c5fdb87630145ae81}
mech_tool: ${str:prediction-online}
bet_amount_per_threshold:
0.0: ${int:0}
0.1: ${int:0}
Expand All @@ -187,6 +187,10 @@ models:
redeeming_batch_size: ${int:5}
slippage: ${float:0.01}
redeem_margin_days: ${int:15}
epsilon: ${float:0.1}
irrelevant_tools: ${set:{"openai-text-davinci-002", "openai-text-davinci-003", "openai-gpt-3.5-turbo",
"openai-gpt-4", "stabilityai-stable-diffusion-v1-5", "stabilityai-stable-diffusion-xl-beta-v2-2-2",
"stabilityai-stable-diffusion-512-v2-1", "stabilityai-stable-diffusion-768-v2-1"}}
---
public_id: valory/p2p_libp2p_client:0.1.0
type: connection
Expand Down
28 changes: 24 additions & 4 deletions packages/valory/services/trader/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type: skill
round_timeout_seconds: ${ROUND_TIMEOUT:float:350.0}
service_id: ${SERVICE_ID:str:trader}
service_registry_address: ${SERVICE_REGISTRY_ADDRESS:str:0x9338b5153AE39BB89f50468E608eD9d764B755fD}
agent_registry_address: ${AGENT_REGISTRY_ADDRESS:str:0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA}
share_tm_config_on_startup: ${USE_ACN:bool:false}
sleep_time: ${SLEEP_TIME:int:1}
tendermint_check_sleep_delay: ${TM_CHECK_SLEEP_DELAY:int:3}
Expand All @@ -77,7 +78,6 @@ type: skill
average_block_time: ${ABT:int:5}
abt_error_mult: ${ABT_ERROR_MULT:int:5}
mech_agent_address: ${MECH_AGENT_ADDRESS:str:0xff82123dfb52ab75c417195c5fdb87630145ae81}
mech_tool: ${MECH_TOOL:str:prediction-online}
bet_amount_per_threshold: &id004
0.0: ${BET_AMOUNT_PER_THRESHOLD_000:int:0}
0.1: ${BET_AMOUNT_PER_THRESHOLD_010:int:0}
Expand All @@ -104,6 +104,11 @@ type: skill
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15}
epsilon: ${EPSILON:float:0.1}
irrelevant_tools: ${IRRELEVANT_TOOLS:set:{"openai-text-davinci-002", "openai-text-davinci-003",
"openai-gpt-3.5-turbo", "openai-gpt-4", "stabilityai-stable-diffusion-v1-5",
"stabilityai-stable-diffusion-xl-beta-v2-2-2", "stabilityai-stable-diffusion-512-v2-1",
"stabilityai-stable-diffusion-768-v2-1"}}
benchmark_tool: &id005
args:
log_dir: ${LOG_DIR:str:/benchmarks}
Expand Down Expand Up @@ -133,6 +138,7 @@ type: skill
round_timeout_seconds: ${ROUND_TIMEOUT:float:350.0}
service_id: ${SERVICE_ID:str:trader}
service_registry_address: ${SERVICE_REGISTRY_ADDRESS:str:0x9338b5153AE39BB89f50468E608eD9d764B755fD}
agent_registry_address: ${AGENT_REGISTRY_ADDRESS:str:0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA}
share_tm_config_on_startup: ${USE_ACN:bool:false}
sleep_time: ${SLEEP_TIME:int:1}
tendermint_check_sleep_delay: ${TM_CHECK_SLEEP_DELAY:int:3}
Expand All @@ -152,7 +158,6 @@ type: skill
average_block_time: ${ABT:int:5}
abt_error_mult: ${ABT_ERROR_MULT:int:5}
mech_agent_address: ${MECH_AGENT_ADDRESS:str:0xff82123dfb52ab75c417195c5fdb87630145ae81}
mech_tool: ${MECH_TOOL:str:prediction-online}
bet_amount_per_threshold: *id004
bet_threshold: ${BET_THRESHOLD:int:100000000000000000}
blacklisting_duration: ${BLACKLISTING_DURATION:int:3600}
Expand All @@ -168,6 +173,11 @@ type: skill
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15}
epsilon: ${EPSILON:float:0.1}
irrelevant_tools: ${IRRELEVANT_TOOLS:set:{"openai-text-davinci-002", "openai-text-davinci-003",
"openai-gpt-3.5-turbo", "openai-gpt-4", "stabilityai-stable-diffusion-v1-5",
"stabilityai-stable-diffusion-xl-beta-v2-2-2", "stabilityai-stable-diffusion-512-v2-1",
"stabilityai-stable-diffusion-768-v2-1"}}
benchmark_tool: *id005
2:
models:
Expand Down Expand Up @@ -195,6 +205,7 @@ type: skill
round_timeout_seconds: ${ROUND_TIMEOUT:float:350.0}
service_id: ${SERVICE_ID:str:trader}
service_registry_address: ${SERVICE_REGISTRY_ADDRESS:str:0x9338b5153AE39BB89f50468E608eD9d764B755fD}
agent_registry_address: ${AGENT_REGISTRY_ADDRESS:str:0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA}
share_tm_config_on_startup: ${USE_ACN:bool:false}
sleep_time: ${SLEEP_TIME:int:1}
tendermint_check_sleep_delay: ${TM_CHECK_SLEEP_DELAY:int:3}
Expand All @@ -214,7 +225,6 @@ type: skill
average_block_time: ${ABT:int:5}
abt_error_mult: ${ABT_ERROR_MULT:int:5}
mech_agent_address: ${MECH_AGENT_ADDRESS:str:0xff82123dfb52ab75c417195c5fdb87630145ae81}
mech_tool: ${MECH_TOOL:str:prediction-online}
bet_amount_per_threshold: *id004
bet_threshold: ${BET_THRESHOLD:int:100000000000000000}
blacklisting_duration: ${BLACKLISTING_DURATION:int:3600}
Expand All @@ -230,6 +240,11 @@ type: skill
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15}
epsilon: ${EPSILON:float:0.1}
irrelevant_tools: ${IRRELEVANT_TOOLS:set:{"openai-text-davinci-002", "openai-text-davinci-003",
"openai-gpt-3.5-turbo", "openai-gpt-4", "stabilityai-stable-diffusion-v1-5",
"stabilityai-stable-diffusion-xl-beta-v2-2-2", "stabilityai-stable-diffusion-512-v2-1",
"stabilityai-stable-diffusion-768-v2-1"}}
benchmark_tool: *id005
3:
models:
Expand Down Expand Up @@ -257,6 +272,7 @@ type: skill
round_timeout_seconds: ${ROUND_TIMEOUT:float:350.0}
service_id: ${SERVICE_ID:str:trader}
service_registry_address: ${SERVICE_REGISTRY_ADDRESS:str:0x9338b5153AE39BB89f50468E608eD9d764B755fD}
agent_registry_address: ${AGENT_REGISTRY_ADDRESS:str:0xE49CB081e8d96920C38aA7AB90cb0294ab4Bc8EA}
share_tm_config_on_startup: ${USE_ACN:bool:false}
sleep_time: ${SLEEP_TIME:int:1}
tendermint_check_sleep_delay: ${TM_CHECK_SLEEP_DELAY:int:3}
Expand All @@ -276,7 +292,6 @@ type: skill
average_block_time: ${ABT:int:5}
abt_error_mult: ${ABT_ERROR_MULT:int:5}
mech_agent_address: ${MECH_AGENT_ADDRESS:str:0xff82123dfb52ab75c417195c5fdb87630145ae81}
mech_tool: ${MECH_TOOL:str:prediction-online}
bet_amount_per_threshold: *id004
bet_threshold: ${BET_THRESHOLD:int:100000000000000000}
blacklisting_duration: ${BLACKLISTING_DURATION:int:3600}
Expand All @@ -292,6 +307,11 @@ type: skill
redeeming_batch_size: ${REDEEMING_BATCH_SIZE:int:1}
slippage: ${SLIPPAGE:float:0.01}
redeem_margin_days: ${REDEEM_MARGIN_DAYS:int:15}
epsilon: ${EPSILON:float:0.1}
irrelevant_tools: ${IRRELEVANT_TOOLS:set:{"openai-text-davinci-002", "openai-text-davinci-003",
"openai-gpt-3.5-turbo", "openai-gpt-4", "stabilityai-stable-diffusion-v1-5",
"stabilityai-stable-diffusion-xl-beta-v2-2-2", "stabilityai-stable-diffusion-512-v2-1",
"stabilityai-stable-diffusion-768-v2-1"}}
benchmark_tool: *id005
---
public_id: valory/ledger:0.19.0
Expand Down
12 changes: 10 additions & 2 deletions packages/valory/skills/decision_maker_abci/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ class DecisionMakerParams(MarketManagerParams):
def __init__(self, *args: Any, **kwargs: Any) -> None:
"""Initialize the parameters' object."""
self.mech_agent_address: str = self._ensure("mech_agent_address", kwargs, str)
self.mech_tool: str = self._ensure("mech_tool", kwargs, str)
# this is a mapping from the confidence of a bet's choice to the amount we are willing to bet
self.bet_amount_per_threshold: Dict[float, int] = self._ensure(
"bet_amount_per_threshold", kwargs, Dict[float, int]
Expand Down Expand Up @@ -122,7 +121,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
self.redeeming_batch_size = self._ensure("redeeming_batch_size", kwargs, int)
# a slippage in the range of [0, 1] to apply to the `minOutcomeTokensToBuy` when buying shares on a fpmm
self._slippage = 0.0
self.slippage = self._ensure("slippage", kwargs, float)
self.slippage: float = self._ensure("slippage", kwargs, float)
self.epsilon: float = self._ensure("epsilon", kwargs, float)
self.agent_registry_address: str = self._ensure(
"agent_registry_address", kwargs, str
)
self.irrelevant_tools: set = self._ensure("irrelevant_tools", kwargs, set)
super().__init__(*args, **kwargs)

@property
Expand Down Expand Up @@ -161,6 +165,10 @@ class MechResponseSpecs(ApiSpecs):
"""A model that wraps ApiSpecs for the Mech's response specifications."""


class AgentToolsSpecs(ApiSpecs):
"""A model that wraps ApiSpecs for the Mech agent's tools specifications."""


@dataclass
class MultisendBatch:
"""A structure representing a single transaction of a multisend."""
Expand Down
24 changes: 23 additions & 1 deletion packages/valory/skills/decision_maker_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ models:
round_timeout_seconds: 350.0
service_id: decision_maker
service_registry_address: null
agent_registry_address: null
setup:
all_participants:
- '0x0000000000000000000000000000000000000000'
Expand All @@ -156,7 +157,6 @@ models:
tx_timeout: 10.0
use_termination: false
mech_agent_address: '0xff82123dfb52ab75c417195c5fdb87630145ae81'
mech_tool: prediction-online
bet_amount_per_threshold:
0.0: 0
0.1: 0
Expand All @@ -181,6 +181,16 @@ models:
realitio_address: '0x79e32aE03fb27B07C89c0c568F80287C01ca2E57'
redeeming_batch_size: 5
slippage: 0.01
epsilon: 0.1
irrelevant_tools:
? openai-text-davinci-002
? openai-text-davinci-003
? openai-gpt-3.5-turbo
? openai-gpt-4
? stabilityai-stable-diffusion-v1-5
? stabilityai-stable-diffusion-xl-beta-v2-2-2
? stabilityai-stable-diffusion-512-v2-1
? stabilityai-stable-diffusion-768-v2-1
class_name: DecisionMakerParams
mech_response:
args:
Expand All @@ -194,6 +204,18 @@ models:
retries: 5
url: ''
class_name: MechResponseSpecs
agent_tools:
args:
api_id: agent_tools
headers:
Content-Type: application/json
method: GET
parameters: { }
response_key: tools
response_type: list
retries: 5
url: ''
class_name: AgentToolsSpecs
requests:
args: {}
class_name: Requests
Expand Down
4 changes: 4 additions & 0 deletions packages/valory/skills/trader_abci/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
from packages.valory.skills.decision_maker_abci.models import (
MechResponseSpecs as DecisionMakerMechResponseSpecs,
)
from packages.valory.skills.decision_maker_abci.models import (
AgentToolsSpecs as DecisionMakerAgentToolsSpecs,
)
from packages.valory.skills.decision_maker_abci.rounds import (
Event as DecisionMakerEvent,
)
Expand Down Expand Up @@ -68,6 +71,7 @@
OmenSubgraph = MarketManagerOmenSubgraph
NetworkSubgraph = MarketManagerNetworkSubgraph
MechResponseSpecs = DecisionMakerMechResponseSpecs
AgentToolsSpecs = DecisionMakerAgentToolsSpecs

MARGIN = 5

Expand Down
24 changes: 23 additions & 1 deletion packages/valory/skills/trader_abci/skill.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ models:
round_timeout_seconds: 350.0
service_id: trader
service_registry_address: null
agent_registry_address: null
setup:
all_participants:
- '0x0000000000000000000000000000000000000000'
Expand All @@ -143,7 +144,6 @@ models:
average_block_time: 5
abt_error_mult: 5
mech_agent_address: '0xff82123dfb52ab75c417195c5fdb87630145ae81'
mech_tool: prediction-online
bet_amount_per_threshold:
0.0: 0
0.1: 0
Expand All @@ -169,6 +169,16 @@ models:
redeeming_batch_size: 5
slippage: 0.01
redeem_margin_days: 15
epsilon: 0.1
irrelevant_tools:
? openai-text-davinci-002
? openai-text-davinci-003
? openai-gpt-3.5-turbo
? openai-gpt-4
? stabilityai-stable-diffusion-v1-5
? stabilityai-stable-diffusion-xl-beta-v2-2-2
? stabilityai-stable-diffusion-512-v2-1
? stabilityai-stable-diffusion-768-v2-1
class_name: TraderParams
network_subgraph:
args:
Expand Down Expand Up @@ -218,6 +228,18 @@ models:
retries: 5
url: ''
class_name: MechResponseSpecs
agent_tools:
args:
api_id: agent_tools
headers:
Content-Type: application/json
method: GET
parameters: { }
response_key: tools
response_type: list
retries: 5
url: ''
class_name: AgentToolsSpecs
requests:
args: {}
class_name: Requests
Expand Down

0 comments on commit e8bf5b1

Please sign in to comment.