The Art of Prompt Design

Retrevial Augmented Generation (RAG)

In this notebook we create an example of a simple chatbot that searches the web in order to respond.
This is only meant as an example, and is not meant to be a state-of-the-art chatbot. (and this notebook is a work in progress)
[1]:
%load_ext autoreload
%autoreload 2
import guidance
from guidance import models, gen, select, substring, string, prefix_tree, regex, user, assistant, system
[2]:
llama2 = models.LlamaCpp("/home/marcotcr_google_com/work/models/llama-2-13b-chat.Q6_K.gguf", n_gpu_layers=-1, n_ctx=4096)
[2]:
llama2 = models.OpenAI("gpt-3.5-turbo")

Code for calling a search engine (Bing)

You need to set up a bing api project (it’s free), and change the api_key file path below

[3]:
import os
import diskcache
import pathlib
import requests
import html
from urllib.parse import urlparse
import urllib.parse
import io
import html
import html.parser

curr_dir = './'
_bing_cache = diskcache.Cache(f"{curr_dir}/../bing.diskcache")

with open(os.path.expanduser('/home/scottlundberg_google_com/.bing_api_key'), 'r') as file:
    subscription_key = file.read().replace('\n', '')

class MLStripper(html.parser.HTMLParser):
    def __init__(self):
        super().__init__()
        self.reset()
        self.strict = False
        self.convert_charrefs = True
        self.text = io.StringIO()
    def handle_data(self, d):
        self.text.write(d)
    def get_data(self):
        return self.text.getvalue()

def strip_tags(html):
    s = MLStripper()
    s.feed(html)
    return s.get_data()

def bing_search(search_terms, count=10):
    if type(search_terms) == str:
        search_terms = [search_terms]
    search_url = "https://api.bing.microsoft.com/v7.0/search"

    headers = {"Ocp-Apim-Subscription-Key": subscription_key}
    search_results = []
    for search_term in search_terms:
        params = {"q": search_term, "textDecorations": True, "textFormat": "HTML", "cout": count}
        params_key = search_term + "-___-" + str(count)
        if params_key not in _bing_cache or "webPages" not in _bing_cache[params_key]:
            response = requests.get(search_url, headers=headers, params=params)
            response.raise_for_status()
            _bing_cache[params_key] = response.json()
        data = _bing_cache[params_key]["webPages"]["value"]
        for r in data:
            r["snippet_text"] = strip_tags(r["snippet"])
        search_results.extend(data)
    return search_results
def top_snippets(query, n=3):
    results = bing_search(query, count=n)[:n]
    return [{'title': x['name'], 'snippet': x['snippet_text']} for x in results]
[4]:
def format_snippets(snippets, start=1):
    ret = ''
    for i, s in enumerate(snippets, start=start):
        title = s['title']
        snippet = s['snippet']
        ret += f'[{i}] {title}\n'
        ret += f'{snippet}\n\n'
    return ret

print(format_snippets(top_snippets('current us president')))
[1] President of the United States - Wikipedia
The president of the United States ( POTUS) [A] is the head of state and head of government of the United States of America. The president directs the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces . The power of the presidency has grown substantially [11] since the first president ...

[2] Joe Biden: The President | The White House
Joe Biden The President Download Official Portrait President Biden represented Delaware for 36 years in the U.S. Senate before becoming the 47th Vice President of the United States. As...

[3] Presidents, vice presidents, and first ladies | USAGov
U.S. facts and figures Presidents, vice presidents, and first ladies Presidents, vice presidents, and first ladies Learn about the duties of president, vice president, and first lady of the United States. Find out how to contact and learn more about current and past leaders. President of the United States Vice president of the United States


Guidance code

[5]:
from guidance import gen, select, silent, capture, Tool, one_or_more, any_char, commit_point
import collections
First, let’s write an initial prompt with some few-shot examples of REACT.
This prompt is trying to get the model to: 1. Search the web to find answers to questions 2. Read snippets, extract quotes that are relevant (to minimize hallucination) 3. Do extra searches if need 4. Print all of the quotes it gathered (from all search queries) 5. Answer
[6]:
@guidance
def init_system(lm):
    # silent makes this whole thing not appear in the jupyter notebook visualization
    with silent():
        with system():
            lm += '''\
            You are a nice chatbot that answers users' queries. Whenever you get a question, you run a loop of [Thought, Act, Observation] until you hit a response, where Act is one of (search, respond, extract_quotes, list_quotes).
            You have a storehouse of facts, but you *always* search if you need information that depends on current events, since what you know may be out-of-date.
            After searching, if you find information in the snippets, you should extract quotes.
            If you need, you can make multiple searches.
            You should only ask the user for more information is their question is ambiguous.
            If the snippets are ambiguous or don't contain enough information, you should make additional searches instead of asking the user.
            Here are some example interactions:
            ---
            User: Who is the current president of the US?
            Thought: Since the president may have changed, my information may be out of date. Thus, I need to search the web for this.
            Act: search(current US president)
            Observation:
            [1] Joe Biden: The President | The White House
            Joe Biden The President House — with thousands of train rides in between Download Official Portrait President Biden represented Delaware for 36 years in the U.S. Senate before becoming the...

            [2] President of the United States - Wikipedia
            The president of the United States ( POTUS) [A] is the head of state and head of government of the United States. The president directs the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces . The power of the presidency has grown substantially [11] since the first president, George ...

            [3] List of presidents of the United States - Wikipedia
            Grover Cleveland served two non-consecutive terms and is therefore counted as the 22nd and 24th president of the United States, giving rise to the discrepancy between the number of presidencies and the number of persons who have served as president. [5] The incumbent president is Joe Biden. [6]

            Thought: Snippets [1] and [3] clearly indicate that Joe Biden is the current president.
            Act: extract_quotes()
            Question: Who is the current president of the US?
            Relevant quotes from the snippets:
            - Snippet 1: "Joe Biden: The President | White House"
            - Snippet 3: "The incumbent president is Joe Biden"
            Thought: I have enough information to respond, so I will list the quotes and then respond.
            Act: list_quotes()
            Question: Who is the current president of the US?
            Query: current US president
            - Snippet 1: "Joe Biden: The President | White House"
            - Snippet 3: "The incumbent president is Joe Biden"
            Thought: I will write a response now.
            Act: respond(The current president of the US is Joe Biden)
            ---
            User: What is the capital of France?
            Thought: It is really unlikely that the capital of France changed since my database was last updated. So, I don't need to search the web, and can respond.
            Act: respond(The capital of France is Paris)
            ---
            User: What is the capital of Georgia?
            Thought: The user can be asking about Georgia the country or Georgia the state. I should confirm which one before issuing a final response
            Act: respond(Do you mean the state or the country?)
            Observation:
            User: The state
            Thought: The capital of Georgia probably didn't change since my database was last updated, so I can respond.
            Act: respond(The capital of Georgia is Atlanta)
            ---
            User: Who is richer, Messi or Ronaldinho Gaucho?
            Thought: To answer this, I will need to search for each of their net worths, and then compare.
            Act: search(Ronaldinho Gaucho net worth)
            Observation:
            [1] Ronaldinho's Net Worth (Updated 2023) | Wealthy Gorilla
            Introduction As of September 2023, Ronaldinho’s net worth is estimated to be roughly $90 Million. Ronaldo de Assis Moreira, better known as Ronaldinho, is a Brazilian former professional footballer and ambassador for Barcelona. from Porto Alegre. He is regarded to be one of the best football players of all time. Early Life

            [2] Ronaldinho Net Worth | Celebrity Net Worth
            Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million. Ronaldinho was once considered to be the best soccer player in the world. He was twice the...

            [3] Ronaldinho Net Worth: 2022, Career, House, Cars & Lifestyle - Players Bio
            A Brazilian legend, Ronaldinho has an outstanding net worth of $90 million. Even at his time, this sum was as impressive as it is now. Ronaldinho is $90 million rich because of football. But let me stop you right there. It’s not in everybody’s forte to excel as the Brazilian did.

            Thought: All snippets seem to talk about his net worth.
            Act: extract_quotes()
            Question: Who is richer, Messi or Ronaldinho Gaucho?
            Relevant quotes from the snippets:
            - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million"
            - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million."
            - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million"
            Thought: I still need to search for Messi's net worth and compare
            Act: search(messi net worth)
            Observation:
            [1] Lionel Messi - Forbes
            $130M 2023 The World's Highest-Paid Athletes Earnings as of 5/16/23 Photo by Antonio Borga/Eurasia Sport Images/Getty Images About Lionel Messi Messi claimed the Ballon d'Or as the world's best...

            [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider
            CHANDAN KHANNA/Getty Images Messi took home a mind-boggling $65 million in on-field earnings over the last year — more than all but one soccer player on the planet. His Inter Miami salary alone is worth $20,446,667 annually, per AP News, which means he earns roughly $393,000 per week or $56,000 per day from the Major League Soccer club.

            [3] Lionel Messi Net Worth
            $600 Million Salary: $75 Million Date of Birth: Jun 24, 1987 (36 years old) Place of Birth: Rosario, Argentina Gender: Male Height: 5 ft 6 in (1.69 m) Profession: Football player Nationality:...

            Thought: Snippet 1 says $130M, but it may be referring to other athletes based on the rest of the snippet.
            Snippets 2 and 3 talk about his salary (with contradictory numbers), but not his net worth. Thus, there are no relevant quotes here, and I should make another search.
            I will make the search narrower using quotes.
            Act: search(messi "net worth")
            Observation:
            [1] Lionel Messi - Forbes
            About Lionel Messi. Messi claimed the Ballon d'Or as the world's best soccer player for a record seventh time in 2021, putting him two ahead of his rival Cristiano Ronaldo. He transferred to Paris ...

            [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider
            His net worth is an eye-watering $600 million. Leo Messi of Paris Saint-Germain looks on during warmup before the Ligue 1 Uber Eats match between Paris Saint Germain and ESTAC Troyes at Parc des Princes on May 08, 2022 in Paris, France. Photo by Aurelien Meunier - PSG/PSG via Getty Images That's according to Celebrity Net Worth. Advertisement

            [3] Lionel Messi's new $650,000 Bentley shows of his massive net worth
            In 2023, Messi's net worth is a staggering $620 million, securing his place as the third-highest-paid athlete globally. A recent addition to Messi's extravagant lifestyle is a sleek Bentley...

            Thought: Snippets 2 and 3 list his net worth.
            Act: extract_quotes()
            Question: Who is richer, Messi or Ronaldinho Gaucho?
            Relevant quotes from the snippets:
            - Snippet 2: "His net worth is an eye-watering $600 million"
            - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million"
            Thought: I have all the information I need to respond, so I'll list the quotes and then respond.
            Act: list_quotes()
            Question: Who is richer, Messi or Ronaldinho Gaucho?
            Query: Ronaldinho Gaucho net worth
            - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million"
            - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million."
            - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million"
            Query: messi "net worth"
            - Snippet 2: "His net worth is an eye-watering $600 million"
            - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million"
            Thought: I will write a response now.
            Act: respond(Messi has an estimated net worth between $600 and $620 million, while Ronaldinho has an estimated net worth of $90 million. Thus, Messi is richer)
            '''
    return lm

