Skip to content

Commit

Permalink
Merge pull request #179 from valory-xyz/chore/fix-tool-errors
Browse files Browse the repository at this point in the history
fix tool errors
  • Loading branch information
0xArdi authored Feb 26, 2024
2 parents 71e278e + 31a8528 commit f795135
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": []}}"
Expand Down Expand Up @@ -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]:
Expand Down
4 changes: 2 additions & 2 deletions packages/packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
"""

Expand Down Expand Up @@ -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]:
Expand Down

0 comments on commit f795135

Please sign in to comment.