Skip to content

Commit

Permalink
fix: claude-prediction-online prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
0xArdi committed Dec 29, 2023
1 parent 09b2d25 commit 01346ce
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "bafybeifg3hcc5inhmp7yhl7sjwdiuioemmcg2gc7id2ob3ttty3t3iaery",
"agent/valory/mech/0.1.0": "bafybeigpn5qnabtrwamfqpnerefnlgo2dumjni22kl4zcwhjzq4srrmnt4",
"skill/valory/mech_abci/0.1.0": "bafybeiej4fot4ee27d5tujxxb2u5w4rtbanpm7txwfti73rrhgmf43xmwq",
"contract/valory/agent_mech/0.1.0": "bafybeiggowhbqwg7ex2yfz57l3qzorlnu4fkipdrlzs23nrldrbbfa7dri",
"service/valory/mech/0.1.0": "bafybeiebh5mqqiist7kw3mi6lam7stlpqc3ss5vqmbids5xi5jvdb5pae4",
"service/valory/mech/0.1.0": "bafybeieany5auucyblft2i7hssabpv6hi3v7j3ulugrnkqcngawgbqqkze",
"protocol/valory/acn_data_share/0.1.0": "bafybeih5ydonnvrwvy2ygfqgfabkr47s4yw3uqxztmwyfprulwfsoe7ipq",
"skill/valory/task_submission_abci/0.1.0": "bafybeiewwpv5veykxbd7wfbq7vvnlcnfsraxhz6ymqxcaf5nfz6nz7g2pa",
"skill/valory/task_execution/0.1.0": "bafybeidmvbucjd472m5lo3ebyhlojpl2o25mndlnllqtakqe73r7vghztq",
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/agents/mech/aea-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ models:
args:
agent_mech_contract_addresses: ${list:["0xFf82123dFB52ab75C417195c5fDB87630145ae81"]}
task_deadline: ${float:240.0}
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"]]]}
file_hash_to_tools_json: ${list:[["bafybeifp6tn3ovhuz4oipy67ijfdm4y7t2o7en3xuggn6kh5wbwokxmczu",["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}
Expand Down
2 changes: 1 addition & 1 deletion packages/valory/services/mech/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ license: Apache-2.0
fingerprint:
README.md: bafybeif7ia4jdlazy6745ke2k2x5yoqlwsgwr6sbztbgqtwvs3ndm2p7ba
fingerprint_ignore_patterns: []
agent: valory/mech:0.1.0:bafybeifg3hcc5inhmp7yhl7sjwdiuioemmcg2gc7id2ob3ttty3t3iaery
agent: valory/mech:0.1.0:bafybeigpn5qnabtrwamfqpnerefnlgo2dumjni22kl4zcwhjzq4srrmnt4
number_of_agents: 4
deployment:
agent:
Expand Down
9 changes: 5 additions & 4 deletions tools/prediction_request_claude/prediction_request_claude.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@
or lead to obtain the same set of results.
* Output only the JSON object to be parsed by Python's "json.loads()". Do not include any other contents in your response.
* Never use Markdown syntax highlighting, such as ```json```. Only output the raw json string.
* This is incorrect: "```json{\n \"p_yes\": 0.2,\n \"p_no\": 0.8,\n \"confidence\": 0.7,\n \"info_utility\": 0.5\n}```"
* This is incorrect: ```json"{\n \"p_yes\": 0.2,\n \"p_no\": 0.8,\n \"confidence\": 0.7,\n \"info_utility\": 0.5\n}"```
* This is correct: "{\n \"p_yes\": 0.2,\n \"p_no\": 0.8,\n \"confidence\": 0.7,\n \"info_utility\": 0.5\n}"
* This is incorrect:"```json{{\n \"queries\": [\"term1\", \"term2\"]}}```"
* This is incorrect:```json"{{\n \"queries\": [\"term1\", \"term2\"]}}"```
* This is correct:"{{\n \"quries\": [\"term1\", \"term2\"]}}"
"""

ASSISTANT_TEXT = "```json"
Expand Down Expand Up @@ -217,11 +217,12 @@ def fetch_additional_information(
) -> str:
"""Fetch additional information."""
url_query_prompt = URL_QUERY_PROMPT.format(user_prompt=prompt)
url_query_prompt = f"{HUMAN_PROMPT}{url_query_prompt}{AI_PROMPT}"
url_query_prompt = f"{HUMAN_PROMPT}{url_query_prompt}{AI_PROMPT}{ASSISTANT_TEXT}"
completion = anthropic.completions.create(
model=engine,
max_tokens_to_sample=300,
prompt=url_query_prompt,
stop_sequences=STOP_SEQUENCES,
)
json_data = json.loads(completion.completion)
urls = get_urls_from_queries(
Expand Down

0 comments on commit 01346ce

Please sign in to comment.