Now let’s define the functions that search and extract quotes:

[7]:
@guidance
def search(lm, query):
    # Setting this for later use
    lm = lm.set('query', query)
    # This is where search actually gets called
    lm = lm.set('snippets', format_snippets(top_snippets(query)))
    lm += '\nObservation:\n' + lm['snippets']
    return lm

@guidance
def extract_quotes(lm):
    query = lm['query']
    snippets = lm['snippets'].split('\n\n')[:-1]
    snippet_substrings = [substring(x) for x in snippets]
    # By default we have 3 snippets. The model can pick (1) which snippets it's going to quote, and then (2) a substring of that snippet
    snippet = '- Snippet ' + select([
        '1: "' + snippet_substrings[0] + '"',
        '2: "' + snippet_substrings[1] + '"',
        '3: "' + snippet_substrings[2] + '"',]) + '\n'
    # We can do one or more quotes
    lm += capture(one_or_more(snippet), name='temp_gen')
    # We save all of the quotes so that we can print them at the end
    current_quotes = lm.get('current_quotes', '')
    current_quotes += f'''Query: {query}\n{lm['temp_gen']}'''
    lm = lm.set('current_quotes', current_quotes)
    return lm

Here is an example of search, and how it adds snippets to an lm:

[8]:
lm = llama2 + search('current use president')
Observation:
[1] President of the United States - Wikipedia
t. e. The president of the United States ( POTUS) [A] is the head of state and head of government of the United States of America. The president directs the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces . The power of the presidency has grown substantially [11] since the first ...

[2] list of presidents of the United States - Encyclopedia Britannica
As the head of the government of the United States, the president is arguably the most powerful government official in the world. The president is elected to a four-year term via an electoral college system. Since the Twenty-second Amendment was adopted in 1951, the American presidency has been

[3] Presidents, vice presidents, and first ladies | USAGov
U.S. facts and figures Presidents, vice presidents, and first ladies Presidents, vice presidents, and first ladies Learn about the duties of president, vice president, and first lady of the United States. Find out how to contact and learn more about current and past leaders. President of the United States Vice president of the United States

And here is an example of extract_quotes:

[9]:
lm + 'Now I will extract quotes relevant to the question "What does the president do?"\n'+  extract_quotes()
Observation:
[1] President of the United States - Wikipedia
t. e. The president of the United States ( POTUS) [A] is the head of state and head of government of the United States of America. The president directs the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces . The power of the presidency has grown substantially [11] since the first ...

[2] list of presidents of the United States - Encyclopedia Britannica
As the head of the government of the United States, the president is arguably the most powerful government official in the world. The president is elected to a four-year term via an electoral college system. Since the Twenty-second Amendment was adopted in 1951, the American presidency has been

[3] Presidents, vice presidents, and first ladies | USAGov
U.S. facts and figures Presidents, vice presidents, and first ladies Presidents, vice presidents, and first ladies Learn about the duties of president, vice president, and first lady of the United States. Find out how to contact and learn more about current and past leaders. President of the United States Vice president of the United States

Now I will extract quotes relevant to the question "What does the president do?"
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[9], line 1
----> 1 lm + 'Now I will extract quotes relevant to the question "What does the president do?"\n'+  extract_quotes()

File ~/projects/guidance/guidance/models/_model.py:300, in Model.__add__(self, value)
    296     out = lm._run_stateless(value)
    298 # run stateful functions
    299 else:
--> 300     out = value(lm)
    301     if out is None:
    302         raise Exception(f"A guidance function did not return a model object! Did you forget to return the new lm at the end of your function?")

File ~/projects/guidance/guidance/_grammar.py:45, in StatefulFunction.__call__(self, model)
     44 def __call__(self, model):
---> 45     return self.f(model, *self.args, **self.kwargs)

Cell In[7], line 21, in extract_quotes(lm)
     16 snippet = '- Snippet ' + select([
     17     '1: "' + snippet_substrings[0] + '"',
     18     '2: "' + snippet_substrings[1] + '"',
     19     '3: "' + snippet_substrings[2] + '"',]) + '\n'
     20 # We can do one or more quotes
---> 21 lm += capture(one_or_more(snippet), name='temp_gen')
     22 # We save all of the quotes so that we can print them at the end
     23 current_quotes = lm.get('current_quotes', '')

File ~/projects/guidance/guidance/models/_model.py:296, in Model.__add__(self, value)
    294 # run stateless functions (grammar nodes)
    295 elif isinstance(value, StatelessFunction):
--> 296     out = lm._run_stateless(value)
    298 # run stateful functions
    299 else:
    300     out = value(lm)

File ~/projects/guidance/guidance/models/_model.py:459, in Model._run_stateless(lm, stateless_function, temperature, top_p, n)
    457 delayed_bytes = b""
    458 # last_is_generated = False
--> 459 for new_bytes, is_generated, new_bytes_prob, capture_groups, capture_group_log_probs, new_token_count in gen_obj:
    460
    461     # we make everything full probability if we are not computing uncertainty
    462     if not lm.compute_log_probs:
    463         new_bytes_prob = 1.0

File ~/projects/guidance/guidance/models/_model.py:778, in Model.__call__(self, grammar, max_tokens, n, top_p, temperature, ensure_bos_token)
    776 grammar_temp = parser.next_byte_temperature()
    777 current_temp = grammar_temp if grammar_temp >= 0 else temperature # we prefer to use the grammar temp when it is specified
--> 778 logits = self._get_logits(token_ids, parser.bytes[start_pos:forced_pos], current_temp)
    780 # if requested we compute the log probabilities so we can track the probabilities of each node
    781 if self.compute_log_probs:

File ~/projects/guidance/guidance/models/_remote.py:250, in Remote._get_logits(self, token_ids, forced_bytes, current_temp)
    248 new_bytes = self._shared_state["data_queue"].get_nowait()
    249 if isinstance(new_bytes, Exception):
--> 250     raise new_bytes
    252 # if we are at the end of the generation then we try again allowing for early token stopping
    253 if len(new_bytes) == 0:

File ~/projects/guidance/guidance/models/_remote.py:106, in Remote._start_generator_stream(self, generator)
    104 first_iteration = True
    105 try:
--> 106     for chunk in generator:
    107         logger.debug(f"Got chunk: " + str(chunk))
    108         if len(chunk) > 0:

File ~/projects/guidance/guidance/models/_openai.py:165, in OAIChatMixin._generator(self, prompt, temperature)
    162 # Add nice exception if no role tags were used in the prompt.
    163 # TODO: Move this somewhere more general for all chat models?
    164 if messages == []:
--> 165     raise ValueError(f"The OpenAI model {self.model_name} is a Chat-based model and requires role tags in the prompt! \
    166     Make sure you are using guidance context managers like `with system():`, `with user():` and `with assistant():` \
    167     to appropriately format your guidance program for this type of model.")
    169 # update our shared data state
    170 self._reset_shared_data(prompt[:pos], temperature)

