diff --git a/packages/packages.json b/packages/packages.json index 75b33fdc..0fc60750 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -2,10 +2,10 @@ "dev": { "connection/valory/websocket_client/0.1.0": "bafybeiflmystocxaqblhpzqlcop2vkhsknpzjx2jomohomaxamwskeokzm", "skill/valory/contract_subscription/0.1.0": "bafybeicyugrkx5glat4p4ezwf6i7oduh26eycfie6ftd4uxrknztzl3ik4", - "agent/valory/mech/0.1.0": "bafybeierifcna6tju6gblkcbudekz7qtwey5d5zklkrdrnwbgu4fha3mda", + "agent/valory/mech/0.1.0": "bafybeia5wlctflbgvtigc45gfzimftosrvsi6c6z57o2iiuij3kidpcp3e", "skill/valory/mech_abci/0.1.0": "bafybeifktlrkncnb5hjtwc7xqjag2pzmtciogp6nsm4t5umrqhmkmzyl5i", "contract/valory/agent_mech/0.1.0": "bafybeicgt3bwogpwv7t57xuxzcq7vxmoq4glcjoprabb6d4ajtgjwzsrzi", - "service/valory/mech/0.1.0": "bafybeiab5duxsqoidikglede3vdauj6zizvn5jnsro3razlhiphhnzusji", + "service/valory/mech/0.1.0": "bafybeiejotownjomk36oyj6f5kkeg4k5hrkvellaswcv7x2qhceevqinfe", "protocol/valory/acn_data_share/0.1.0": "bafybeih5ydonnvrwvy2ygfqgfabkr47s4yw3uqxztmwyfprulwfsoe7ipq", "skill/valory/task_submission_abci/0.1.0": "bafybeia6b7rzrbrhijkctxpwzeywqvsdqm2j5u5ee6fbmrp6t3x2afdase", "skill/valory/task_execution/0.1.0": "bafybeiffc4nqpk3ri7kq5tuljbgnxqmhfj3brpznr6ujxqaif24tj64kcq", diff --git a/packages/valory/agents/mech/aea-config.yaml b/packages/valory/agents/mech/aea-config.yaml index 5d1413de..2e646e15 100644 --- a/packages/valory/agents/mech/aea-config.yaml +++ b/packages/valory/agents/mech/aea-config.yaml @@ -191,7 +191,7 @@ models: args: agent_mech_contract_addresses: ${list:["0xFf82123dFB52ab75C417195c5fDB87630145ae81"]} task_deadline: ${float:240.0} - file_hash_to_tools_json: ${list:[["bafybeiemk2xmhkvvglukyxp52fh7irgoubq7bydyx4i67wfrcv3c4t47sa",["claude-prediction-offline","claude-prediction-online"]],["bafybeibi34bhbvesmvd6o24jxvuldrwen4wj62na3lhva7k4afkg2shinu",["openai-text-davinci-002","openai-text-davinci-003","openai-gpt-3.5-turbo","openai-gpt-4"]],["bafybeiafdm3jctiz6wwo3rmo3vdubk7j7l5tumoxi5n5rc3x452mtkgyua",["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"]],["bafybeidpbnqbruzqlq424qt3i5dcvyqmcimshjilftabnrroujmjhdmteu",["transfer-native"]],["bafybeiglhy5epaytvt5qqdx77ld23ekouli53qrf2hjyebd5xghlunidfi",["prediction-online","prediction-offline"]]]} + file_hash_to_tools_json: ${list:[["bafybeialjint727x536gsfs23dzsxttc3tqatfmv7gnu77jfljo5xihvq4",["claude-prediction-offline","claude-prediction-online"]],["bafybeibi34bhbvesmvd6o24jxvuldrwen4wj62na3lhva7k4afkg2shinu",["openai-text-davinci-002","openai-text-davinci-003","openai-gpt-3.5-turbo","openai-gpt-4"]],["bafybeiafdm3jctiz6wwo3rmo3vdubk7j7l5tumoxi5n5rc3x452mtkgyua",["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"]],["bafybeidpbnqbruzqlq424qt3i5dcvyqmcimshjilftabnrroujmjhdmteu",["transfer-native"]],["bafybeiglhy5epaytvt5qqdx77ld23ekouli53qrf2hjyebd5xghlunidfi",["prediction-online","prediction-offline"]]]} api_keys_json: ${list:[["openai", "dummy_api_key"],["stabilityai", "dummy_api_key"],["google_api_key", "dummy_api_key"],["google_engine_id", "dummy_api_key"]]} polling_interval: ${float:30.0} diff --git a/packages/valory/services/mech/service.yaml b/packages/valory/services/mech/service.yaml index 320617ff..7d9c3c58 100644 --- a/packages/valory/services/mech/service.yaml +++ b/packages/valory/services/mech/service.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 fingerprint: README.md: bafybeif7ia4jdlazy6745ke2k2x5yoqlwsgwr6sbztbgqtwvs3ndm2p7ba fingerprint_ignore_patterns: [] -agent: valory/mech:0.1.0:bafybeierifcna6tju6gblkcbudekz7qtwey5d5zklkrdrnwbgu4fha3mda +agent: valory/mech:0.1.0:bafybeia5wlctflbgvtigc45gfzimftosrvsi6c6z57o2iiuij3kidpcp3e number_of_agents: 4 deployment: agent: diff --git a/tools/prediction_request_claude/prediction_request_claude.py b/tools/prediction_request_claude/prediction_request_claude.py index 9ca0a631..add6909f 100644 --- a/tools/prediction_request_claude/prediction_request_claude.py +++ b/tools/prediction_request_claude/prediction_request_claude.py @@ -118,6 +118,9 @@ * This is correct: "{\n \"p_yes\": 0.2,\n \"p_no\": 0.8,\n \"confidence\": 0.7,\n \"info_utility\": 0.5\n}" """ +ASSISTANT_TEXT = "```json" +STOP_SEQUENCES = ["```"] + def search_google(query: str, api_key: str, engine: str, num: int = 3) -> List[str]: service = build("customsearch", "v1", developerKey=api_key) @@ -254,11 +257,12 @@ def run(**kwargs) -> Tuple[str, Optional[str], Optional[Dict[str, Any]]]: prediction_prompt = PREDICTION_PROMPT.format( user_prompt=prompt, additional_information=additional_information ) - prediction_prompt = f"{HUMAN_PROMPT}{prediction_prompt}{AI_PROMPT}" + prediction_prompt = f"{HUMAN_PROMPT}{prediction_prompt}{AI_PROMPT}{ASSISTANT_TEXT}" completion = anthropic.completions.create( model=engine, max_tokens_to_sample=300, prompt=prediction_prompt, + stop_sequences=STOP_SEQUENCES, ) return completion.completion, prediction_prompt, None