Online Research

Athena has the following tools to help you research information online:

1tools=[
2 Tools.SEARCH,
3 Tools.BROWSE,
4 Tools.WIKIPEDIA,
5 Tools.ENRICH_PERSON,
6 Tools.ENRICH_COMPANY
7 ]
1

Set up environment

1!pip install -U athena-intelligence
1import json
2import pandas as pd
3import os
4
5ATHENA_API_KEY = os.environ["ATHENA_API_KEY"]
6
7from athena import Model, Tools
8from athena.client import AsyncAthena
9
10athena = AsyncAthena(
11 api_key=ATHENA_API_KEY,
12)
2

Research general topics with search & browse and wikipedia tools.

Write a reasearch request and add tools you want Athena to use.

1team = "KC Chiefs"
2USER_MESSAGE_INPUT = f"""
3Who plays quarterback in {team}?
4"""
5
6message = await athena.message.submit_and_poll(
7 content=USER_MESSAGE_INPUT,
8 model=Model.GPT_4_TURBO_PREVIEW,
9 tools=[Tools.SEARCH, Tools.BROWSE, Tools.WIKIPEDIA],
10)
11
12print(message.content)
3

Research specific person or company with enrich_person and enrich_company tools.

Athena data providers APIs to gather information about individuals and companies. However, these tools might not always provide detailed information for some queries. For more consistent results, consider adding the search and browse tools as fallback options.

1person = "Patrick Mahomes"
2USER_MESSAGE_INPUT = f"""
3Answer the question below using available tools.
4
5Who is {person}?
6"""
7
8message = await athena.message.submit_and_poll(
9 content=USER_MESSAGE_INPUT,
10 model=Model.GPT_4_TURBO_PREVIEW,
11 tools=[ Tools.ENRICH_PERSON, Tools. ENRICH_COMPANY, Tools.SEARCH, Tools.BROWSE],
12)
13
14print(message.content)

Specifying tool order

You can tell Athena which tools to use first by simply passing the request in the input message:

1team = "KC Chiefs"
2USER_MESSAGE_INPUT = f"""
3Answer the question below using available tools.
4Use the tools in the following order:
51. Wikipedia
62. Enrich tools
73. Search and Browse - only use if Wikipedia didn't return results.
8
9Who plays quarterback in {team}?
10"""
11
12message = await athena.message.submit_and_poll(
13 content=USER_MESSAGE_INPUT,
14 model=Model.GPT_4_TURBO_PREVIEW,
15 tools=[Tools.SEARCH, Tools.BROWSE, Tools.WIKIPEDIA, Tools.ENRICH_PERSON, Tools. ENRICH_COMPANY],
16)
17
18print(message.content)