ValueError: The OpenAI model gpt-3.5-turbo is a Chat-based model and requires role tags in the prompt!             Make sure you are using guidance context managers like `with system():`, `with user():` and `with assistant():`             to appropriately format your guidance program for this type of model.

Now let’s write functions to start / restart the chat, and to do the react loop:

[16]:
@guidance
def chat_search(lm, query):
    with user():
        lm += f'User: {query}'
        lm = lm.set('user_query', query)
    with assistant():
        lm += react_loop()
    return lm

@guidance
def react_loop(lm):
    while True:
        lm += 'Thought: ' + gen('thought', list_append=True, stop='Act:')
        lm += 'Act: ' + select(['search', 'respond', 'extract_quotes', 'list_quotes'], name='action')
        action = lm['action']
        if action == 'search':
            # generate the search query
            lm += f'''({gen(name='arg', stop=')')})\n'''
            # search the web and paste result into the prompt
            lm += search(lm['arg'])
        if action == 'respond':
            # generate the response and stop the loop
            lm += f'''({gen(name='arg', stop=')')})\n'''
            break
        if action == 'extract_quotes':
            lm += '()\n'
            lm += 'Question: ' + lm['user_query'] + '\n'
            lm += 'Relevant quotes from the snippets:\n'
            lm += extract_quotes()
        if action == 'list_quotes':
            lm += '()\n'
            lm += 'Question: ' + lm['user_query'] + '\n'
            # Just paste all of the quotes we gathered throughout the loop
            lm += lm['current_quotes']
    return lm
[17]:
# Pre-load the prompt and system message so we can reuse this
search_lm = llama2 + init_system()
system
ˇ
You are a nice chatbot that answers users' queries. Whenever you get a question, you run a loop of [Thought, Act, Observation] until you hit a response, where Act is one of (search, respond, extract_quotes, list_quotes). You have a storehouse of facts, but you *always* search if you need information that depends on current events, since what you know may be out-of-date. After searching, if you find information in the snippets, you should extract quotes. If you need, you can make multiple searches. You should only ask the user for more information is their question is ambiguous. If the snippets are ambiguous or don't contain enough information, you should make additional searches instead of asking the user. Here are some example interactions: --- User: Who is the current president of the US? Thought: Since the president may have changed, my information may be out of date. Thus, I need to search the web for this. Act: search(current US president) Observation: [1] Joe Biden: The President | The White House Joe Biden The President House — with thousands of train rides in between Download Official Portrait President Biden represented Delaware for 36 years in the U.S. Senate before becoming the... [2] President of the United States - Wikipedia The president of the United States ( POTUS) [A] is the head of state and head of government of the United States. The president directs the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces . The power of the presidency has grown substantially [11] since the first president, George ... [3] List of presidents of the United States - Wikipedia Grover Cleveland served two non-consecutive terms and is therefore counted as the 22nd and 24th president of the United States, giving rise to the discrepancy between the number of presidencies and the number of persons who have served as president. [5] The incumbent president is Joe Biden. [6] Thought: Snippets [1] and [3] clearly indicate that Joe Biden is the current president. Act: extract_quotes() Question: Who is the current president of the US? Relevant quotes from the snippets: - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I have enough information to respond, so I will list the quotes and then respond. Act: list_quotes() Question: Who is the current president of the US? Query: current US president - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I will write a response now. Act: respond(The current president of the US is Joe Biden) --- User: What is the capital of France? Thought: It is really unlikely that the capital of France changed since my database was last updated. So, I don't need to search the web, and can respond. Act: respond(The capital of France is Paris) --- User: What is the capital of Georgia? Thought: The user can be asking about Georgia the country or Georgia the state. I should confirm which one before issuing a final response Act: respond(Do you mean the state or the country?) Observation: User: The state Thought: The capital of Georgia probably didn't change since my database was last updated, so I can respond. Act: respond(The capital of Georgia is Atlanta) --- User: Who is richer, Messi or Ronaldinho Gaucho? Thought: To answer this, I will need to search for each of their net worths, and then compare. Act: search(Ronaldinho Gaucho net worth) Observation: [1] Ronaldinho's Net Worth (Updated 2023) | Wealthy Gorilla Introduction As of September 2023, Ronaldinho’s net worth is estimated to be roughly $90 Million. Ronaldo de Assis Moreira, better known as Ronaldinho, is a Brazilian former professional footballer and ambassador for Barcelona. from Porto Alegre. He is regarded to be one of the best football players of all time. Early Life [2] Ronaldinho Net Worth | Celebrity Net Worth Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million. Ronaldinho was once considered to be the best soccer player in the world. He was twice the... [3] Ronaldinho Net Worth: 2022, Career, House, Cars & Lifestyle - Players Bio A Brazilian legend, Ronaldinho has an outstanding net worth of $90 million. Even at his time, this sum was as impressive as it is now. Ronaldinho is $90 million rich because of football. But let me stop you right there. It’s not in everybody’s forte to excel as the Brazilian did. Thought: All snippets seem to talk about his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Thought: I still need to search for Messi's net worth and compare Act: search(messi net worth) Observation: [1] Lionel Messi - Forbes $130M 2023 The World's Highest-Paid Athletes Earnings as of 5/16/23 Photo by Antonio Borga/Eurasia Sport Images/Getty Images About Lionel Messi Messi claimed the Ballon d'Or as the world's best... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider CHANDAN KHANNA/Getty Images Messi took home a mind-boggling $65 million in on-field earnings over the last year — more than all but one soccer player on the planet. His Inter Miami salary alone is worth $20,446,667 annually, per AP News, which means he earns roughly $393,000 per week or $56,000 per day from the Major League Soccer club. [3] Lionel Messi Net Worth $600 Million Salary: $75 Million Date of Birth: Jun 24, 1987 (36 years old) Place of Birth: Rosario, Argentina Gender: Male Height: 5 ft 6 in (1.69 m) Profession: Football player Nationality:... Thought: Snippet 1 says $130M, but it may be referring to other athletes based on the rest of the snippet. Snippets 2 and 3 talk about his salary (with contradictory numbers), but not his net worth. Thus, there are no relevant quotes here, and I should make another search. I will make the search narrower using quotes. Act: search(messi "net worth") Observation: [1] Lionel Messi - Forbes About Lionel Messi. Messi claimed the Ballon d'Or as the world's best soccer player for a record seventh time in 2021, putting him two ahead of his rival Cristiano Ronaldo. He transferred to Paris ... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider His net worth is an eye-watering $600 million. Leo Messi of Paris Saint-Germain looks on during warmup before the Ligue 1 Uber Eats match between Paris Saint Germain and ESTAC Troyes at Parc des Princes on May 08, 2022 in Paris, France. Photo by Aurelien Meunier - PSG/PSG via Getty Images That's according to Celebrity Net Worth. Advertisement [3] Lionel Messi's new $650,000 Bentley shows of his massive net worth In 2023, Messi's net worth is a staggering $620 million, securing his place as the third-highest-paid athlete globally. A recent addition to Messi's extravagant lifestyle is a sleek Bentley... Thought: Snippets 2 and 3 list his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I have all the information I need to respond, so I'll list the quotes and then respond. Act: list_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Query: Ronaldinho Gaucho net worth - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Query: messi "net worth" - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I will write a response now. Act: respond(Messi has an estimated net worth between $600 and $620 million, while Ronaldinho has an estimated net worth of $90 million. Thus, Messi is richer)

Let’s try a few prompts:

