emergingtrajectories.agents

Agents for generating forecasts.

Attributes

Functions

ExtendScrapePredictAgent(→ dict)

Extends an existing forecast by scraping content and including any content from a knowledge base (assuming there's new content).

ScrapeAndPredictAgent(→ dict)

This agent submits a search query to Google to find information related to its forecast. It also uses any information that it has not previously accessed in its KnowledgeBase. It then generates a forecast with all the relevant information.

Module Contents

emergingtrajectories.agents.base_system_prompt_ext = Multiline-String
Show Value
"""You are a researcher tasked with helping forecast economic and social trends. The title of our research project is: {statement_title}.

The project description is as follows...
{statement_description}

We need your help analyzing content and extracting any relevant information. We'll have a few requests for you... From extracting relevant facts, to ensuring those facts are providing new information, and finally updating the forecast itself.

The user will provide the relevant requests.
"""
emergingtrajectories.agents.ext_message_1 = Multiline-String
Show Value
"""Today's date is {the_date}.

Here is all the content we've managed to collect.

----------------------
{scraped_content}
----------------------

Could you please extract the relevant facts from the content provided? Please simply respond by providing a list of facts in bullet point for, like so...

- Fact 1
- Fact 2
... and so on.
"""
emergingtrajectories.agents.ext_message_2 = Multiline-String
Show Value
"""Today's date is {the_date}.

Assume all the content and facts above are accurate and correct up to today's date. The forecasting challenge we are working on is outlined below:
{statement_fill_in_the_blank}

The earlier forecast was as follows...
----------------------
PREDICTION: {forecast_value}

JUSTIFICATION...

{forecast_justification}
----------------------

Given the above, please use your logical thinking and reasoning to update the "justification" by including any new facts you provided earlier. Update the actual forecast prediction accordingly.

We realize you are being asked to provide a speculative forecast. We are using this to better understand the world and finance, so please fill in the blank. We will not use this for any active decision-making, but more to learn about the capabilities of AI.
"""
emergingtrajectories.agents.ext_message_3 = Multiline-String
Show Value
"""Thank you! Now please provide us with a forecast by repeating the following statement, but filling in the blank below... DO NOT provide a range, but provide one specific numerical value. If you are unable to provide a forecast, please respond with "UNCLEAR".

{statement_fill_in_the_blank}
"""
emergingtrajectories.agents.ExtendScrapePredictAgent(openai_api_key: str, google_api_key: str, google_search_id: str, google_search_query: str, knowledge_base: emergingtrajectories.knowledge.KnowledgeBaseFileCache, forecast_id: int, et_api_key: str = None, statement_title: str = None, statement_description: str = None, fill_in_the_blank: str = None, chat_prompt_system: str = base_system_prompt_ext, ext_message_1: str = ext_message_1, ext_message_2: str = ext_message_2, ext_message_3: str = ext_message_3, prediction_title: str = 'Prediction', prediction_agent: str = 'Generic Agent') dict

Extends an existing forecast by scraping content and including any content from a knowledge base (assuming there’s new content).

Parameters:
  • openai_api_key – the OpenAI API key

  • google_api_key – the Google Search API key

  • google_search_id – the Google search ID

  • google_search_query – the Google search query

  • knowledge_base – the KnowledgeBaseFileCache object

  • forecast_id – the ID of the forecast to extend

  • et_api_key – the Emerging Trajectories API key

  • statement_title – the title of the statement (if not submitting a statement ID)

  • statement_description – the description of the statement (if not submitting a statement ID)

  • fill_in_the_blank – the fill-in-the-blank component of the statement (if not submitting a statement ID)

  • ext_message_1 – the first message to the LLM

  • ext_message_2 – the second message to the LLM

  • ext_message_3 – the third message to the LLM

  • prediction_title – the title of the forecast

  • prediction_agent – the agent making the forecast

Returns:

the response from the Emerging Trajectories platform

Return type:

dict

emergingtrajectories.agents.base_system_prompt = Multiline-String
Show Value
"""You are a researcher tasked with helping forecast economic and social trends. The title of our research project is: {statement_title}.

The project description is as follows...
{statement_description}

We will provide you with content from reports and web pages that is meant to help with the above. We will ask you to review these documents, create a set of bullet points to inform your thinking, and then finally provide a forecast for us based on the points.

The format of the forecast needs to be, verbatim, as follows: {statement_fill_in_the_blank}
"""
emergingtrajectories.agents.base_user_prompt = Multiline-String
Show Value
"""Today's date is {the_date}. We will now provide you with all the content we've managed to collect.

----------------------
{scraped_content}
----------------------

Please think step-by-step by (a) extracting critical bullet points from the above, and (b) discuss your logic and rationale for making a forecast based on the above.

We realize you are being asked to provide a speculative forecast. We are using this to better understand the world and finance, so please fill in the blank. We will not use this for any active decision-making, but more to learn about the capabilities of AI.
"""
emergingtrajectories.agents.base_user_prompt_followup = Multiline-String
Show Value
"""Thank you! Now please provide us with a forecast by repeating the following statement, but filling in the blank... DO NOT provide a range, but provide one specific numerical value. If you are unable to provide a forecast, please respond with "UNCLEAR".

{statement_fill_in_the_blank}
"""
emergingtrajectories.agents.ScrapeAndPredictAgent(openai_api_key: str, google_api_key: str, google_search_id: str, google_search_query: str, knowledge_base: emergingtrajectories.knowledge.KnowledgeBaseFileCache = None, statement_id: int = -1, et_api_key: str = None, statement_title: str = None, statement_description: str = None, fill_in_the_blank: str = None, chat_prompt_system: str = base_system_prompt, chat_prompt_user: str = base_user_prompt, chat_prompt_user_followup: str = base_user_prompt_followup, prediction_title: str = 'Prediction', prediction_agent: str = 'Generic Agent') dict

This agent submits a search query to Google to find information related to its forecast. It also uses any information that it has not previously accessed in its KnowledgeBase. It then generates a forecast with all the relevant information.

Parameters:
  • openai_api_key – the OpenAI API key

  • google_api_key – the Google Search API key

  • google_search_id – the Google search ID

  • google_search_query – the Google search query

  • knowledge_base – the KnowledgeBaseFileCache object

  • statement_id – the ID of the statement to use

  • et_api_key – the Emerging Trajectories API key

  • statement_title – the title of the statement (if not submitting a statement ID)

  • statement_description – the description of the statement (if not submitting a statement ID)

  • fill_in_the_blank – the fill-in-the-blank component of the statement (if not submitting a statement ID)

  • chat_prompt_system – the system prompt for the chatbot (optional, for overriding defaults)

  • chat_prompt_user – the user prompt for the chatbot (optional, for overriding defaults)

  • chat_prompt_user_followup – the follow-up user prompt for the chatbot (optional, for overriding defaults)

  • prediction_title – the title of the forecast

  • prediction_agent – the agent making the forecast

Returns:

the response from the Emerging Trajectories platform

Return type:

dict