From d6041c4eb9e08586f4fc604a96a22d4b556d6054 Mon Sep 17 00:00:00 2001 From: Richard Blythman Date: Fri, 23 Feb 2024 23:23:02 +0000 Subject: [PATCH 1/2] fix tool errors --- .../prediction_request_sme/prediction_request_sme.py | 7 ++++++- .../prediction_request_claude.py | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/nickcom007/customs/prediction_request_sme/prediction_request_sme.py b/packages/nickcom007/customs/prediction_request_sme/prediction_request_sme.py index f57cc788..cb44b456 100644 --- a/packages/nickcom007/customs/prediction_request_sme/prediction_request_sme.py +++ b/packages/nickcom007/customs/prediction_request_sme/prediction_request_sme.py @@ -144,6 +144,7 @@ def count_tokens(text: str, model: str) -> int: the probability that the event in "USER_PROMPT" occurs. You must provide original information in each query, and they should not overlap or lead to obtain the same set of results. * Output only the JSON object. Do not include any other contents in your response. +* Never use Markdown syntax highlighting, such as ```json``` to surround the output. Only output the raw json string. * This is incorrect: "```json{{"queries": []}}```" * This is incorrect: "```json"{{"queries": []}}"```" * This is correct: "{{"queries": []}}" @@ -198,7 +199,11 @@ def search_google(query: str, api_key: str, engine: str, num: int = 3) -> List[s ) .execute() ) - return [result["link"] for result in search["items"]] + items = search.get('items') + if items is not None: + return [result["link"] for result in items] + else: + return [] def get_urls_from_queries(queries: List[str], api_key: str, engine: str) -> List[str]: diff --git a/packages/valory/customs/prediction_request_claude/prediction_request_claude.py b/packages/valory/customs/prediction_request_claude/prediction_request_claude.py index c03be420..b3a76b65 100644 --- a/packages/valory/customs/prediction_request_claude/prediction_request_claude.py +++ b/packages/valory/customs/prediction_request_claude/prediction_request_claude.py @@ -86,8 +86,10 @@ * The sum of "p_yes" and "p_no" must equal 1. * Output only the JSON object. Do not include any other contents in your response. * Never use Markdown syntax highlighting, such as ```json``` to surround the output. Only output the raw json string. +* Do not output the json string surrounded by quotation marks * 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 incorrect:"{{\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}}" """ @@ -141,7 +143,11 @@ def search_google(query: str, api_key: str, engine: str, num: int = 3) -> List[s ) .execute() ) - return [result["link"] for result in search["items"]] + items = search.get('items') + if items is not None: + return [result["link"] for result in items] + else: + return [] def get_urls_from_queries(queries: List[str], api_key: str, engine: str) -> List[str]: From 31a85283b4e78fdcd12d0c5d9f030261e5d24ade Mon Sep 17 00:00:00 2001 From: Ardian Date: Sun, 25 Feb 2024 10:12:35 +0100 Subject: [PATCH 2/2] chore: generators --- .../nickcom007/customs/prediction_request_sme/component.yaml | 2 +- packages/packages.json | 4 ++-- .../valory/customs/prediction_request_claude/component.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nickcom007/customs/prediction_request_sme/component.yaml b/packages/nickcom007/customs/prediction_request_sme/component.yaml index 13b54ffc..843ae1ca 100644 --- a/packages/nickcom007/customs/prediction_request_sme/component.yaml +++ b/packages/nickcom007/customs/prediction_request_sme/component.yaml @@ -8,7 +8,7 @@ license: Apache-2.0 aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeibbn67pnrrm4qm3n3kbelvbs3v7fjlrjniywmw2vbizarippidtvi - prediction_request_sme.py: bafybeiawjut7wk4lva2kyobjtw4sdmox2gjmvd7ye5lg7saaagyisdgaem + prediction_request_sme.py: bafybeif77pyk7hfvareijwf2dafqqta45k6fos26ixls5ec467dydflncu fingerprint_ignore_patterns: [] entry_point: prediction_request_sme.py callable: run diff --git a/packages/packages.json b/packages/packages.json index b740d96f..e88cf0a6 100644 --- a/packages/packages.json +++ b/packages/packages.json @@ -2,7 +2,7 @@ "dev": { "custom/valory/native_transfer_request/0.1.0": "bafybeihugaylajwh2fgypxatcw5qrw5qxadtrsi2h2s2246442wlvjirtm", "custom/valory/resolve_market_reasoning/0.1.0": "bafybeiesjzyamxd2g3jl2osfesxze67qhhsqxnhp5pl5bqcv3vgfddy5ae", - "custom/valory/prediction_request_claude/0.1.0": "bafybeigrgi7osdbzdii46qi6dhuwjp7zx3szofez5jm4fk2kx2f4nz5cxy", + "custom/valory/prediction_request_claude/0.1.0": "bafybeifakrqkifkozpbvar3ek34xouckj5ct3x7g64k26x6cf55j5rux3u", "custom/valory/openai_request/0.1.0": "bafybeibdcttrlgp5udygntka5fofi566pitkxhquke37ng7csvndhy4s2i", "custom/valory/prediction_request_embedding/0.1.0": "bafybeieyebiw4vedicpkyibj4zqtcnqp2i3kvk7vpn35psud4ujmrknux4", "custom/valory/resolve_market/0.1.0": "bafybeih3a4n3fnx4qmy3lpp4paat4wqvpgjyd5emot37cs4i5p6ii672bm", @@ -12,7 +12,7 @@ "custom/jhehemann/prediction_sum_url_content/0.1.0": "bafybeia2coxsrc3ruodypqvxqyweaqphneyh6o3j7n7gqg3ipe5n3ec6zu", "custom/psouranis/optimization_by_prompting/0.1.0": "bafybeibgfovquvu3gg4o7y6ud2sr536v45o2dj4shqobc7bqzzdyjbinei", "custom/nickcom007/sme_generation_request/0.1.0": "bafybeihfl4663yjkxltidavnxou7rumld5wzcr43uw23bpvb3ivefsjhv4", - "custom/nickcom007/prediction_request_sme/0.1.0": "bafybeiclabo2ywvvnky2h3iahue7s3dslalab7xpttez6p2m4x36jae6xy", + "custom/nickcom007/prediction_request_sme/0.1.0": "bafybeicswze7sobpdtpypcgt75b4wvxs3eex5sznswnopxwunyzki6ew5a", "protocol/valory/acn_data_share/0.1.0": "bafybeih5ydonnvrwvy2ygfqgfabkr47s4yw3uqxztmwyfprulwfsoe7ipq", "protocol/valory/websocket_client/0.1.0": "bafybeih43mnztdv3v2hetr2k3gezg7d3yj4ur7cxdvcyaqhg65e52s5sf4", "contract/valory/agent_mech/0.1.0": "bafybeigidwivuynzbtakkzsnnxxls54qaycw2oef4yth5lmtmwotmrf6qq", diff --git a/packages/valory/customs/prediction_request_claude/component.yaml b/packages/valory/customs/prediction_request_claude/component.yaml index 1ff9fc38..0e20ef15 100644 --- a/packages/valory/customs/prediction_request_claude/component.yaml +++ b/packages/valory/customs/prediction_request_claude/component.yaml @@ -7,7 +7,7 @@ license: Apache-2.0 aea_version: '>=1.0.0, <2.0.0' fingerprint: __init__.py: bafybeibbn67pnrrm4qm3n3kbelvbs3v7fjlrjniywmw2vbizarippidtvi - prediction_request_claude.py: bafybeifun6odgz6rn5nodds6spqb47bk4c2h2crayz4xyqbdwksuzomrzy + prediction_request_claude.py: bafybeihz3r4welypx32gg2ov6osx2bbmx34recjdj6yhqeos5bxu6gwwh4 fingerprint_ignore_patterns: [] entry_point: prediction_request_claude.py callable: run