[18]:
lm = search_lm + chat_search('Where does Sam Altman work?')
system
ˇ
You are a nice chatbot that answers users' queries. Whenever you get a question, you run a loop of [Thought, Act, Observation] until you hit a response, where Act is one of (search, respond, extract_quotes, list_quotes). You have a storehouse of facts, but you *always* search if you need information that depends on current events, since what you know may be out-of-date. After searching, if you find information in the snippets, you should extract quotes. If you need, you can make multiple searches. You should only ask the user for more information is their question is ambiguous. If the snippets are ambiguous or don't contain enough information, you should make additional searches instead of asking the user. Here are some example interactions: --- User: Who is the current president of the US? Thought: Since the president may have changed, my information may be out of date. Thus, I need to search the web for this. Act: search(current US president) Observation: [1] Joe Biden: The President | The White House Joe Biden The President House — with thousands of train rides in between Download Official Portrait President Biden represented Delaware for 36 years in the U.S. Senate before becoming the... [2] President of the United States - Wikipedia The president of the United States ( POTUS) [A] is the head of state and head of government of the United States. The president directs the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces . The power of the presidency has grown substantially [11] since the first president, George ... [3] List of presidents of the United States - Wikipedia Grover Cleveland served two non-consecutive terms and is therefore counted as the 22nd and 24th president of the United States, giving rise to the discrepancy between the number of presidencies and the number of persons who have served as president. [5] The incumbent president is Joe Biden. [6] Thought: Snippets [1] and [3] clearly indicate that Joe Biden is the current president. Act: extract_quotes() Question: Who is the current president of the US? Relevant quotes from the snippets: - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I have enough information to respond, so I will list the quotes and then respond. Act: list_quotes() Question: Who is the current president of the US? Query: current US president - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I will write a response now. Act: respond(The current president of the US is Joe Biden) --- User: What is the capital of France? Thought: It is really unlikely that the capital of France changed since my database was last updated. So, I don't need to search the web, and can respond. Act: respond(The capital of France is Paris) --- User: What is the capital of Georgia? Thought: The user can be asking about Georgia the country or Georgia the state. I should confirm which one before issuing a final response Act: respond(Do you mean the state or the country?) Observation: User: The state Thought: The capital of Georgia probably didn't change since my database was last updated, so I can respond. Act: respond(The capital of Georgia is Atlanta) --- User: Who is richer, Messi or Ronaldinho Gaucho? Thought: To answer this, I will need to search for each of their net worths, and then compare. Act: search(Ronaldinho Gaucho net worth) Observation: [1] Ronaldinho's Net Worth (Updated 2023) | Wealthy Gorilla Introduction As of September 2023, Ronaldinho’s net worth is estimated to be roughly $90 Million. Ronaldo de Assis Moreira, better known as Ronaldinho, is a Brazilian former professional footballer and ambassador for Barcelona. from Porto Alegre. He is regarded to be one of the best football players of all time. Early Life [2] Ronaldinho Net Worth | Celebrity Net Worth Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million. Ronaldinho was once considered to be the best soccer player in the world. He was twice the... [3] Ronaldinho Net Worth: 2022, Career, House, Cars & Lifestyle - Players Bio A Brazilian legend, Ronaldinho has an outstanding net worth of $90 million. Even at his time, this sum was as impressive as it is now. Ronaldinho is $90 million rich because of football. But let me stop you right there. It’s not in everybody’s forte to excel as the Brazilian did. Thought: All snippets seem to talk about his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Thought: I still need to search for Messi's net worth and compare Act: search(messi net worth) Observation: [1] Lionel Messi - Forbes $130M 2023 The World's Highest-Paid Athletes Earnings as of 5/16/23 Photo by Antonio Borga/Eurasia Sport Images/Getty Images About Lionel Messi Messi claimed the Ballon d'Or as the world's best... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider CHANDAN KHANNA/Getty Images Messi took home a mind-boggling $65 million in on-field earnings over the last year — more than all but one soccer player on the planet. His Inter Miami salary alone is worth $20,446,667 annually, per AP News, which means he earns roughly $393,000 per week or $56,000 per day from the Major League Soccer club. [3] Lionel Messi Net Worth $600 Million Salary: $75 Million Date of Birth: Jun 24, 1987 (36 years old) Place of Birth: Rosario, Argentina Gender: Male Height: 5 ft 6 in (1.69 m) Profession: Football player Nationality:... Thought: Snippet 1 says $130M, but it may be referring to other athletes based on the rest of the snippet. Snippets 2 and 3 talk about his salary (with contradictory numbers), but not his net worth. Thus, there are no relevant quotes here, and I should make another search. I will make the search narrower using quotes. Act: search(messi "net worth") Observation: [1] Lionel Messi - Forbes About Lionel Messi. Messi claimed the Ballon d'Or as the world's best soccer player for a record seventh time in 2021, putting him two ahead of his rival Cristiano Ronaldo. He transferred to Paris ... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider His net worth is an eye-watering $600 million. Leo Messi of Paris Saint-Germain looks on during warmup before the Ligue 1 Uber Eats match between Paris Saint Germain and ESTAC Troyes at Parc des Princes on May 08, 2022 in Paris, France. Photo by Aurelien Meunier - PSG/PSG via Getty Images That's according to Celebrity Net Worth. Advertisement [3] Lionel Messi's new $650,000 Bentley shows of his massive net worth In 2023, Messi's net worth is a staggering $620 million, securing his place as the third-highest-paid athlete globally. A recent addition to Messi's extravagant lifestyle is a sleek Bentley... Thought: Snippets 2 and 3 list his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I have all the information I need to respond, so I'll list the quotes and then respond. Act: list_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Query: Ronaldinho Gaucho net worth - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Query: messi "net worth" - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I will write a response now. Act: respond(Messi has an estimated net worth between $600 and $620 million, while Ronaldinho has an estimated net worth of $90 million. Thus, Messi is richer)
user
User: Where does Sam Altman work?
assistant
Thought: I need to search the web to find the most up-to-date information. Act: search(Sam Altman work) Observation: [1] A timeline of Sam Altman's firing from OpenAI - TechCrunch In a dramatic turn of events late Friday, ex-Y Combinator president Sam Altman was fired as CEO of AI startup OpenAI, the company behind viral AI hits like , and , by OpenAI’s board of... [2] Sam Altman is back at OpenAI … with a guest badge - CNN New York CNN — Sam Altman is back at OpenAI. Well… he’s back at the OpenAI headquarters in San Francisco, anyway. Whether or not he returns as CEO of the ChatGPT parent company is still up in... [3] OpenAI CEO Sam Altman lands new job at Microsoft after surprise firing Sam Altman, the former CEO of OpenAI, is to start a new venture at Microsoft, just days after being fired by the company behind ChatGPT and DALL-E. Here's a quick summary of the big shake-up in... Thought: All snippets seem to be talking about Sam Altman's departure from OpenAI. Act: extract_quotes() Question: Where does Sam Altman work? Relevant quotes from the snippets: - Snippet 1: "Sam Altman was fired as CEO of AI startup OpenAI" - Snippet 2: "Sam Altman is back at OpenAI" - Snippet 3: "Sam Altman, the former CEO of OpenAI, is to start a new venture at Microsoft" Thought: I still need to search to confirm if he is still at Microsoft. Act: search(Sam Altman Microsoft) Observation: [1] Sam Altman joins Microsoft as OpenAI taps Emmett Shear for ... - CNN Sam Altman, who was ousted as CEO of OpenAI in a chaotic boardroom coup Friday, is joining Microsoft, the tech giant said Monday. Meanwhile, Emmett Shear, the former CEO of streaming service... [2] Ousted OpenAI leader Sam Altman joins Microsoft : NPR Sam Altman, who co-founded OpenAI, the influential maker of ChatGPT, will join Microsoft to help lead a new advanced artificial intelligence team. The surprise development follows Altman's abrupt ... [3] Microsoft hires Sam Altman, new OpenAI CEO vows to investigate his ... Microsoft snapped up Sam Altman and another architect of OpenAI for a new venture after their sudden departures shocked the artificial intelligence world, leaving the newly installed CEO of... Thought: All snippet indicate that Sam Altman is now working at Microsoft. Act: respond(Sam Altman currently works at Microsoft)

We didn’t prompt the model with follow up questions, but let’s give it a shot anyway:

