Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OFV market resolver #225

Merged
merged 111 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
4791548
feat: add keychain
0xArdi Apr 24, 2024
0cf7a8a
Make tomte a dev dependency
evangriffiths Apr 29, 2024
2cff00a
Add OFV market resolver
kongzii May 7, 2024
d6e8353
fix run() interface
richardblythman May 8, 2024
0b4694f
chore: remove redundant package
angrybayblade May 10, 2024
a3b87ab
gemini request tool
victorpolisetty May 12, 2024
9011c96
cleaned up testing prompts
victorpolisetty May 12, 2024
36f2386
Fix for `run` signature changes
kongzii May 13, 2024
3237dcf
fix types
kongzii May 13, 2024
4789d18
fix return value
kongzii May 13, 2024
f7d6255
fix wrong version of secretstr
kongzii May 13, 2024
5d01be1
another fixes
kongzii May 13, 2024
5db1b4d
eval each question 3x
kongzii May 15, 2024
3473cb2
remove old comment
kongzii May 15, 2024
81e8e57
ipfs updates
victorpolisetty May 15, 2024
010f2e9
add kwargs
kongzii May 16, 2024
d1a3d59
update error handling for response.text
victorpolisetty May 17, 2024
bc15607
Merge branch 'refs/heads/main' into feat/keychain
0xArdi May 21, 2024
eecbf34
feat: update tools to use KeyChain
0xArdi May 21, 2024
3a08009
feat: add max retries
0xArdi May 21, 2024
9715316
fix: `prediction_request_rag` tool resposne
0xArdi May 22, 2024
c0dee63
chore: lint
0xArdi May 22, 2024
726de11
fix: deps
0xArdi May 22, 2024
9e0ee08
fix: add default model support
0xArdi May 22, 2024
22f098f
Merge pull request #227 from valory-xyz/fix/remove-redundant-package
0xArdi May 22, 2024
f0366ca
Merge pull request #222 from evangriffiths/evan/tomte-dev-dep
0xArdi May 22, 2024
10c7d3e
Add tool deps README.md
0xArdi May 23, 2024
5576d16
Merge pull request #230 from valory-xyz/docs/deps
0xArdi May 23, 2024
524bc59
chore: bump deps
dvilelaf May 24, 2024
c27dfb6
Merge branch 'refs/heads/main' into feat/keychain
0xArdi May 24, 2024
076f6d6
chore: lock poetry
0xArdi May 24, 2024
1a27e3f
Merge pull request #229 from valory-xyz/feat/keychain
0xArdi May 24, 2024
bb77f35
chore: bump deps again
dvilelaf May 24, 2024
6be4bbf
chore: lock packages
dvilelaf May 24, 2024
ee4762f
feat: add tool
dvilelaf May 24, 2024
9523de1
fix: improve response, rename
dvilelaf May 24, 2024
e181b8b
fix: hashes
dvilelaf May 24, 2024
5ae1f76
Merge branch 'main' into feat/langchain-tool
dvilelaf May 24, 2024
a928106
fix: ignore false positive leaks
dvilelaf May 24, 2024
c76e9b5
fix: safety
dvilelaf May 24, 2024
1a2ca30
fix: add key rotation
dvilelaf May 24, 2024
5edf527
fix: keychain
dvilelaf May 24, 2024
2677c6a
Merge branch 'main' into gemini-tool
victorpolisetty May 25, 2024
90bfc5d
fix merge conflicts
victorpolisetty May 25, 2024
2b56e8d
fix: add default model to `resolve_market_reasoning`
0xArdi May 27, 2024
861474b
Merge pull request #233 from valory-xyz/fix/reslove-market-defualt-model
0xArdi May 27, 2024
5648a6f
feat: add lite tools
0xArdi May 28, 2024
f136c3b
feat: return probabilities, confidence and info utility
Adamantios May 28, 2024
473cfc4
chore: bump mech deps
0xArdi May 28, 2024
79779db
Merge branch 'main' into peter/ofv-resolver
kongzii May 29, 2024
977df31
update lock
kongzii May 29, 2024
22730cf
add is_valid
kongzii May 29, 2024
88d1fdb
refactor: hardcode topic and timeframe
Adamantios May 29, 2024
acead1d
refactor: change the question's expected kwarg to `prompt`
Adamantios May 29, 2024
6a9ed4d
Merge remote-tracking branch 'origin/feat/langchain-tool' into feat/l…
Adamantios May 29, 2024
bd8cb49
Merge branch 'refs/heads/main' into feat/langchain-tool
Adamantios May 29, 2024
ea51470
fix: env vars
dvilelaf May 29, 2024
72adedc
fix: format hack
dvilelaf May 29, 2024
5673461
fix: more hacks
dvilelaf May 29, 2024
56ecf18
Merge pull request #231 from valory-xyz/feat/langchain-tool
dvilelaf May 29, 2024
1a825db
First skeleton for omen_buy_yes_tokens
gabrielfior May 30, 2024
d42541b
Merge branch 'main' into gemini-tool
victorpolisetty May 30, 2024
d3d52f3
Improved LLM call with Pydantic output object
gabrielfior May 31, 2024
7edecf8
Added sell token functionality
gabrielfior Jun 4, 2024
c53c5b2
Updated poetry dependencies
gabrielfior Jun 4, 2024
bec95a1
Added tests
gabrielfior Jun 4, 2024
c3d7e78
Added dependencies to more files per PR comments
gabrielfior Jun 5, 2024
a629817
Merge branch 'main' into feat/lite-tools
0xArdi Jun 6, 2024
0c972da
Merge pull request #235 from valory-xyz/feat/lite-tools
0xArdi Jun 7, 2024
77a92aa
Added gnosis_rpc_url to key chain, removed from environ
gabrielfior Jun 7, 2024
f09951f
Added GNOSIS_RPC_URL as secrets to unit tests
gabrielfior Jun 7, 2024
84b7148
Merge pull request #237 from gabrielfior/gabriel/buy-yes-tokens-omen
0xArdi Jun 7, 2024
625fab0
Merge branch 'main' into gemini-tool
victorpolisetty Jun 8, 2024
8042ba6
update deps and tests
victorpolisetty Jun 8, 2024
8ead082
DALLE request mech tool
victorpolisetty Jun 11, 2024
df8fe44
Merge branch 'main' into peter/ofv-resolver
kongzii Jun 17, 2024
10fbda7
Merge pull request #228 from victorpolisetty/gemini-tool
0xArdi Jun 17, 2024
16093a1
merge master into branch
victorpolisetty Jun 22, 2024
35ed92b
add unit test and key rotation
victorpolisetty Jun 23, 2024
1f5d271
ran packages lock
victorpolisetty Jun 23, 2024
1f9ef4d
Bumped PMAT version
gabrielfior Jun 25, 2024
d947725
Updated poetry.lock
gabrielfior Jun 25, 2024
3c90b94
Relaxed dependencies
gabrielfior Jun 25, 2024
411f43a
update ofv rev
kongzii Jun 27, 2024
fa4dfc6
fix deps
kongzii Jun 27, 2024
1a2e216
Merge branch 'main' into peter/ofv-resolver
kongzii Jun 27, 2024
c522f9f
fix lock file
kongzii Jun 27, 2024
c8acbe9
fix benchmark for single prediction
kongzii Jun 27, 2024
f647200
Merge pull request #239 from victorpolisetty/dalle-request
0xArdi Jul 2, 2024
10b558a
Merge branch 'main' into peter/ofv-resolver
kongzii Jul 3, 2024
18d3b3c
Merge pull request #241 from gabrielfior/fix-gnosis-pmat-version
0xArdi Jul 3, 2024
bafb091
Add -i 70612
kongzii Jul 3, 2024
7d5f212
Merge branch 'main' into peter/ofv-resolver
kongzii Jul 3, 2024
f6cee21
update lock
kongzii Jul 3, 2024
bf747b3
force cpu torch
kongzii Jul 5, 2024
42a3ab7
Update poetry version
kongzii Jul 8, 2024
3498fe7
fix mack
kongzii Jul 9, 2024
efb8709
fix gitleaks ignore
kongzii Jul 9, 2024
9c64692
trying to fix tools
kongzii Jul 9, 2024
1be3d41
revert cpu only torch
kongzii Jul 9, 2024
760d126
relock
kongzii Jul 9, 2024
f2481ad
try to fix tox
kongzii Jul 9, 2024
3e5f5b7
maybe maybe!
kongzii Jul 9, 2024
2facdcc
fix aeaconfig
kongzii Jul 9, 2024
4f7fd61
update locks
kongzii Jul 9, 2024
3a5678a
Move OFV to gnosis folder instead of kongzii
kongzii Jul 9, 2024
df9df8e
add graphapi keyy
kongzii Jul 9, 2024
4ba88c0
black
kongzii Jul 9, 2024
cab249d
remove sentene transformers
kongzii Jul 9, 2024
4f78c3d
never enough of fixes!
kongzii Jul 9, 2024
5db5ec0
lock
kongzii Jul 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .example.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FILE_HASH_TO_TOOLS='[["bafybeibdcttrlgp5udygntka5fofi566pitkxhquke37ng7csvndhy4s2i",["openai-gpt-3.5-turbo-instruct","openai-gpt-3.5-turbo","openai-gpt-4"]],["bafybeiegbsq2ajxyipajac4mmxyvbt22ctwyuypuid6ziavqpndns6fsjy",["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"]],["bafybeihugaylajwh2fgypxatcw5qrw5qxadtrsi2h2s2246442wlvjirtm",["transfer-native"]],["bafybeiayity7o6c2yynrpe6libyak37hgf4fp7a4kjfcnqkkxwy3zkp3ie",["prediction-offline","prediction-online"]]]'
API_KEYS='[["openai","dummy_api_key"],["stabilityai","dummy_api_key"]]'
FILE_HASH_TO_TOOLS='[["bafybeibdcttrlgp5udygntka5fofi566pitkxhquke37ng7csvndhy4s2i",["openai-gpt-3.5-turbo-instruct","openai-gpt-3.5-turbo","openai-gpt-4"]],["bafybeiegbsq2ajxyipajac4mmxyvbt22ctwyuypuid6ziavqpndns6fsjy",["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"]],["bafybeihugaylajwh2fgypxatcw5qrw5qxadtrsi2h2s2246442wlvjirtm",["transfer-native"]],["bafybeiayity7o6c2yynrpe6libyak37hgf4fp7a4kjfcnqkkxwy3zkp3ie",["prediction-offline","prediction-online"]],["bafybeifpalgiya4dyu42hehsqxlwr36fjtxdo75xf3gcpfrauvoxgargy4",["gemini-pro", "gemini-1.0-pro-001", "gemini-1.0-pro-latest", "gemini-1.5-pro-latest"]]]'
API_KEYS='[["openai","dummy_api_key"],["stabilityai","dummy_api_key"],["gemini","dummy_api_key"]]'
ETHEREUM_LEDGER_RPC_0=https://rpc.eu-central-2.gateway.fm/v4/gnosis/non-archival/mainnet
GNOSIS_RPC_0=https://rpc.eu-central-2.gateway.fm/v4/gnosis/non-archival/mainnet
ETHEREUM_WEBSOCKET_RPC_0=wss://rpc.eu-central-2.gateway.fm/ws/v4/gnosis/non-archival/mainnet
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/common_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ jobs:
REPLICATE_API_KEY: ${{ secrets.REPLICATE_API_KEY }}
NEWS_API_KEY: ${{ secrets.NEWS_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPEN_ROUTER_API_KEY }}
GNOSIS_RPC_URL: ${{ secrets.GNOSIS_RPC_URL }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
GRAPH_API_KEY: ${{ secrets.GRAPH_API_KEY }}
run: |
printenv
tox -e check-tools
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ backup_mech/
/packages/valory/skills/termination_abci/
/pip
/tool_test.py
.venv
.venv
log
.benchmark-cache
6 changes: 5 additions & 1 deletion .gitleaksignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,8 @@ a8dd503580f9dee27828d954000e5195a8231685:packages/valory/skills/task_submission_
a8dd503580f9dee27828d954000e5195a8231685:packages/valory/skills/task_submission_abci/skill.yaml:generic-api-key:1574
a8dd503580f9dee27828d954000e5195a8231685:packages/valory/skills/task_submission_abci/skill.yaml:generic-api-key:1575
cefa30e1c946a42089bed80891eff51bad6b39a9:packages/valory/protocols/websocket_client/protocol.yaml:generic-api-key:18
c73b5d88fe1a364d7b1168b3ad171da59e7a2eac:packages/valory/protocols/websocket_client/protocol.yaml:generic-api-key:18
c73b5d88fe1a364d7b1168b3ad171da59e7a2eac:packages/valory/protocols/websocket_client/protocol.yaml:generic-api-key:18
c0dee637e3d520b9706e91db197e859ca5fce23a:packages/valory/skills/task_execution/skill.yaml:generic-api-key:15
3a080091883863f5b62d1dcfe030ec7577889f8c:packages/valory/skills/task_execution/skill.yaml:generic-api-key:15
eecbf34a242377fb07d28230cf11ea43fb07de8d:packages/valory/skills/task_execution/skill.yaml:generic-api-key:15
d7f9fd6ad8bcf9ea2bf14bf3de221971ddb56268:packages/valory/skills/task_execution/skill.yaml:generic-api-key:15
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ You can create and mint your own AI Mech that handles requests for tasks that yo
<api_key>=kwargs["api_keys"][<api_key_id>].
```

- **Output**: It must **always** return a tuple (`Tuple[str, Optional[str], Optional[Dict[str, Any]], Any]`):
- **Output**: It must **always** return a tuple (`Tuple[str, Optional[str], Optional[Dict[str, Any]], Any, Any]`):
- `result_str`: A string-serialized JSON object containing the result of the tool execution (custom format).
- `prompt_used`: A string representing the prompt used internally by the tool. This output is only used for analytics and it can be set to `None`.
- `generated_tx`: A dictionary containing the fields of a generated transaction to be submitted following the execution of the tool (e.g., a token transfer). It can be set to `None`. Template of a generated transaction:
Expand All @@ -238,10 +238,15 @@ You can create and mint your own AI Mech that handles requests for tasks that yo
```

- `counter_callback`: Object to be called for calculating the cost when making requests to this tool. It can be set to `None`.

- `keychain`: The object hanlding the keys. Note that if you use the `with_key_rotation` decorator, you don't need to return this.
- **Exceptions**: A compliant implementation of the `run` function must capture any exception raised during its execution and return it appropriately, for example as an error code in `result_str`. If `run` raises an exception the Mech will capture and output an `Invalid response` string.

2. **Upload the tool file to IPFS.** You can push your tool to IPFS like the other packages:
- **Dependencies**: If your tool introduces new dependencies, you must add them in the following three places:
- [pyproject.toml](./pyproject.toml): Add your dependencies under the `[tool.poetry.dependencies]` section.
- [tox.ini](./tox.ini): Add your dependencies under the `[testenv]deps` section.
- [aea-config.yaml](./packages/valory/agents/mech/aea-config.yaml): Ensure your dependencies are listed under the `dependencies` key.

3. **Upload the tool file to IPFS.** You can push your tool to IPFS like the other packages:

```bash
autonomy push-all
Expand All @@ -258,7 +263,7 @@ You can create and mint your own AI Mech that handles requests for tasks that yo

Your tool will be available on [packages.json](packages/packages.json).

3. **Configure your service.** Edit the `.env` file. The demo service has this configuration:
4. **Configure your service.** Edit the `.env` file. The demo service has this configuration:

```bash
FILE_HASH_TO_TOOLS=[["bafybeiaodddyn4eruafqg5vldkkjfglj7jg76uvyi5xhi2cysktlu4w6r4",["openai-gpt-3.5-turbo-instruct","openai-gpt-3.5-turbo","openai-gpt-4"]],["bafybeiepc5v4ixwuu5m6p5stck5kf2ecgkydf6crj52i5umnl2qm5swb4i",["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"]]]
Expand All @@ -272,7 +277,7 @@ You can create and mint your own AI Mech that handles requests for tasks that yo
API_KEYS=[[openai, dummy_api_key],[<your_api_key_id>, <your_api_key>]]
```

4. **Mint your agent service** in the [Autonolas Protocol](https://registry.olas.network/services/mint), and create a Mech for it in [Mech Hub](https://aimechs.autonolas.network/factory). This will allow you to set the `SAFE_CONTRACT_ADDRESS` and `AGENT_MECH_CONTRACT_ADDRESS` in the `.1env` file.
5. **Mint your agent service** in the [Autonolas Protocol](https://registry.olas.network/services/mint), and create a Mech for it in [Mech Hub](https://aimechs.autonolas.network/factory). This will allow you to set the `SAFE_CONTRACT_ADDRESS` and `AGENT_MECH_CONTRACT_ADDRESS` in the `.1env` file.

> **Warning**
> AI Mechs run on the [Gnosis chain](https://www.gnosis.io/). You must ensure that your wallet is connected to the [Gnosis chain](https://www.gnosis.io/) before using the [Autonolas Protocol](https://protocol.autonolas.network/services/mint) and [Mech Hub](https://aimechs.autonolas.network/factory).
Expand All @@ -290,7 +295,7 @@ You can create and mint your own AI Mech that handles requests for tasks that yo
}
```

5. **Run your service.** You can take a look at the `run_service.sh` script and execute your service locally as [above](#option-2-run-the-mech-as-an-agent-service).
6. **Run your service.** You can take a look at the `run_service.sh` script and execute your service locally as [above](#option-2-run-the-mech-as-an-agent-service).

Once your service works locally, you have the option to run it on a hosted service like [Propel](https://propel.valory.xyz/).

Expand Down
19 changes: 19 additions & 0 deletions packages/gnosis/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2024 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------
19 changes: 19 additions & 0 deletions packages/gnosis/customs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2024 Valory AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ------------------------------------------------------------------------------
151 changes: 151 additions & 0 deletions packages/gnosis/customs/ofv_market_resolver/benchmark.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import typer
import json
import pandas as pd
from packages.gnosis.customs.ofv_market_resolver.ofv_market_resolver import (
run as ofv_run,
)
from packages.napthaai.customs.resolve_market_reasoning.resolve_market_reasoning import (
Results,
run as original_run,
)
from pydantic import SecretStr, ValidationError
from joblib import Memory

# File cache to not re-run the same questions.
MEMORY = Memory(".benchmark-cache", verbose=0)
APP = typer.Typer()


@MEMORY.cache
def ofv_run_cached(
question: str,
openai_api_key: SecretStr,
serper_api_key: SecretStr,
) -> bool | None:
return json.loads(
ofv_run(
prompt=question,
api_keys={
"openai": openai_api_key.get_secret_value(),
"serperapi": serper_api_key.get_secret_value(),
},
)[0]
)["has_occurred"]


@MEMORY.cache
def run_original_resolver_cached(
question: str,
openai_api_key: SecretStr,
google_api_key: SecretStr,
google_engine_id: SecretStr,
) -> bool | None:
try:
dump = original_run(
api_keys={
"openai": openai_api_key.get_secret_value(),
"google_api_key": google_api_key.get_secret_value(),
"google_engine_id": google_engine_id.get_secret_value(),
},
tool="resolve-market-reasoning-gpt-4",
prompt=question,
)[0]
return Results.model_validate_json(dump).has_occurred
except ValueError:
return None


@APP.command()
def full(
data_path: str,
openai_api_key: str,
serper_api_key: str,
google_api_key: str,
google_engine_id: str,
) -> None:
"""
Will run the prediction market resolver on all provided data and compare the results.

Expects a tsv file with columns:
- question
- resolution (YES/NO, as currently resolved on Omen)
- my_resolution (YES/NO, as resolved manually by you, used as ground truth)

Example command:

```
python packages/gnosis/customs/ofv_market_resolver/benchmark.py full markets.tsv {openai api key} {serper api key} {google api key} {google engine id}
```
"""
df = pd.read_csv(data_path, sep="\t")

# Run the resolution on all the data.
df["ofv_resolution"] = df["question"].apply(
lambda q: ofv_run_cached(
q,
openai_api_key=SecretStr(openai_api_key),
serper_api_key=SecretStr(serper_api_key),
)
)
df["new_original_resolution"] = df["question"].apply(
lambda q: run_original_resolver_cached(
q,
openai_api_key=SecretStr(openai_api_key),
google_api_key=SecretStr(google_api_key),
google_engine_id=SecretStr(google_engine_id),
)
)
# Normalise boolean to YES/NO/None.
df["ofv_resolution"] = df["ofv_resolution"].apply(
lambda r: "None" if r is None else "YES" if r else "NO"
)
df["new_original_resolution"] = df["new_original_resolution"].apply(
lambda r: "None" if r is None else "YES" if r else "NO"
)
# Save all the predictions and separatelly these that are incorrect.
df.to_csv("markets_resolved.tsv", sep="\t", index=False)
df[df["ofv_resolution"] != df["my_resolution"]].to_csv(
"markets_resolved_incorretly_by_ofv.tsv", sep="\t", index=False
)

# Calculate the accuracy.
accuracy_current = sum(df["resolution"] == df["my_resolution"]) / len(df)
accuracy_new_original = sum(
df["new_original_resolution"] == df["my_resolution"]
) / len(df)
accuracy_ofv = sum(df["ofv_resolution"] == df["my_resolution"]) / len(df)
print(
f"""
Current accuracy: {accuracy_current*100:.2f}%
Original's new run accuracy: {accuracy_new_original * 100:.2f}
OFV's accuracy: {accuracy_ofv*100:.2f}%
"""
)


@APP.command()
def single(
question: str,
openai_api_key: str,
serper_api_key: str,
) -> None:
"""
Will run the prediction market resolver and print the result on a single question.

Example command:

```
python packages/gnosis/customs/ofv_market_resolver/benchmark.py single "Will McDonald's successfully buy back all its Israeli restaurants by 12 April 2024?" {openai api key} {serper api key}
```
"""
ofv_run(
question,
api_keys={
"openai": openai_api_key,
"serperapi": serper_api_key,
},
)


if __name__ == "__main__":
APP()
Loading
Loading