diff --git a/Procfile b/Procfile index 94d4e4ba..3a610dbd 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: sh setup.sh && streamlit run evo_prophet/app.py \ No newline at end of file +web: sh setup.sh && streamlit run prediction_prophet/app.py \ No newline at end of file diff --git a/README.md b/README.md index 7429b99a..a59c3973 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# evo.prophet +# Prediction Prophet ![](./content/banner_hires.png) --- @@ -9,7 +9,7 @@ ## Welcome! -evo.prophet is an agent that specializes in making informed predictions, based on web research. To try it yourself head to [predictionprophet.ai](https://predictionprophet.ai) or build and run from source following these [setup instructions](#setup). +Prediction Prophet is an agent that specializes in making informed predictions, based on web research. To try it yourself head to [predictionprophet.ai](https://predictionprophet.ai) or build and run from source following these [setup instructions](#setup). ## Need Help? @@ -17,13 +17,13 @@ Join our [Discord community](https://discord.gg/k7UCsH3ps9) for support and disc [![Join us on Discord](https://invidget.switchblade.xyz/k7UCsH3ps9)](https://discord.com/invite/k7UCsH3ps9) -If you have questions or encounter issues, please don't hesitate to [create a new issue](https://github.com/polywrap/evo.prophet/issues/new) to get support. +If you have questions or encounter issues, please don't hesitate to [create a new issue](https://github.com/polywrap/predictionprophet/issues/new) to get support. ## How It Works ![](./content/diagram.png) -To elaborate further, given a question like `"Will Twitter implement a new misinformation policy before the 2024 elections?"`, evo.prophet will: +To elaborate further, given a question like `"Will Twitter implement a new misinformation policy before the 2024 elections?"`, Prophet will: 1. Generate `n` web search queries and re-ranks them using an LLM call, selecting only the most relevant ones 2. Search the web for each query, using [Tavily](https://tavily.com/) @@ -31,14 +31,14 @@ To elaborate further, given a question like `"Will Twitter implement a new misin 4. Use Langchain's `RecursiveCharacterTextSplitter` to split the content of all pages into chunks and create embeddings. All chunks are stored with the content as metadata. 5. Iterate over the queries selected on step `1` and vector search for the most relevant chunks created in step `4`. 6. Aggregate all relevant chunks and prepare a report. -7. Make a prediction using multi-agent debate. +7. Make a prediction. ## Setup ### Installation 1. Clone the repository - > `git clone https://github.com/polywrap/evo.prophet` + > `git clone https://github.com/polywrap/predictionprophet` 2. Copy the `.env.template` file and rename it to `.env`. > `cp .env.template .env` 3. Find the line that says OPENAI_API_KEY=, and add your unique [OpenAI](https://openai.com/) API Key @@ -67,7 +67,7 @@ poetry run research "Will Twitter implement a new misinformation policy before t ### Front-End ```bash -poetry run streamlit run ./evo_prophet/app.py +poetry run streamlit run ./prediction_prophet/app.py ``` ## Possible Future Improvements diff --git a/mypy.ini b/mypy.ini index d43012d1..ab0c8c47 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,6 +1,6 @@ [mypy] python_version = 3.10 -files = evo_prophet/, scripts/, tests/ +files = prediction_prophet/, scripts/, tests/ plugins = pydantic.mypy warn_redundant_casts = True warn_unused_ignores = True diff --git a/evo_prophet/__init__.py b/prediction_prophet/__init__.py similarity index 100% rename from evo_prophet/__init__.py rename to prediction_prophet/__init__.py diff --git a/evo_prophet/app.py b/prediction_prophet/app.py similarity index 89% rename from evo_prophet/app.py rename to prediction_prophet/app.py index 793e6842..738d9986 100644 --- a/evo_prophet/app.py +++ b/prediction_prophet/app.py @@ -1,7 +1,7 @@ import time from typing import cast -from evo_prophet.benchmark.agents import _make_prediction -from evo_prophet.functions.is_predictable_and_binary import is_predictable_and_binary +from prediction_prophet.benchmark.agents import _make_prediction +from prediction_prophet.functions.is_predictable_and_binary import is_predictable_and_binary from prediction_market_agent_tooling.benchmark.utils import ( OutcomePrediction ) @@ -9,12 +9,12 @@ import streamlit as st from prediction_market_agent_tooling.tools.utils import secret_str_from_env from langchain.text_splitter import RecursiveCharacterTextSplitter -from evo_prophet.functions.create_embeddings_from_results import create_embeddings_from_results -from evo_prophet.functions.generate_subqueries import generate_subqueries -from evo_prophet.functions.prepare_report import prepare_report -from evo_prophet.functions.rerank_subqueries import rerank_subqueries -from evo_prophet.functions.scrape_results import scrape_results -from evo_prophet.functions.search import search +from prediction_prophet.functions.create_embeddings_from_results import create_embeddings_from_results +from prediction_prophet.functions.generate_subqueries import generate_subqueries +from prediction_prophet.functions.prepare_report import prepare_report +from prediction_prophet.functions.rerank_subqueries import rerank_subqueries +from prediction_prophet.functions.scrape_results import scrape_results +from prediction_prophet.functions.search import search def research( goal: str, @@ -98,13 +98,13 @@ def research( st.stop() st.set_page_config(layout="wide") -st.title("Evo Prophet") +st.title("Prediction Prophet") st.write('Ask any yes-or-no question about a future outcome') with st.sidebar: - st.title('Evo Prophet') + st.title('Prediction Prophet') st.markdown("A web3 agent by [Polywrap](https://www.polywrap.io/)") - st.image('https://raw.githubusercontent.com/polywrap/evo.prophet/main/content/banner_hires.png') + st.image('https://raw.githubusercontent.com/polywrap/predictionprophet/main/content/banner_hires.png') st.markdown('#') openai_api_key = SecretStr(st.text_input("OpenAI API Key", type="password", key="open_ai_key")) @@ -115,7 +115,7 @@ def research( st.markdown('#') st.markdown('#') st.markdown('-------') - st.caption('View the source code on our [github](https://github.com/polywrap/evo.prophet)') + st.caption('View the source code on our [github](https://github.com/polywrap/predictionprophet)') st.caption('Join our [discord](https://discord.gg/3ebYCjXbg7)') diff --git a/evo_prophet/autonolas/__init__.py b/prediction_prophet/autonolas/__init__.py similarity index 100% rename from evo_prophet/autonolas/__init__.py rename to prediction_prophet/autonolas/__init__.py diff --git a/evo_prophet/autonolas/research.py b/prediction_prophet/autonolas/research.py similarity index 99% rename from evo_prophet/autonolas/research.py rename to prediction_prophet/autonolas/research.py index 27c8c9e6..53d4794e 100644 --- a/evo_prophet/autonolas/research.py +++ b/prediction_prophet/autonolas/research.py @@ -15,7 +15,7 @@ from enum import Enum from bs4 import BeautifulSoup, NavigableString from googleapiclient.discovery import build -from evo_prophet.functions.parallelism import THREADPOOL +from prediction_prophet.functions.parallelism import THREADPOOL import requests from requests import Session @@ -29,10 +29,10 @@ from langchain_openai import OpenAIEmbeddings from dateutil import parser -from evo_prophet.functions.utils import check_not_none +from prediction_prophet.functions.utils import check_not_none from prediction_market_agent_tooling.tools.utils import secret_str_from_env -from evo_prophet.functions.cache import persistent_inmemory_cache -from evo_prophet.functions.parallelism import par_map +from prediction_prophet.functions.cache import persistent_inmemory_cache +from prediction_prophet.functions.parallelism import par_map from pydantic.types import SecretStr from prediction_market_agent_tooling.gtypes import secretstr_to_v1_secretstr diff --git a/evo_prophet/benchmark/__init__.py b/prediction_prophet/benchmark/__init__.py similarity index 100% rename from evo_prophet/benchmark/__init__.py rename to prediction_prophet/benchmark/__init__.py diff --git a/evo_prophet/benchmark/agents.py b/prediction_prophet/benchmark/agents.py similarity index 86% rename from evo_prophet/benchmark/agents.py rename to prediction_prophet/benchmark/agents.py index b2bfbedc..6b49afaa 100644 --- a/evo_prophet/benchmark/agents.py +++ b/prediction_prophet/benchmark/agents.py @@ -7,23 +7,23 @@ Prediction, ) from datetime import datetime -from evo_prophet.autonolas.research import EmbeddingModel -from evo_prophet.autonolas.research import make_prediction, get_urls_from_queries -from evo_prophet.autonolas.research import research as research_autonolas -from evo_prophet.functions.evaluate_question import is_predictable -from evo_prophet.functions.rephrase_question import rephrase_question -from evo_prophet.functions.research import research as research_evo -from evo_prophet.functions.search import search -from evo_prophet.functions.utils import url_is_older_than -from evo_prophet.models.WebSearchResult import WebSearchResult +from prediction_prophet.autonolas.research import EmbeddingModel +from prediction_prophet.autonolas.research import make_prediction, get_urls_from_queries +from prediction_prophet.autonolas.research import research as research_autonolas +from prediction_prophet.functions.evaluate_question import is_predictable +from prediction_prophet.functions.rephrase_question import rephrase_question +from prediction_prophet.functions.research import research as prophet_research +from prediction_prophet.functions.search import search +from prediction_prophet.functions.utils import url_is_older_than +from prediction_prophet.models.WebSearchResult import WebSearchResult from unittest.mock import patch -from evo_prophet.functions.search import search +from prediction_prophet.functions.search import search from prediction_market_agent_tooling.benchmark.utils import ( OutcomePrediction, Prediction, ) from pydantic.types import SecretStr -from evo_prophet.autonolas.research import Prediction as LLMCompletionPredictionDict +from prediction_prophet.autonolas.research import Prediction as LLMCompletionPredictionDict def _make_prediction( market_question: str, @@ -144,16 +144,16 @@ def side_effect(*args: t.Any, **kwargs: t.Any) -> list[str]: ] return results_filtered - with patch('evo_prophet.autonolas.research.get_urls_from_queries', side_effect=side_effect, autospec=True): + with patch('prediction_prophet.autonolas.research.get_urls_from_queries', side_effect=side_effect, autospec=True): return self.predict(market_question) -class EvoAgent(AbstractBenchmarkedAgent): +class PredictionProphetAgent(AbstractBenchmarkedAgent): def __init__( self, model: str, temperature: float = 0.0, - agent_name: str = "evo", + agent_name: str = "prediction_prophet", use_summaries: bool = False, use_tavily_raw_content: bool = False, max_workers: t.Optional[int] = None, @@ -173,7 +173,7 @@ def is_predictable_restricted(self, market_question: str, time_restriction_up_to return result def research(self, market_question: str) -> str: - return research_evo( + return prophet_research( goal=market_question, model=self.model, use_summaries=self.use_summaries, @@ -190,7 +190,7 @@ def predict(self, market_question: str) -> Prediction: temperature=self.temperature, ) except ValueError as e: - print(f"Error in EvoAgent's predict: {e}") + print(f"Error in PredictionProphet's predict: {e}") return Prediction() def predict_restricted( @@ -204,7 +204,7 @@ def side_effect(*args: t.Any, **kwargs: t.Any) -> list[tuple[str, WebSearchResul ] return results_filtered - with patch('evo_prophet.functions.research.search', side_effect=side_effect, autospec=True): + with patch('prediction_prophet.functions.research.search', side_effect=side_effect, autospec=True): return self.predict(market_question) class RephrasingOlasAgent(OlasAgent): @@ -249,6 +249,6 @@ def research(self, market_question: str) -> str: AGENTS = [ OlasAgent, RephrasingOlasAgent, - EvoAgent, + PredictionProphetAgent, QuestionOnlyAgent, ] diff --git a/evo_prophet/deployment/models.py b/prediction_prophet/deployment/models.py similarity index 94% rename from evo_prophet/deployment/models.py rename to prediction_prophet/deployment/models.py index dba650bd..dda0989c 100644 --- a/evo_prophet/deployment/models.py +++ b/prediction_prophet/deployment/models.py @@ -1,7 +1,7 @@ import pytz from decimal import Decimal from datetime import datetime, timedelta -from evo_prophet.benchmark.agents import EvoAgent, OlasAgent, EmbeddingModel +from prediction_prophet.benchmark.agents import PredictionProphetAgent, OlasAgent, EmbeddingModel from prediction_market_agent_tooling.benchmark.agents import AbstractBenchmarkedAgent from prediction_market_agent_tooling.markets.agent_market import AgentMarket from prediction_market_agent_tooling.markets.manifold.manifold import ManifoldAgentMarket @@ -75,8 +75,8 @@ def answer_binary_market(self, market: AgentMarket) -> bool: return binary_answer -class DeployableAgentER_EvoGPT3(DeployableAgentER): - agent = EvoAgent(model="gpt-3.5-turbo-0125") +class DeployableAgentER_PredictionProphetGPT3(DeployableAgentER): + agent = PredictionProphetAgent(model="gpt-3.5-turbo-0125") class DeployableAgentER_OlasEmbeddingOA(DeployableAgentER): diff --git a/evo_prophet/functions/__init__.py b/prediction_prophet/functions/__init__.py similarity index 100% rename from evo_prophet/functions/__init__.py rename to prediction_prophet/functions/__init__.py diff --git a/evo_prophet/functions/cache.py b/prediction_prophet/functions/cache.py similarity index 100% rename from evo_prophet/functions/cache.py rename to prediction_prophet/functions/cache.py diff --git a/evo_prophet/functions/create_embeddings_from_results.py b/prediction_prophet/functions/create_embeddings_from_results.py similarity index 94% rename from evo_prophet/functions/create_embeddings_from_results.py rename to prediction_prophet/functions/create_embeddings_from_results.py index 75d6728b..94a99b33 100644 --- a/evo_prophet/functions/create_embeddings_from_results.py +++ b/prediction_prophet/functions/create_embeddings_from_results.py @@ -9,7 +9,7 @@ import os from langchain_openai import OpenAIEmbeddings from langchain.vectorstores.chroma import Chroma -from evo_prophet.models.WebScrapeResult import WebScrapeResult +from prediction_prophet.models.WebScrapeResult import WebScrapeResult from langchain.text_splitter import RecursiveCharacterTextSplitter from pydantic.types import SecretStr from prediction_market_agent_tooling.tools.utils import secret_str_from_env diff --git a/evo_prophet/functions/debate_prediction.py b/prediction_prophet/functions/debate_prediction.py similarity index 98% rename from evo_prophet/functions/debate_prediction.py rename to prediction_prophet/functions/debate_prediction.py index a42cfc95..f2d63eba 100644 --- a/evo_prophet/functions/debate_prediction.py +++ b/prediction_prophet/functions/debate_prediction.py @@ -4,7 +4,7 @@ from prediction_market_agent_tooling.benchmark.utils import ( Prediction, ) -from evo_prophet.benchmark.agents import completion_prediction_json_to_pydantic_model +from prediction_prophet.benchmark.agents import completion_prediction_json_to_pydantic_model from pydantic import SecretStr from langchain.schema.output_parser import StrOutputParser from langchain_openai import ChatOpenAI diff --git a/evo_prophet/functions/evaluate_question.py b/prediction_prophet/functions/evaluate_question.py similarity index 93% rename from evo_prophet/functions/evaluate_question.py rename to prediction_prophet/functions/evaluate_question.py index 529eeacd..61c2615c 100644 --- a/evo_prophet/functions/evaluate_question.py +++ b/prediction_prophet/functions/evaluate_question.py @@ -1,8 +1,8 @@ import json -from evo_prophet.autonolas.research import clean_completion_json +from prediction_prophet.autonolas.research import clean_completion_json from langchain_openai import ChatOpenAI from langchain.prompts import ChatPromptTemplate -from evo_prophet.functions.cache import persistent_inmemory_cache +from prediction_prophet.functions.cache import persistent_inmemory_cache from pydantic.types import SecretStr from prediction_market_agent_tooling.tools.utils import secret_str_from_env from prediction_market_agent_tooling.gtypes import secretstr_to_v1_secretstr diff --git a/evo_prophet/functions/generate_subqueries.py b/prediction_prophet/functions/generate_subqueries.py similarity index 100% rename from evo_prophet/functions/generate_subqueries.py rename to prediction_prophet/functions/generate_subqueries.py diff --git a/evo_prophet/functions/is_predictable_and_binary.py b/prediction_prophet/functions/is_predictable_and_binary.py similarity index 93% rename from evo_prophet/functions/is_predictable_and_binary.py rename to prediction_prophet/functions/is_predictable_and_binary.py index 748a608f..f7f0f734 100644 --- a/evo_prophet/functions/is_predictable_and_binary.py +++ b/prediction_prophet/functions/is_predictable_and_binary.py @@ -1,8 +1,8 @@ import json -from evo_prophet.autonolas.research import clean_completion_json +from prediction_prophet.autonolas.research import clean_completion_json from langchain_openai import ChatOpenAI from langchain.prompts import ChatPromptTemplate -from evo_prophet.functions.cache import persistent_inmemory_cache +from prediction_prophet.functions.cache import persistent_inmemory_cache from pydantic.types import SecretStr from prediction_market_agent_tooling.tools.utils import secret_str_from_env from prediction_market_agent_tooling.gtypes import secretstr_to_v1_secretstr diff --git a/evo_prophet/functions/parallelism.py b/prediction_prophet/functions/parallelism.py similarity index 100% rename from evo_prophet/functions/parallelism.py rename to prediction_prophet/functions/parallelism.py diff --git a/evo_prophet/functions/prepare_report.py b/prediction_prophet/functions/prepare_report.py similarity index 95% rename from evo_prophet/functions/prepare_report.py rename to prediction_prophet/functions/prepare_report.py index d5adc8f6..281378c4 100644 --- a/evo_prophet/functions/prepare_report.py +++ b/prediction_prophet/functions/prepare_report.py @@ -4,8 +4,8 @@ from langchain_openai import ChatOpenAI from langchain.prompts import ChatPromptTemplate from langchain.schema.output_parser import StrOutputParser -from evo_prophet.functions.cache import persistent_inmemory_cache -from evo_prophet.functions.utils import trim_to_n_tokens +from prediction_prophet.functions.cache import persistent_inmemory_cache +from prediction_prophet.functions.utils import trim_to_n_tokens from prediction_market_agent_tooling.tools.utils import secret_str_from_env from prediction_market_agent_tooling.gtypes import secretstr_to_v1_secretstr from pydantic.types import SecretStr diff --git a/evo_prophet/functions/rephrase_question.py b/prediction_prophet/functions/rephrase_question.py similarity index 95% rename from evo_prophet/functions/rephrase_question.py rename to prediction_prophet/functions/rephrase_question.py index fc040ca7..4d31121c 100644 --- a/evo_prophet/functions/rephrase_question.py +++ b/prediction_prophet/functions/rephrase_question.py @@ -2,7 +2,7 @@ import tiktoken from pydantic import BaseModel from langchain_openai import ChatOpenAI -from evo_prophet.autonolas.research import clean_completion_json +from prediction_prophet.autonolas.research import clean_completion_json from langchain.prompts import ChatPromptTemplate diff --git a/evo_prophet/functions/rerank_results.py b/prediction_prophet/functions/rerank_results.py similarity index 100% rename from evo_prophet/functions/rerank_results.py rename to prediction_prophet/functions/rerank_results.py diff --git a/evo_prophet/functions/rerank_subqueries.py b/prediction_prophet/functions/rerank_subqueries.py similarity index 100% rename from evo_prophet/functions/rerank_subqueries.py rename to prediction_prophet/functions/rerank_subqueries.py diff --git a/evo_prophet/functions/research.py b/prediction_prophet/functions/research.py similarity index 88% rename from evo_prophet/functions/research.py rename to prediction_prophet/functions/research.py index 1971ae4c..4ab5f003 100644 --- a/evo_prophet/functions/research.py +++ b/prediction_prophet/functions/research.py @@ -1,13 +1,13 @@ import logging from langchain.text_splitter import RecursiveCharacterTextSplitter -from evo_prophet.functions.create_embeddings_from_results import create_embeddings_from_results -from evo_prophet.functions.generate_subqueries import generate_subqueries -from evo_prophet.functions.prepare_report import prepare_report, prepare_summary -from evo_prophet.models.WebScrapeResult import WebScrapeResult -from evo_prophet.functions.rerank_subqueries import rerank_subqueries -from evo_prophet.functions.scrape_results import scrape_results -from evo_prophet.functions.search import search +from prediction_prophet.functions.create_embeddings_from_results import create_embeddings_from_results +from prediction_prophet.functions.generate_subqueries import generate_subqueries +from prediction_prophet.functions.prepare_report import prepare_report, prepare_summary +from prediction_prophet.models.WebScrapeResult import WebScrapeResult +from prediction_prophet.functions.rerank_subqueries import rerank_subqueries +from prediction_prophet.functions.scrape_results import scrape_results +from prediction_prophet.functions.search import search from pydantic.types import SecretStr def research( diff --git a/evo_prophet/functions/scrape_results.py b/prediction_prophet/functions/scrape_results.py similarity index 54% rename from evo_prophet/functions/scrape_results.py rename to prediction_prophet/functions/scrape_results.py index 624eb727..b94b95dd 100644 --- a/evo_prophet/functions/scrape_results.py +++ b/prediction_prophet/functions/scrape_results.py @@ -1,7 +1,7 @@ -from evo_prophet.models.WebScrapeResult import WebScrapeResult -from evo_prophet.functions.web_search import WebSearchResult -from evo_prophet.functions.web_scrape import web_scrape -from evo_prophet.functions.parallelism import par_map +from prediction_prophet.models.WebScrapeResult import WebScrapeResult +from prediction_prophet.functions.web_search import WebSearchResult +from prediction_prophet.functions.web_scrape import web_scrape +from prediction_prophet.functions.parallelism import par_map def scrape_results(results: list[WebSearchResult]) -> list[WebScrapeResult]: diff --git a/evo_prophet/functions/search.py b/prediction_prophet/functions/search.py similarity index 95% rename from evo_prophet/functions/search.py rename to prediction_prophet/functions/search.py index 251114f9..de4a9b93 100644 --- a/evo_prophet/functions/search.py +++ b/prediction_prophet/functions/search.py @@ -1,6 +1,6 @@ import requests import typing as t -from evo_prophet.functions.web_search import WebSearchResult, web_search +from prediction_prophet.functions.web_search import WebSearchResult, web_search from concurrent.futures import ThreadPoolExecutor, as_completed from pydantic.types import SecretStr diff --git a/evo_prophet/functions/summarize.py b/prediction_prophet/functions/summarize.py similarity index 100% rename from evo_prophet/functions/summarize.py rename to prediction_prophet/functions/summarize.py diff --git a/evo_prophet/functions/utils.py b/prediction_prophet/functions/utils.py similarity index 97% rename from evo_prophet/functions/utils.py rename to prediction_prophet/functions/utils.py index 133909af..81243bff 100644 --- a/evo_prophet/functions/utils.py +++ b/prediction_prophet/functions/utils.py @@ -3,7 +3,7 @@ from datetime import datetime from typing import NoReturn, Type, TypeVar, Optional from googleapiclient.discovery import build -from evo_prophet.functions.cache import persistent_inmemory_cache +from prediction_prophet.functions.cache import persistent_inmemory_cache T = TypeVar("T") diff --git a/evo_prophet/functions/web_scrape.py b/prediction_prophet/functions/web_scrape.py similarity index 95% rename from evo_prophet/functions/web_scrape.py rename to prediction_prophet/functions/web_scrape.py index 355541ce..005d41b8 100644 --- a/evo_prophet/functions/web_scrape.py +++ b/prediction_prophet/functions/web_scrape.py @@ -4,7 +4,7 @@ from bs4 import BeautifulSoup from requests import Response import tenacity -from evo_prophet.functions.cache import persistent_inmemory_cache +from prediction_prophet.functions.cache import persistent_inmemory_cache @tenacity.retry(stop=tenacity.stop_after_attempt(3), wait=tenacity.wait_fixed(1), reraise=True) diff --git a/evo_prophet/functions/web_search.py b/prediction_prophet/functions/web_search.py similarity index 88% rename from evo_prophet/functions/web_search.py rename to prediction_prophet/functions/web_search.py index c2f86d20..bb131b91 100644 --- a/evo_prophet/functions/web_search.py +++ b/prediction_prophet/functions/web_search.py @@ -4,8 +4,8 @@ from pydantic.types import SecretStr from prediction_market_agent_tooling.tools.utils import secret_str_from_env -from evo_prophet.models.WebSearchResult import WebSearchResult -from evo_prophet.functions.cache import persistent_inmemory_cache +from prediction_prophet.models.WebSearchResult import WebSearchResult +from prediction_prophet.functions.cache import persistent_inmemory_cache @tenacity.retry(stop=tenacity.stop_after_attempt(3), wait=tenacity.wait_fixed(1), reraise=True) diff --git a/evo_prophet/main.py b/prediction_prophet/main.py similarity index 85% rename from evo_prophet/main.py rename to prediction_prophet/main.py index e67495b1..29dfdfa9 100644 --- a/evo_prophet/main.py +++ b/prediction_prophet/main.py @@ -3,9 +3,9 @@ import click import time from dotenv import load_dotenv -from evo_prophet.functions.debate_prediction import make_debated_prediction +from prediction_prophet.functions.debate_prediction import make_debated_prediction from langchain_community.callbacks import get_openai_callback -from evo_prophet.functions.research import research as evo_research +from prediction_prophet.functions.research import research as prophet_research from prediction_market_agent_tooling.benchmark.utils import ( OutcomePrediction ) @@ -40,7 +40,7 @@ def research( start = time.time() with get_openai_callback() as cb: - report = evo_research(goal=prompt, use_summaries=False, model="gpt-4-0125-preview") + report = prophet_research(goal=prompt, use_summaries=False, model="gpt-4-0125-preview") end = time.time() @@ -66,7 +66,7 @@ def predict(prompt: str, path: str | None = None) -> None: else: logger = logging.getLogger("research") logger.setLevel(logging.INFO) - report = evo_research(goal=prompt, model="gpt-4-0125-preview", use_summaries=False, logger=logger) + report = prophet_research(goal=prompt, model="gpt-4-0125-preview", use_summaries=False, logger=logger) prediction = make_debated_prediction(prompt=prompt, additional_information=report) diff --git a/evo_prophet/models/WebScrapeResult.py b/prediction_prophet/models/WebScrapeResult.py similarity index 100% rename from evo_prophet/models/WebScrapeResult.py rename to prediction_prophet/models/WebScrapeResult.py diff --git a/evo_prophet/models/WebSearchResult.py b/prediction_prophet/models/WebSearchResult.py similarity index 100% rename from evo_prophet/models/WebSearchResult.py rename to prediction_prophet/models/WebSearchResult.py diff --git a/pyproject.toml b/pyproject.toml index 0f3194f0..97f13021 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.poetry] -name = "evo_prophet" +name = "prediction_prophet" version = "0.1.10" description = "" authors = ["Nestor Amesty "] @@ -42,8 +42,8 @@ pyautogen = "^0.2.19" mypy = "^1.8.0" [tool.poetry.scripts] -research= "evo_prophet.main:research" -predict= "evo_prophet.main:predict" +research= "prediction_prophet.main:research" +predict= "prediction_prophet.main:predict" [build-system] requires = ["poetry-core"] diff --git a/scripts/agent_app.py b/scripts/agent_app.py index 310c4194..bdba6355 100644 --- a/scripts/agent_app.py +++ b/scripts/agent_app.py @@ -9,7 +9,7 @@ from enum import Enum from prediction_market_agent_tooling.benchmark.utils import get_markets, MarketSource from prediction_market_agent_tooling.benchmark.agents import AbstractBenchmarkedAgent -from evo_prophet.benchmark.agents import AGENTS +from prediction_prophet.benchmark.agents import AGENTS SENTINTEL = object() diff --git a/scripts/benchmark.py b/scripts/benchmark.py index 46563aee..d156da45 100644 --- a/scripts/benchmark.py +++ b/scripts/benchmark.py @@ -5,9 +5,9 @@ from prediction_market_agent_tooling.benchmark.benchmark import Benchmarker from prediction_market_agent_tooling.benchmark.utils import MarketSource, get_markets, MarketFilter, MarketSort -from evo_prophet.autonolas.research import EmbeddingModel -from evo_prophet.benchmark.agents import EvoAgent, OlasAgent, QuestionOnlyAgent -from evo_prophet.functions.cache import ENABLE_CACHE +from prediction_prophet.autonolas.research import EmbeddingModel +from prediction_prophet.benchmark.agents import PredictionProphetAgent, OlasAgent, QuestionOnlyAgent +from prediction_prophet.functions.cache import ENABLE_CACHE def main( @@ -59,31 +59,31 @@ def main( agent_name="olas_gpt-3.5-turbo-0125_openai-embeddings", embedding_model=EmbeddingModel.openai, ), - EvoAgent( + PredictionProphetAgent( model="gpt-3.5-turbo-0125", max_workers=max_workers, - agent_name="evo_gpt-3.5-turbo-0125_summary", + agent_name="prediction_prophet_gpt-3.5-turbo-0125_summary", use_summaries=True, ), - EvoAgent( + PredictionProphetAgent( model="gpt-3.5-turbo-0125", max_workers=max_workers, - agent_name="evo_gpt-3.5-turbo-0125", + agent_name="prediction_prophet_gpt-3.5-turbo-0125", ), - EvoAgent( + PredictionProphetAgent( model="gpt-3.5-turbo-0125", max_workers=max_workers, - agent_name="evo_gpt-3.5-turbo-0125_summary_tavilyrawcontent", + agent_name="prediction_prophet_gpt-3.5-turbo-0125_summary_tavilyrawcontent", use_summaries=True, use_tavily_raw_content=True, ), - EvoAgent( + PredictionProphetAgent( model="gpt-3.5-turbo-0125", max_workers=max_workers, - agent_name="evo_gpt-3.5-turbo-0125_tavilyrawcontent", + agent_name="prediction_prophet_gpt-3.5-turbo-0125_tavilyrawcontent", use_tavily_raw_content=True, ), - # EvoAgent(model="gpt-4-0125-preview", max_workers=max_workers, agent_name="evo_gpt-4-0125-preview"), # Too expensive to be enabled by default. + # PredictionProphetAgent(model="gpt-4-0125-preview", max_workers=max_workers, agent_name="prediction_prophet_gpt-4-0125-preview"), # Too expensive to be enabled by default. ], cache_path=cache_path, only_cached=only_cached, diff --git a/scripts/compare_manual_scrap_vs_tavily_raw_content.py b/scripts/compare_manual_scrap_vs_tavily_raw_content.py index 02b0c33c..c5b0e9e7 100644 --- a/scripts/compare_manual_scrap_vs_tavily_raw_content.py +++ b/scripts/compare_manual_scrap_vs_tavily_raw_content.py @@ -1,7 +1,7 @@ import streamlit as st from dotenv import load_dotenv -from evo_prophet.functions.web_search import web_search -from evo_prophet.functions.scrape_results import scrape_results +from prediction_prophet.functions.web_search import web_search +from prediction_prophet.functions.scrape_results import scrape_results load_dotenv() st.set_page_config(layout="wide") diff --git a/scripts/compare_search_results.py b/scripts/compare_search_results.py index e6cb7d88..f9a76548 100644 --- a/scripts/compare_search_results.py +++ b/scripts/compare_search_results.py @@ -7,8 +7,8 @@ from urllib.parse import urlparse from collections import defaultdict from prediction_market_agent_tooling.benchmark.utils import get_markets, MarketSource -from evo_prophet.functions.web_search import web_search -from evo_prophet.autonolas.research import safe_get_urls_from_query +from prediction_prophet.functions.web_search import web_search +from prediction_prophet.autonolas.research import safe_get_urls_from_query ENGINES: dict[str, t.Callable[[str, int], list[str]]] = { "tavily": lambda q, limit: [x.url for x in web_search(q, max_results=limit)], diff --git a/scripts/deploy.py b/scripts/deploy.py index 35cf3032..2e423410 100644 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -4,7 +4,7 @@ from git import Repo from datetime import datetime from prediction_market_agent_tooling.markets.markets import MarketType -from evo_prophet.deployment.models import DeployableAgentER, DeployableAgentER_EvoGPT3, DeployableAgentER_OlasEmbeddingOA +from prediction_prophet.deployment.models import DeployableAgentER, DeployableAgentER_PredictionProphetGPT3, DeployableAgentER_OlasEmbeddingOA from prediction_market_agent_tooling.config import APIKeys from prediction_market_agent_tooling.gtypes import private_key_type, DatetimeWithTimezone from prediction_market_agent_tooling.tools.web3_utils import verify_address @@ -12,7 +12,7 @@ DEPLOYABLE_AGENTS = [ - DeployableAgentER_EvoGPT3, + DeployableAgentER_PredictionProphetGPT3, DeployableAgentER_OlasEmbeddingOA ] @@ -40,7 +40,7 @@ def deploy( chosen_agent_class: t.Type[DeployableAgentER] = [agent for agent in DEPLOYABLE_AGENTS if agent.__name__ == deployable_agent_name][0] chosen_agent_class().deploy_gcp( - repository=f"git+https://github.com/polywrap/evo.prophet.git@{Repo('.').active_branch.name}", + repository=f"git+https://github.com/polywrap/predictionprophet.git@{Repo('.').active_branch.name}", market_type=market_type, api_keys=APIKeys( BET_FROM_ADDRESS=verify_address(bet_from_address), diff --git a/scripts/measure_memory.py b/scripts/measure_memory.py index 6ab87a5d..fdde575f 100644 --- a/scripts/measure_memory.py +++ b/scripts/measure_memory.py @@ -1,6 +1,6 @@ import time import typer -from evo_prophet.benchmark.agents import AGENTS +from prediction_prophet.benchmark.agents import AGENTS def main(sleep: int = 120) -> None: diff --git a/tests/test_benchmark.py b/tests/test_benchmark.py index 22b83d1a..397ab7cc 100644 --- a/tests/test_benchmark.py +++ b/tests/test_benchmark.py @@ -1,8 +1,8 @@ import json import prediction_market_agent_tooling.benchmark.benchmark as bm -from evo_prophet.autonolas.research import clean_completion_json -from evo_prophet.benchmark.agents import completion_prediction_json_to_pydantic_model +from prediction_prophet.autonolas.research import clean_completion_json +from prediction_prophet.benchmark.agents import completion_prediction_json_to_pydantic_model def test_parse_result_str_to_json() -> None: diff --git a/tests/test_evaluate_question.py b/tests/test_evaluate_question.py index 87ec8c66..cfefe6f6 100644 --- a/tests/test_evaluate_question.py +++ b/tests/test_evaluate_question.py @@ -1,5 +1,5 @@ import pytest -from evo_prophet.functions.evaluate_question import is_predictable +from prediction_prophet.functions.evaluate_question import is_predictable @pytest.mark.parametrize("question, answerable", [