[19]:
lm += chat_search('Why did he leave OpenAI?')
system
ˇ
You are a nice chatbot that answers users' queries. Whenever you get a question, you run a loop of [Thought, Act, Observation] until you hit a response, where Act is one of (search, respond, extract_quotes, list_quotes). You have a storehouse of facts, but you *always* search if you need information that depends on current events, since what you know may be out-of-date. After searching, if you find information in the snippets, you should extract quotes. If you need, you can make multiple searches. You should only ask the user for more information is their question is ambiguous. If the snippets are ambiguous or don't contain enough information, you should make additional searches instead of asking the user. Here are some example interactions: --- User: Who is the current president of the US? Thought: Since the president may have changed, my information may be out of date. Thus, I need to search the web for this. Act: search(current US president) Observation: [1] Joe Biden: The President | The White House Joe Biden The President House — with thousands of train rides in between Download Official Portrait President Biden represented Delaware for 36 years in the U.S. Senate before becoming the... [2] President of the United States - Wikipedia The president of the United States ( POTUS) [A] is the head of state and head of government of the United States. The president directs the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces . The power of the presidency has grown substantially [11] since the first president, George ... [3] List of presidents of the United States - Wikipedia Grover Cleveland served two non-consecutive terms and is therefore counted as the 22nd and 24th president of the United States, giving rise to the discrepancy between the number of presidencies and the number of persons who have served as president. [5] The incumbent president is Joe Biden. [6] Thought: Snippets [1] and [3] clearly indicate that Joe Biden is the current president. Act: extract_quotes() Question: Who is the current president of the US? Relevant quotes from the snippets: - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I have enough information to respond, so I will list the quotes and then respond. Act: list_quotes() Question: Who is the current president of the US? Query: current US president - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I will write a response now. Act: respond(The current president of the US is Joe Biden) --- User: What is the capital of France? Thought: It is really unlikely that the capital of France changed since my database was last updated. So, I don't need to search the web, and can respond. Act: respond(The capital of France is Paris) --- User: What is the capital of Georgia? Thought: The user can be asking about Georgia the country or Georgia the state. I should confirm which one before issuing a final response Act: respond(Do you mean the state or the country?) Observation: User: The state Thought: The capital of Georgia probably didn't change since my database was last updated, so I can respond. Act: respond(The capital of Georgia is Atlanta) --- User: Who is richer, Messi or Ronaldinho Gaucho? Thought: To answer this, I will need to search for each of their net worths, and then compare. Act: search(Ronaldinho Gaucho net worth) Observation: [1] Ronaldinho's Net Worth (Updated 2023) | Wealthy Gorilla Introduction As of September 2023, Ronaldinho’s net worth is estimated to be roughly $90 Million. Ronaldo de Assis Moreira, better known as Ronaldinho, is a Brazilian former professional footballer and ambassador for Barcelona. from Porto Alegre. He is regarded to be one of the best football players of all time. Early Life [2] Ronaldinho Net Worth | Celebrity Net Worth Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million. Ronaldinho was once considered to be the best soccer player in the world. He was twice the... [3] Ronaldinho Net Worth: 2022, Career, House, Cars & Lifestyle - Players Bio A Brazilian legend, Ronaldinho has an outstanding net worth of $90 million. Even at his time, this sum was as impressive as it is now. Ronaldinho is $90 million rich because of football. But let me stop you right there. It’s not in everybody’s forte to excel as the Brazilian did. Thought: All snippets seem to talk about his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Thought: I still need to search for Messi's net worth and compare Act: search(messi net worth) Observation: [1] Lionel Messi - Forbes $130M 2023 The World's Highest-Paid Athletes Earnings as of 5/16/23 Photo by Antonio Borga/Eurasia Sport Images/Getty Images About Lionel Messi Messi claimed the Ballon d'Or as the world's best... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider CHANDAN KHANNA/Getty Images Messi took home a mind-boggling $65 million in on-field earnings over the last year — more than all but one soccer player on the planet. His Inter Miami salary alone is worth $20,446,667 annually, per AP News, which means he earns roughly $393,000 per week or $56,000 per day from the Major League Soccer club. [3] Lionel Messi Net Worth $600 Million Salary: $75 Million Date of Birth: Jun 24, 1987 (36 years old) Place of Birth: Rosario, Argentina Gender: Male Height: 5 ft 6 in (1.69 m) Profession: Football player Nationality:... Thought: Snippet 1 says $130M, but it may be referring to other athletes based on the rest of the snippet. Snippets 2 and 3 talk about his salary (with contradictory numbers), but not his net worth. Thus, there are no relevant quotes here, and I should make another search. I will make the search narrower using quotes. Act: search(messi "net worth") Observation: [1] Lionel Messi - Forbes About Lionel Messi. Messi claimed the Ballon d'Or as the world's best soccer player for a record seventh time in 2021, putting him two ahead of his rival Cristiano Ronaldo. He transferred to Paris ... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider His net worth is an eye-watering $600 million. Leo Messi of Paris Saint-Germain looks on during warmup before the Ligue 1 Uber Eats match between Paris Saint Germain and ESTAC Troyes at Parc des Princes on May 08, 2022 in Paris, France. Photo by Aurelien Meunier - PSG/PSG via Getty Images That's according to Celebrity Net Worth. Advertisement [3] Lionel Messi's new $650,000 Bentley shows of his massive net worth In 2023, Messi's net worth is a staggering $620 million, securing his place as the third-highest-paid athlete globally. A recent addition to Messi's extravagant lifestyle is a sleek Bentley... Thought: Snippets 2 and 3 list his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I have all the information I need to respond, so I'll list the quotes and then respond. Act: list_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Query: Ronaldinho Gaucho net worth - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Query: messi "net worth" - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I will write a response now. Act: respond(Messi has an estimated net worth between $600 and $620 million, while Ronaldinho has an estimated net worth of $90 million. Thus, Messi is richer)
user
User: Where does Sam Altman work?
assistant
Thought: I need to search the web to find the most up-to-date information. Act: search(Sam Altman work) Observation: [1] A timeline of Sam Altman's firing from OpenAI - TechCrunch In a dramatic turn of events late Friday, ex-Y Combinator president Sam Altman was fired as CEO of AI startup OpenAI, the company behind viral AI hits like , and , by OpenAI’s board of... [2] Sam Altman is back at OpenAI … with a guest badge - CNN New York CNN — Sam Altman is back at OpenAI. Well… he’s back at the OpenAI headquarters in San Francisco, anyway. Whether or not he returns as CEO of the ChatGPT parent company is still up in... [3] OpenAI CEO Sam Altman lands new job at Microsoft after surprise firing Sam Altman, the former CEO of OpenAI, is to start a new venture at Microsoft, just days after being fired by the company behind ChatGPT and DALL-E. Here's a quick summary of the big shake-up in... Thought: All snippets seem to be talking about Sam Altman's departure from OpenAI. Act: extract_quotes() Question: Where does Sam Altman work? Relevant quotes from the snippets: - Snippet 1: "Sam Altman was fired as CEO of AI startup OpenAI" - Snippet 2: "Sam Altman is back at OpenAI" - Snippet 3: "Sam Altman, the former CEO of OpenAI, is to start a new venture at Microsoft" Thought: I still need to search to confirm if he is still at Microsoft. Act: search(Sam Altman Microsoft) Observation: [1] Sam Altman joins Microsoft as OpenAI taps Emmett Shear for ... - CNN Sam Altman, who was ousted as CEO of OpenAI in a chaotic boardroom coup Friday, is joining Microsoft, the tech giant said Monday. Meanwhile, Emmett Shear, the former CEO of streaming service... [2] Ousted OpenAI leader Sam Altman joins Microsoft : NPR Sam Altman, who co-founded OpenAI, the influential maker of ChatGPT, will join Microsoft to help lead a new advanced artificial intelligence team. The surprise development follows Altman's abrupt ... [3] Microsoft hires Sam Altman, new OpenAI CEO vows to investigate his ... Microsoft snapped up Sam Altman and another architect of OpenAI for a new venture after their sudden departures shocked the artificial intelligence world, leaving the newly installed CEO of... Thought: All snippet indicate that Sam Altman is now working at Microsoft. Act: respond(Sam Altman currently works at Microsoft)
user
User: Why did he leave OpenAI?
assistant
Thought: I need to search the web to find the most up-to-date information. Act: search(Sam Altman OpenAI departure) Observation: [1] Sam Altman Departs OpenAI | TIME Sam Altman Departs OpenAI After Board Loses Confidence in Him. ... The sudden departure comes as a shock to the tech world. Altman was an OpenAI founding co-chair in 2015 along with Elon Musk. [2] OpenAI announces leadership transition November 17, 2023 Authors OpenAI Announcements Chief technology officer Mira Murati appointed interim CEO to lead OpenAI; Sam Altman departs the company. Search process underway to identify permanent successor. [3] ChatGPT parent company OpenAI fires CEO Sam Altman - CNN OpenAI, the organization behind the viral chatbot ChatGPT, announced on Friday its CEO and founder, Sam Altman, was fired and will be departing the company, effective immediately. The... Thought: All snippet indicate that Sam Altman was fired from OpenAI. Act: extract_quotes() Question: Why did he leave OpenAI? Relevant quotes from the snippets: - Snippet 1: "Sam Altman Departs OpenAI After Board Loses Confidence in Him" - Snippet 2: "OpenAI announces leadership transition" - Snippet 3: "ChatGP" Thought: I have enough information to respond, so I will list the quotes and then respond. Act: list_quotes() Question: Why did he leave OpenAI? Query: Sam Altman work - Snippet 1: "Sam Altman was fired as CEO of AI startup OpenAI" - Snippet 2: "Sam Altman is back at OpenAI" - Snippet 3: "Sam Altman, the former CEO of OpenAI, is to start a new venture at Microsoft" Query: Sam Altman OpenAI departure - Snippet 1: "Sam Altman Departs OpenAI After Board Loses Confidence in Him" - Snippet 2: "OpenAI announces leadership transition" - Snippet 3: "ChatGP" Thought: I will write a response now. Act: respond(Sam Altman was fired from OpenAI)

Let’s try a few other questions:

[21]:
query = "What new discoveries from the James Webb Space Telescope can I tell my 9 year old about?"
lm = search_lm + chat_search(query)
system
ˇ
You are a nice chatbot that answers users' queries. Whenever you get a question, you run a loop of [Thought, Act, Observation] until you hit a response, where Act is one of (search, respond, extract_quotes, list_quotes). You have a storehouse of facts, but you *always* search if you need information that depends on current events, since what you know may be out-of-date. After searching, if you find information in the snippets, you should extract quotes. If you need, you can make multiple searches. You should only ask the user for more information is their question is ambiguous. If the snippets are ambiguous or don't contain enough information, you should make additional searches instead of asking the user. Here are some example interactions: --- User: Who is the current president of the US? Thought: Since the president may have changed, my information may be out of date. Thus, I need to search the web for this. Act: search(current US president) Observation: [1] Joe Biden: The President | The White House Joe Biden The President House — with thousands of train rides in between Download Official Portrait President Biden represented Delaware for 36 years in the U.S. Senate before becoming the... [2] President of the United States - Wikipedia The president of the United States ( POTUS) [A] is the head of state and head of government of the United States. The president directs the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces . The power of the presidency has grown substantially [11] since the first president, George ... [3] List of presidents of the United States - Wikipedia Grover Cleveland served two non-consecutive terms and is therefore counted as the 22nd and 24th president of the United States, giving rise to the discrepancy between the number of presidencies and the number of persons who have served as president. [5] The incumbent president is Joe Biden. [6] Thought: Snippets [1] and [3] clearly indicate that Joe Biden is the current president. Act: extract_quotes() Question: Who is the current president of the US? Relevant quotes from the snippets: - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I have enough information to respond, so I will list the quotes and then respond. Act: list_quotes() Question: Who is the current president of the US? Query: current US president - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I will write a response now. Act: respond(The current president of the US is Joe Biden) --- User: What is the capital of France? Thought: It is really unlikely that the capital of France changed since my database was last updated. So, I don't need to search the web, and can respond. Act: respond(The capital of France is Paris) --- User: What is the capital of Georgia? Thought: The user can be asking about Georgia the country or Georgia the state. I should confirm which one before issuing a final response Act: respond(Do you mean the state or the country?) Observation: User: The state Thought: The capital of Georgia probably didn't change since my database was last updated, so I can respond. Act: respond(The capital of Georgia is Atlanta) --- User: Who is richer, Messi or Ronaldinho Gaucho? Thought: To answer this, I will need to search for each of their net worths, and then compare. Act: search(Ronaldinho Gaucho net worth) Observation: [1] Ronaldinho's Net Worth (Updated 2023) | Wealthy Gorilla Introduction As of September 2023, Ronaldinho’s net worth is estimated to be roughly $90 Million. Ronaldo de Assis Moreira, better known as Ronaldinho, is a Brazilian former professional footballer and ambassador for Barcelona. from Porto Alegre. He is regarded to be one of the best football players of all time. Early Life [2] Ronaldinho Net Worth | Celebrity Net Worth Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million. Ronaldinho was once considered to be the best soccer player in the world. He was twice the... [3] Ronaldinho Net Worth: 2022, Career, House, Cars & Lifestyle - Players Bio A Brazilian legend, Ronaldinho has an outstanding net worth of $90 million. Even at his time, this sum was as impressive as it is now. Ronaldinho is $90 million rich because of football. But let me stop you right there. It’s not in everybody’s forte to excel as the Brazilian did. Thought: All snippets seem to talk about his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Thought: I still need to search for Messi's net worth and compare Act: search(messi net worth) Observation: [1] Lionel Messi - Forbes $130M 2023 The World's Highest-Paid Athletes Earnings as of 5/16/23 Photo by Antonio Borga/Eurasia Sport Images/Getty Images About Lionel Messi Messi claimed the Ballon d'Or as the world's best... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider CHANDAN KHANNA/Getty Images Messi took home a mind-boggling $65 million in on-field earnings over the last year — more than all but one soccer player on the planet. His Inter Miami salary alone is worth $20,446,667 annually, per AP News, which means he earns roughly $393,000 per week or $56,000 per day from the Major League Soccer club. [3] Lionel Messi Net Worth $600 Million Salary: $75 Million Date of Birth: Jun 24, 1987 (36 years old) Place of Birth: Rosario, Argentina Gender: Male Height: 5 ft 6 in (1.69 m) Profession: Football player Nationality:... Thought: Snippet 1 says $130M, but it may be referring to other athletes based on the rest of the snippet. Snippets 2 and 3 talk about his salary (with contradictory numbers), but not his net worth. Thus, there are no relevant quotes here, and I should make another search. I will make the search narrower using quotes. Act: search(messi "net worth") Observation: [1] Lionel Messi - Forbes About Lionel Messi. Messi claimed the Ballon d'Or as the world's best soccer player for a record seventh time in 2021, putting him two ahead of his rival Cristiano Ronaldo. He transferred to Paris ... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider His net worth is an eye-watering $600 million. Leo Messi of Paris Saint-Germain looks on during warmup before the Ligue 1 Uber Eats match between Paris Saint Germain and ESTAC Troyes at Parc des Princes on May 08, 2022 in Paris, France. Photo by Aurelien Meunier - PSG/PSG via Getty Images That's according to Celebrity Net Worth. Advertisement [3] Lionel Messi's new $650,000 Bentley shows of his massive net worth In 2023, Messi's net worth is a staggering $620 million, securing his place as the third-highest-paid athlete globally. A recent addition to Messi's extravagant lifestyle is a sleek Bentley... Thought: Snippets 2 and 3 list his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I have all the information I need to respond, so I'll list the quotes and then respond. Act: list_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Query: Ronaldinho Gaucho net worth - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Query: messi "net worth" - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I will write a response now. Act: respond(Messi has an estimated net worth between $600 and $620 million, while Ronaldinho has an estimated net worth of $90 million. Thus, Messi is richer)
user
User: What new discoveries from the James Webb Space Telescope can I tell my 9 year old about?
assistant
Thought: The James Webb Space Telescope (JWST) is a relatively new space observatory, and as such, there may not be many new discoveries available yet. However, I can still try to find some information about its current discoveries. Act: search(jwst discoveries) Observation: [1] 12 amazing James Webb Space Telescope discoveries across the universe The James Webb Space Telescope (Webb or JWST) is a pathfinder of scientific discovery, generating incredible insights about galaxies, planets, stars and all sorts of interesting cosmic objects ... [2] James Webb Space Telescope - NASA Science The James Webb Space Telescope is a giant leap forward in our quest to understand the Universe and our origins. Webb is examining every phase of cosmic history: from the first luminous glows after the Big Bang to the formation of galaxies, stars, and planets to the evolution of our own solar system. Learn about the 4 main science themes for ... [3] James Webb telescope discovers 'Cosmic Vine' of 20 connected galaxies ... The James Webb Space Telescope has discovered a massive chain of 20 galaxies in the early universe, raising questions about the formation of the largest structures in the cosmos. Thought: The snippets mention several discoveries made by the JWST, but they do not seem to be specifically aimed at a 9-year-old audience. Act: extract_quotes() Question: What new discoveries from the James Webb Space Telescope can I tell my 9 year old about? Relevant quotes from the snippets: - Snippet 1: "12 amazing James Webb Space Telescope discoveries across the universe" - Snippet 2: "The James Webb Space Telescope is a giant leap forward in our quest to understand the Universe and our origin" - Snippet 3: "The James Webb Space Telescope has discovered a massive chain of 20 galaxies in the early universe" Thought: I have enough information to respond, so I will list the quotes and then respond. Act: list_quotes() Question: What new discoveries from the James Webb Space Telescope can I tell my 9 year old about? Query: jwst discoveries - Snippet 1: "12 amazing James Webb Space Telescope discoveries across the universe" - Snippet 2: "The James Webb Space Telescope is a giant leap forward in our quest to understand the Universe and our origin" - Snippet 3: "The James Webb Space Telescope has discovered a massive chain of 20 galaxies in the early universe" Thought: I will write a response now. Act: respond(The JWS telescope has made several recent discoveries, including a chain of 20 galaxies in the early universe, which are all fascinating and worth exploring further)
[22]:
query = "What is 2 + 5?"
lm = search_lm + chat_search(query)
system
ˇ
You are a nice chatbot that answers users' queries. Whenever you get a question, you run a loop of [Thought, Act, Observation] until you hit a response, where Act is one of (search, respond, extract_quotes, list_quotes). You have a storehouse of facts, but you *always* search if you need information that depends on current events, since what you know may be out-of-date. After searching, if you find information in the snippets, you should extract quotes. If you need, you can make multiple searches. You should only ask the user for more information is their question is ambiguous. If the snippets are ambiguous or don't contain enough information, you should make additional searches instead of asking the user. Here are some example interactions: --- User: Who is the current president of the US? Thought: Since the president may have changed, my information may be out of date. Thus, I need to search the web for this. Act: search(current US president) Observation: [1] Joe Biden: The President | The White House Joe Biden The President House — with thousands of train rides in between Download Official Portrait President Biden represented Delaware for 36 years in the U.S. Senate before becoming the... [2] President of the United States - Wikipedia The president of the United States ( POTUS) [A] is the head of state and head of government of the United States. The president directs the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces . The power of the presidency has grown substantially [11] since the first president, George ... [3] List of presidents of the United States - Wikipedia Grover Cleveland served two non-consecutive terms and is therefore counted as the 22nd and 24th president of the United States, giving rise to the discrepancy between the number of presidencies and the number of persons who have served as president. [5] The incumbent president is Joe Biden. [6] Thought: Snippets [1] and [3] clearly indicate that Joe Biden is the current president. Act: extract_quotes() Question: Who is the current president of the US? Relevant quotes from the snippets: - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I have enough information to respond, so I will list the quotes and then respond. Act: list_quotes() Question: Who is the current president of the US? Query: current US president - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I will write a response now. Act: respond(The current president of the US is Joe Biden) --- User: What is the capital of France? Thought: It is really unlikely that the capital of France changed since my database was last updated. So, I don't need to search the web, and can respond. Act: respond(The capital of France is Paris) --- User: What is the capital of Georgia? Thought: The user can be asking about Georgia the country or Georgia the state. I should confirm which one before issuing a final response Act: respond(Do you mean the state or the country?) Observation: User: The state Thought: The capital of Georgia probably didn't change since my database was last updated, so I can respond. Act: respond(The capital of Georgia is Atlanta) --- User: Who is richer, Messi or Ronaldinho Gaucho? Thought: To answer this, I will need to search for each of their net worths, and then compare. Act: search(Ronaldinho Gaucho net worth) Observation: [1] Ronaldinho's Net Worth (Updated 2023) | Wealthy Gorilla Introduction As of September 2023, Ronaldinho’s net worth is estimated to be roughly $90 Million. Ronaldo de Assis Moreira, better known as Ronaldinho, is a Brazilian former professional footballer and ambassador for Barcelona. from Porto Alegre. He is regarded to be one of the best football players of all time. Early Life [2] Ronaldinho Net Worth | Celebrity Net Worth Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million. Ronaldinho was once considered to be the best soccer player in the world. He was twice the... [3] Ronaldinho Net Worth: 2022, Career, House, Cars & Lifestyle - Players Bio A Brazilian legend, Ronaldinho has an outstanding net worth of $90 million. Even at his time, this sum was as impressive as it is now. Ronaldinho is $90 million rich because of football. But let me stop you right there. It’s not in everybody’s forte to excel as the Brazilian did. Thought: All snippets seem to talk about his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Thought: I still need to search for Messi's net worth and compare Act: search(messi net worth) Observation: [1] Lionel Messi - Forbes $130M 2023 The World's Highest-Paid Athletes Earnings as of 5/16/23 Photo by Antonio Borga/Eurasia Sport Images/Getty Images About Lionel Messi Messi claimed the Ballon d'Or as the world's best... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider CHANDAN KHANNA/Getty Images Messi took home a mind-boggling $65 million in on-field earnings over the last year — more than all but one soccer player on the planet. His Inter Miami salary alone is worth $20,446,667 annually, per AP News, which means he earns roughly $393,000 per week or $56,000 per day from the Major League Soccer club. [3] Lionel Messi Net Worth $600 Million Salary: $75 Million Date of Birth: Jun 24, 1987 (36 years old) Place of Birth: Rosario, Argentina Gender: Male Height: 5 ft 6 in (1.69 m) Profession: Football player Nationality:... Thought: Snippet 1 says $130M, but it may be referring to other athletes based on the rest of the snippet. Snippets 2 and 3 talk about his salary (with contradictory numbers), but not his net worth. Thus, there are no relevant quotes here, and I should make another search. I will make the search narrower using quotes. Act: search(messi "net worth") Observation: [1] Lionel Messi - Forbes About Lionel Messi. Messi claimed the Ballon d'Or as the world's best soccer player for a record seventh time in 2021, putting him two ahead of his rival Cristiano Ronaldo. He transferred to Paris ... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider His net worth is an eye-watering $600 million. Leo Messi of Paris Saint-Germain looks on during warmup before the Ligue 1 Uber Eats match between Paris Saint Germain and ESTAC Troyes at Parc des Princes on May 08, 2022 in Paris, France. Photo by Aurelien Meunier - PSG/PSG via Getty Images That's according to Celebrity Net Worth. Advertisement [3] Lionel Messi's new $650,000 Bentley shows of his massive net worth In 2023, Messi's net worth is a staggering $620 million, securing his place as the third-highest-paid athlete globally. A recent addition to Messi's extravagant lifestyle is a sleek Bentley... Thought: Snippets 2 and 3 list his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I have all the information I need to respond, so I'll list the quotes and then respond. Act: list_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Query: Ronaldinho Gaucho net worth - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Query: messi "net worth" - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I will write a response now. Act: respond(Messi has an estimated net worth between $600 and $620 million, while Ronaldinho has an estimated net worth of $90 million. Thus, Messi is richer)
user
User: What is 2 + 5?
assistant
Thought: This is a simple arithmetic question, so I don't need to search the web. I can respond directly. Act: respond(2 + 5 is equal to 7)
[23]:
query = "What is the capital of Brazil?"
lm = search_lm + chat_search(query)
system
ˇ
You are a nice chatbot that answers users' queries. Whenever you get a question, you run a loop of [Thought, Act, Observation] until you hit a response, where Act is one of (search, respond, extract_quotes, list_quotes). You have a storehouse of facts, but you *always* search if you need information that depends on current events, since what you know may be out-of-date. After searching, if you find information in the snippets, you should extract quotes. If you need, you can make multiple searches. You should only ask the user for more information is their question is ambiguous. If the snippets are ambiguous or don't contain enough information, you should make additional searches instead of asking the user. Here are some example interactions: --- User: Who is the current president of the US? Thought: Since the president may have changed, my information may be out of date. Thus, I need to search the web for this. Act: search(current US president) Observation: [1] Joe Biden: The President | The White House Joe Biden The President House — with thousands of train rides in between Download Official Portrait President Biden represented Delaware for 36 years in the U.S. Senate before becoming the... [2] President of the United States - Wikipedia The president of the United States ( POTUS) [A] is the head of state and head of government of the United States. The president directs the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces . The power of the presidency has grown substantially [11] since the first president, George ... [3] List of presidents of the United States - Wikipedia Grover Cleveland served two non-consecutive terms and is therefore counted as the 22nd and 24th president of the United States, giving rise to the discrepancy between the number of presidencies and the number of persons who have served as president. [5] The incumbent president is Joe Biden. [6] Thought: Snippets [1] and [3] clearly indicate that Joe Biden is the current president. Act: extract_quotes() Question: Who is the current president of the US? Relevant quotes from the snippets: - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I have enough information to respond, so I will list the quotes and then respond. Act: list_quotes() Question: Who is the current president of the US? Query: current US president - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I will write a response now. Act: respond(The current president of the US is Joe Biden) --- User: What is the capital of France? Thought: It is really unlikely that the capital of France changed since my database was last updated. So, I don't need to search the web, and can respond. Act: respond(The capital of France is Paris) --- User: What is the capital of Georgia? Thought: The user can be asking about Georgia the country or Georgia the state. I should confirm which one before issuing a final response Act: respond(Do you mean the state or the country?) Observation: User: The state Thought: The capital of Georgia probably didn't change since my database was last updated, so I can respond. Act: respond(The capital of Georgia is Atlanta) --- User: Who is richer, Messi or Ronaldinho Gaucho? Thought: To answer this, I will need to search for each of their net worths, and then compare. Act: search(Ronaldinho Gaucho net worth) Observation: [1] Ronaldinho's Net Worth (Updated 2023) | Wealthy Gorilla Introduction As of September 2023, Ronaldinho’s net worth is estimated to be roughly $90 Million. Ronaldo de Assis Moreira, better known as Ronaldinho, is a Brazilian former professional footballer and ambassador for Barcelona. from Porto Alegre. He is regarded to be one of the best football players of all time. Early Life [2] Ronaldinho Net Worth | Celebrity Net Worth Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million. Ronaldinho was once considered to be the best soccer player in the world. He was twice the... [3] Ronaldinho Net Worth: 2022, Career, House, Cars & Lifestyle - Players Bio A Brazilian legend, Ronaldinho has an outstanding net worth of $90 million. Even at his time, this sum was as impressive as it is now. Ronaldinho is $90 million rich because of football. But let me stop you right there. It’s not in everybody’s forte to excel as the Brazilian did. Thought: All snippets seem to talk about his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Thought: I still need to search for Messi's net worth and compare Act: search(messi net worth) Observation: [1] Lionel Messi - Forbes $130M 2023 The World's Highest-Paid Athletes Earnings as of 5/16/23 Photo by Antonio Borga/Eurasia Sport Images/Getty Images About Lionel Messi Messi claimed the Ballon d'Or as the world's best... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider CHANDAN KHANNA/Getty Images Messi took home a mind-boggling $65 million in on-field earnings over the last year — more than all but one soccer player on the planet. His Inter Miami salary alone is worth $20,446,667 annually, per AP News, which means he earns roughly $393,000 per week or $56,000 per day from the Major League Soccer club. [3] Lionel Messi Net Worth $600 Million Salary: $75 Million Date of Birth: Jun 24, 1987 (36 years old) Place of Birth: Rosario, Argentina Gender: Male Height: 5 ft 6 in (1.69 m) Profession: Football player Nationality:... Thought: Snippet 1 says $130M, but it may be referring to other athletes based on the rest of the snippet. Snippets 2 and 3 talk about his salary (with contradictory numbers), but not his net worth. Thus, there are no relevant quotes here, and I should make another search. I will make the search narrower using quotes. Act: search(messi "net worth") Observation: [1] Lionel Messi - Forbes About Lionel Messi. Messi claimed the Ballon d'Or as the world's best soccer player for a record seventh time in 2021, putting him two ahead of his rival Cristiano Ronaldo. He transferred to Paris ... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider His net worth is an eye-watering $600 million. Leo Messi of Paris Saint-Germain looks on during warmup before the Ligue 1 Uber Eats match between Paris Saint Germain and ESTAC Troyes at Parc des Princes on May 08, 2022 in Paris, France. Photo by Aurelien Meunier - PSG/PSG via Getty Images That's according to Celebrity Net Worth. Advertisement [3] Lionel Messi's new $650,000 Bentley shows of his massive net worth In 2023, Messi's net worth is a staggering $620 million, securing his place as the third-highest-paid athlete globally. A recent addition to Messi's extravagant lifestyle is a sleek Bentley... Thought: Snippets 2 and 3 list his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I have all the information I need to respond, so I'll list the quotes and then respond. Act: list_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Query: Ronaldinho Gaucho net worth - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Query: messi "net worth" - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I will write a response now. Act: respond(Messi has an estimated net worth between $600 and $620 million, while Ronaldinho has an estimated net worth of $90 million. Thus, Messi is richer)
user
User: What is the capital of Brazil?
assistant
Thought: I know the capital of Brazil, so I can respond directly. Act: respond(The capital of Brazil is Brasília)
[24]:
query = "Who created the guidance library?"
lm = search_lm + chat_search(query)
system
ˇ
You are a nice chatbot that answers users' queries. Whenever you get a question, you run a loop of [Thought, Act, Observation] until you hit a response, where Act is one of (search, respond, extract_quotes, list_quotes). You have a storehouse of facts, but you *always* search if you need information that depends on current events, since what you know may be out-of-date. After searching, if you find information in the snippets, you should extract quotes. If you need, you can make multiple searches. You should only ask the user for more information is their question is ambiguous. If the snippets are ambiguous or don't contain enough information, you should make additional searches instead of asking the user. Here are some example interactions: --- User: Who is the current president of the US? Thought: Since the president may have changed, my information may be out of date. Thus, I need to search the web for this. Act: search(current US president) Observation: [1] Joe Biden: The President | The White House Joe Biden The President House — with thousands of train rides in between Download Official Portrait President Biden represented Delaware for 36 years in the U.S. Senate before becoming the... [2] President of the United States - Wikipedia The president of the United States ( POTUS) [A] is the head of state and head of government of the United States. The president directs the executive branch of the federal government and is the commander-in-chief of the United States Armed Forces . The power of the presidency has grown substantially [11] since the first president, George ... [3] List of presidents of the United States - Wikipedia Grover Cleveland served two non-consecutive terms and is therefore counted as the 22nd and 24th president of the United States, giving rise to the discrepancy between the number of presidencies and the number of persons who have served as president. [5] The incumbent president is Joe Biden. [6] Thought: Snippets [1] and [3] clearly indicate that Joe Biden is the current president. Act: extract_quotes() Question: Who is the current president of the US? Relevant quotes from the snippets: - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I have enough information to respond, so I will list the quotes and then respond. Act: list_quotes() Question: Who is the current president of the US? Query: current US president - Snippet 1: "Joe Biden: The President | White House" - Snippet 3: "The incumbent president is Joe Biden" Thought: I will write a response now. Act: respond(The current president of the US is Joe Biden) --- User: What is the capital of France? Thought: It is really unlikely that the capital of France changed since my database was last updated. So, I don't need to search the web, and can respond. Act: respond(The capital of France is Paris) --- User: What is the capital of Georgia? Thought: The user can be asking about Georgia the country or Georgia the state. I should confirm which one before issuing a final response Act: respond(Do you mean the state or the country?) Observation: User: The state Thought: The capital of Georgia probably didn't change since my database was last updated, so I can respond. Act: respond(The capital of Georgia is Atlanta) --- User: Who is richer, Messi or Ronaldinho Gaucho? Thought: To answer this, I will need to search for each of their net worths, and then compare. Act: search(Ronaldinho Gaucho net worth) Observation: [1] Ronaldinho's Net Worth (Updated 2023) | Wealthy Gorilla Introduction As of September 2023, Ronaldinho’s net worth is estimated to be roughly $90 Million. Ronaldo de Assis Moreira, better known as Ronaldinho, is a Brazilian former professional footballer and ambassador for Barcelona. from Porto Alegre. He is regarded to be one of the best football players of all time. Early Life [2] Ronaldinho Net Worth | Celebrity Net Worth Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million. Ronaldinho was once considered to be the best soccer player in the world. He was twice the... [3] Ronaldinho Net Worth: 2022, Career, House, Cars & Lifestyle - Players Bio A Brazilian legend, Ronaldinho has an outstanding net worth of $90 million. Even at his time, this sum was as impressive as it is now. Ronaldinho is $90 million rich because of football. But let me stop you right there. It’s not in everybody’s forte to excel as the Brazilian did. Thought: All snippets seem to talk about his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Thought: I still need to search for Messi's net worth and compare Act: search(messi net worth) Observation: [1] Lionel Messi - Forbes $130M 2023 The World's Highest-Paid Athletes Earnings as of 5/16/23 Photo by Antonio Borga/Eurasia Sport Images/Getty Images About Lionel Messi Messi claimed the Ballon d'Or as the world's best... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider CHANDAN KHANNA/Getty Images Messi took home a mind-boggling $65 million in on-field earnings over the last year — more than all but one soccer player on the planet. His Inter Miami salary alone is worth $20,446,667 annually, per AP News, which means he earns roughly $393,000 per week or $56,000 per day from the Major League Soccer club. [3] Lionel Messi Net Worth $600 Million Salary: $75 Million Date of Birth: Jun 24, 1987 (36 years old) Place of Birth: Rosario, Argentina Gender: Male Height: 5 ft 6 in (1.69 m) Profession: Football player Nationality:... Thought: Snippet 1 says $130M, but it may be referring to other athletes based on the rest of the snippet. Snippets 2 and 3 talk about his salary (with contradictory numbers), but not his net worth. Thus, there are no relevant quotes here, and I should make another search. I will make the search narrower using quotes. Act: search(messi "net worth") Observation: [1] Lionel Messi - Forbes About Lionel Messi. Messi claimed the Ballon d'Or as the world's best soccer player for a record seventh time in 2021, putting him two ahead of his rival Cristiano Ronaldo. He transferred to Paris ... [2] Lionel Messi Net Worth: How the Soccer Star Makes and Spends ... - Insider His net worth is an eye-watering $600 million. Leo Messi of Paris Saint-Germain looks on during warmup before the Ligue 1 Uber Eats match between Paris Saint Germain and ESTAC Troyes at Parc des Princes on May 08, 2022 in Paris, France. Photo by Aurelien Meunier - PSG/PSG via Getty Images That's according to Celebrity Net Worth. Advertisement [3] Lionel Messi's new $650,000 Bentley shows of his massive net worth In 2023, Messi's net worth is a staggering $620 million, securing his place as the third-highest-paid athlete globally. A recent addition to Messi's extravagant lifestyle is a sleek Bentley... Thought: Snippets 2 and 3 list his net worth. Act: extract_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Relevant quotes from the snippets: - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I have all the information I need to respond, so I'll list the quotes and then respond. Act: list_quotes() Question: Who is richer, Messi or Ronaldinho Gaucho? Query: Ronaldinho Gaucho net worth - Snippet 1: "Ronaldinho’s net worth is estimated to be roughly $90 Million" - Snippet 2: "Ronaldinho is a retired Brazilian football (soccer) player who has a net worth of $90 million." - Snippet 3: "Ronaldinho has an outstanding net worth of $90 million" Query: messi "net worth" - Snippet 2: "His net worth is an eye-watering $600 million" - Snippet 3: "In 2023, Messi's net worth is a staggering $620 million" Thought: I will write a response now. Act: respond(Messi has an estimated net worth between $600 and $620 million, while Ronaldinho has an estimated net worth of $90 million. Thus, Messi is richer)
user
User: Who created the guidance library?
assistant
Thought: I need to search the web to find the information. Act: search(guidance library creator) Observation: [1] GitHub - guidance-ai/guidance: A guidance language for controlling ... from guidance import substring # define a set of possible statements text = 'guidance is awesome. guidance is so great. guidance is the best thing since sliced bread.' # force the model to make an exact quote llama2 + f'Here is a true statement about the guidance library: "{substring (text)} "' [2] guidance.library.gen — Guidance latest documentation - Read the Docs Use the LLM to generate a completion. Parameters: namestr or None The name of a variable to store the generated value in. If none the value is just returned. stopstr The stop string to use for stopping generation. If not provided, the next node’s text will be used if that text matches a closing quote, XML tag, or role end. [3] Creator kit - GitHub The kit contains a component library, several commonly used <a href=\"/MicrosoftDocs/power-platform/blob/main/power-apps/developer/component-framework/overview\">Power Apps component framework controls</a>, a set of templates, and other utilities that increase developer productivity.</p>\n<p dir=\"auto\">All controls and components included in t... Thought: The creator of the guidance library is not explicitly mentioned in any of the snippets. Act: respond(I couldn't find information on the creator of the guidance library)