This commit is contained in:
Chi Wang 2023-09-27 04:22:54 +00:00
commit 8e9cda716e
6 changed files with 539 additions and 32 deletions

View File

@ -40,7 +40,7 @@ jobs:
python -m pip install --upgrade pip wheel
pip install -e .
python -c "import autogen"
pip install -e.[mathchat] datasets pytest
pip install -e.[mathchat,retrievechat] datasets pytest
pip uninstall -y openai
- name: Test with pytest
if: matrix.python-version != '3.10'

View File

@ -36,7 +36,7 @@ the number of agents, and agent conversation topology.
* It provides a collection of working systems with different complexities. These systems span a **wide range of applications** from various domains and complexities. They demonstrate how AutoGen can easily support different conversation patterns.
* AutoGen provides a drop-in replacement of `openai.Completion` or `openai.ChatCompletion` as an **enhanced inference API**. It allows easy performance tuning, utilities like API unification & caching, and advanced usage patterns, such as error handling, multi-config inference, context programming etc.
AutoGen is powered by collaborative [research studies](/docs/Research) from Microsoft, Penn State University, and University of Washington.
AutoGen is powered by collaborative [research studies](https://microsoft.github.io/autogen/docs/Research) from Microsoft, Penn State University, and University of Washington.
## Installation

View File

@ -1,3 +1,4 @@
import re
import chromadb
from autogen.agentchat.agent import Agent
from autogen.agentchat import UserProxyAgent
@ -122,6 +123,9 @@ class RetrieveUserProxyAgent(UserProxyAgent):
can be found at `https://www.sbert.net/docs/pretrained_models.html`. The default model is a
fast model. If you want to use a high performance model, `all-mpnet-base-v2` is recommended.
- customized_prompt (Optional, str): the customized prompt for the retrieve chat. Default is None.
- customized_answer_prefix (Optional, str): the customized answer prefix for the retrieve chat. Default is "".
If not "" and the customized_answer_prefix is not in the answer, `Update Context` will be triggered.
- no_update_context (Optional, bool): if True, will not apply `Update Context` for interactive retrieval. Default is False.
**kwargs (dict): other kwargs in [UserProxyAgent](../user_proxy_agent#__init__).
"""
super().__init__(
@ -143,11 +147,16 @@ class RetrieveUserProxyAgent(UserProxyAgent):
self._must_break_at_empty_line = self._retrieve_config.get("must_break_at_empty_line", True)
self._embedding_model = self._retrieve_config.get("embedding_model", "all-MiniLM-L6-v2")
self.customized_prompt = self._retrieve_config.get("customized_prompt", None)
self.customized_answer_prefix = self._retrieve_config.get("customized_answer_prefix", "").upper()
self.no_update_context = self._retrieve_config.get("no_update_context", False)
self._context_max_tokens = self._max_tokens * 0.8
self._collection = False # the collection is not created
self._ipython = get_ipython()
self._doc_idx = -1 # the index of the current used doc
self._results = {} # the results of the current query
self._intermediate_answers = set() # the intermediate answers
self._doc_contents = [] # the contents of the current used doc
self._doc_ids = [] # the ids of the current used doc
self.register_reply(Agent, RetrieveUserProxyAgent._generate_retrieve_user_reply)
@staticmethod
@ -161,17 +170,24 @@ class RetrieveUserProxyAgent(UserProxyAgent):
else:
return 4000
def _reset(self):
def _reset(self, intermediate=False):
self._doc_idx = -1 # the index of the current used doc
self._results = {} # the results of the current query
if not intermediate:
self._intermediate_answers = set() # the intermediate answers
self._doc_contents = [] # the contents of the current used doc
self._doc_ids = [] # the ids of the current used doc
def _get_context(self, results):
doc_contents = ""
current_tokens = 0
_doc_idx = self._doc_idx
_tmp_retrieve_count = 0
for idx, doc in enumerate(results["documents"][0]):
if idx <= _doc_idx:
continue
if results["ids"][0][idx] in self._doc_ids:
continue
_doc_tokens = num_tokens_from_text(doc)
if _doc_tokens > self._context_max_tokens:
func_print = f"Skip doc_id {results['ids'][0][idx]} as it is too long to fit in the context."
@ -185,6 +201,11 @@ class RetrieveUserProxyAgent(UserProxyAgent):
current_tokens += _doc_tokens
doc_contents += doc + "\n"
self._doc_idx = idx
self._doc_ids.append(results["ids"][0][idx])
self._doc_contents.append(doc)
_tmp_retrieve_count += 1
if _tmp_retrieve_count >= self.n_results:
break
return doc_contents
def _generate_message(self, doc_contents, task="default"):
@ -192,7 +213,7 @@ class RetrieveUserProxyAgent(UserProxyAgent):
print(colored("No more context, will terminate.", "green"), flush=True)
return "TERMINATE"
if self.customized_prompt:
message = self.customized_prompt + "\nUser's question is: " + self.problem + "\nContext is: " + doc_contents
message = self.customized_prompt.format(input_question=self.problem, input_context=doc_contents)
elif task.upper() == "CODE":
message = PROMPT_CODE.format(input_question=self.problem, input_context=doc_contents)
elif task.upper() == "QA":
@ -209,24 +230,64 @@ class RetrieveUserProxyAgent(UserProxyAgent):
sender: Optional[Agent] = None,
config: Optional[Any] = None,
) -> Tuple[bool, Union[str, Dict, None]]:
"""In this function, we will update the context and reset the conversation based on different conditions.
We'll update the context and reset the conversation if no_update_context is False and either of the following:
(1) the last message contains "UPDATE CONTEXT",
(2) the last message doesn't contain "UPDATE CONTEXT" and the customized_answer_prefix is not in the message.
"""
if config is None:
config = self
if messages is None:
messages = self._oai_messages[sender]
message = messages[-1]
if (
update_context_case1 = (
"UPDATE CONTEXT" in message.get("content", "")[-20:].upper()
or "UPDATE CONTEXT" in message.get("content", "")[:20].upper()
):
)
update_context_case2 = (
self.customized_answer_prefix and self.customized_answer_prefix not in message.get("content", "").upper()
)
if (update_context_case1 or update_context_case2) and not self.no_update_context:
print(colored("Updating context and resetting conversation.", "green"), flush=True)
# extract the first sentence in the response as the intermediate answer
_message = message.get("content", "").split("\n")[0].strip()
_intermediate_info = re.split(r"(?<=[.!?])\s+", _message)
self._intermediate_answers.add(_intermediate_info[0])
if update_context_case1:
# try to get more context from the current retrieved doc results because the results may be too long to fit
# in the LLM context.
doc_contents = self._get_context(self._results)
# Always use self.problem as the query text to retrieve docs, but each time we replace the context with the
# next similar docs in the retrieved doc results.
if not doc_contents:
for _tmp_retrieve_count in range(1, 5):
self._reset(intermediate=True)
self.retrieve_docs(self.problem, self.n_results * (2 * _tmp_retrieve_count + 1))
doc_contents = self._get_context(self._results)
if doc_contents:
break
elif update_context_case2:
# Use the current intermediate info as the query text to retrieve docs, and each time we append the top similar
# docs in the retrieved doc results to the context.
for _tmp_retrieve_count in range(5):
self._reset(intermediate=True)
self.retrieve_docs(_intermediate_info[0], self.n_results * (2 * _tmp_retrieve_count + 1))
self._get_context(self._results)
doc_contents = "\n".join(self._doc_contents) # + "\n" + "\n".join(self._intermediate_answers)
if doc_contents:
break
self.clear_history()
sender.clear_history()
doc_contents = self._get_context(self._results)
return True, self._generate_message(doc_contents, task=self._task)
return False, None
else:
return False, None
def retrieve_docs(self, problem: str, n_results: int = 20, search_string: str = ""):
if not self._collection:
print("Trying to create collection.")
create_vector_db_from_dir(
dir_path=self._docs_path,
max_tokens=self._chunk_token_size,
@ -263,6 +324,7 @@ class RetrieveUserProxyAgent(UserProxyAgent):
self._reset()
self.retrieve_docs(problem, n_results, search_string)
self.problem = problem
self.n_results = n_results
doc_contents = self._get_context(self._results)
message = self._generate_message(doc_contents, self._task)
return message
@ -278,21 +340,6 @@ class RetrieveUserProxyAgent(UserProxyAgent):
if self._ipython is None or lang != "python":
return super().run_code(code, **kwargs)
else:
# # capture may not work as expected
# result = self._ipython.run_cell("%%capture --no-display cap\n" + code)
# log = self._ipython.ev("cap.stdout")
# log += self._ipython.ev("cap.stderr")
# if result.result is not None:
# log += str(result.result)
# exitcode = 0 if result.success else 1
# if result.error_before_exec is not None:
# log += f"\n{result.error_before_exec}"
# exitcode = 1
# if result.error_in_exec is not None:
# log += f"\n{result.error_in_exec}"
# exitcode = 1
# return exitcode, log, None
result = self._ipython.run_cell(code)
log = str(result.result)
exitcode = 0 if result.success else 1

View File

@ -207,10 +207,18 @@ def create_vector_db_from_dir(
)
chunks = split_files_to_chunks(get_files_from_dir(dir_path), max_tokens, chunk_mode, must_break_at_empty_line)
# updates existing items, or adds them if they don't yet exist.
print(f"Found {len(chunks)} chunks.")
# upsert in batch of 40000
for i in range(0, len(chunks), 40000):
collection.upsert(
documents=chunks[
i : i + 40000
], # we handle tokenization, embedding, and indexing automatically. You can skip that and add your own embeddings as well
ids=[f"doc_{i}" for i in range(i, i + 40000)], # unique for each doc
)
collection.upsert(
documents=chunks, # we handle tokenization, embedding, and indexing automatically. You can skip that and add your own embeddings as well
ids=[f"doc_{i}" for i in range(len(chunks))], # unique for each doc
documents=chunks[i : len(chunks)],
ids=[f"doc_{i}" for i in range(i, len(chunks))], # unique for each doc
)
except ValueError as e:
logger.warning(f"{e}")

View File

@ -22,7 +22,7 @@
"RetrieveChat is a convesational system for retrieve augmented code generation and question answering. In this notebook, we demonstrate how to utilize RetrieveChat to generate code and answer questions based on customized documentations that are not present in the LLM's training dataset. RetrieveChat uses the `RetrieveAssistantAgent` and `RetrieveUserProxyAgent`, which is similar to the usage of `AssistantAgent` and `UserProxyAgent` in other notebooks (e.g., [Automated Task Solving with Code Generation, Execution & Debugging](https://github.com/microsoft/autogen/blob/main/notebook/agentchat_auto_feedback_from_code_execution.ipynb)). Essentially, `RetrieveAssistantAgent` and `RetrieveUserProxyAgent` implement a different auto-reply mechanism corresponding to the RetrieveChat prompts.\n",
"\n",
"## Table of Contents\n",
"We'll demonstrates five examples of using RetrieveChat for code generation and question answering:\n",
"We'll demonstrates six examples of using RetrieveChat for code generation and question answering:\n",
"\n",
"[Example 1: Generate code based off docstrings w/o human feedback](#example-1)\n",
"\n",
@ -34,6 +34,9 @@
"\n",
"[Example 5: Solve comprehensive QA problems with RetrieveChat's unique feature `Update Context`](#example-5)\n",
"\n",
"[Example 6: Solve comprehensive QA problems with customized prompt and few-shot learning](#example-6)\n",
"\n",
"\n",
"\n",
"## Requirements\n",
"\n",
@ -49,7 +52,7 @@
"metadata": {},
"outputs": [],
"source": [
"# %pip install \"pyautogen[retrievechat]~=0.1.1\" \"flaml[automl]\""
"# %pip install \"pyautogen[retrievechat]~=0.1.2\" \"flaml[automl]\""
]
},
{
@ -64,7 +67,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 1,
"metadata": {},
"outputs": [
{
@ -145,7 +148,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
@ -3158,7 +3161,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
@ -3679,6 +3682,450 @@
"source": [
"In this example, questions were directly selected from the dataset. RetrieveChat was able to answer the questions correctly in the first attempt as the retrieved context contained the necessary information in the first two cases. However, in the last three cases, the context with the highest similarity to the question embedding did not contain the required information to answer the question. As a result, the LLM model responded with `UPDATE CONTEXT`. With the unique and innovative ability to update context in RetrieveChat, the agent automatically updated the context and sent it to the LLM model again. After several rounds of this process, the agent was able to generate the correct answer to the questions."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<a id=\"example-6\"></a>\n",
"### Example 6\n",
"\n",
"[back to top](#toc)\n",
"\n",
"Use RetrieveChat to answer multi-hop questions for [2WikiMultihopQA](https://github.com/Alab-NII/2wikimultihop) dataset with customized prompt and few-shot learning.\n",
"\n",
"First, we will create a new document collection which includes all the contextual corpus. Then, we will choose some questions and utilize RetrieveChat to answer them. For this particular example, we will be using the `gpt-3.5-turbo` model, and we will demonstrate RetrieveChat's feature of automatically updating context in case the documents retrieved do not contain sufficient information. Moreover, we'll demonstrate how to use customized prompt and few-shot learning to address tasks that are not pre-defined in RetrieveChat."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"PROMPT_MULTIHOP = \"\"\"You're a retrieve augmented chatbot. You answer user's questions based on your own knowledge and the context provided by the user. You must think step-by-step.\n",
"First, please learn the following examples of context and question pairs and their corresponding answers.\n",
"\n",
"Context:\n",
"Kurram Garhi: Kurram Garhi is a small village located near the city of Bannu, which is the part of Khyber Pakhtunkhwa province of Pakistan. Its population is approximately 35000.\n",
"Trojkrsti: Trojkrsti is a village in Municipality of Prilep, Republic of Macedonia.\n",
"Q: Are both Kurram Garhi and Trojkrsti located in the same country?\n",
"A: Kurram Garhi is located in the country of Pakistan. Trojkrsti is located in the country of Republic of Macedonia. Thus, they are not in the same country. So the answer is: no.\n",
"\n",
"\n",
"Context:\n",
"Early Side of Later: Early Side of Later is the third studio album by English singer- songwriter Matt Goss. It was released on 21 June 2004 by Concept Music and reached No. 78 on the UK Albums Chart.\n",
"What's Inside: What's Inside is the fourteenth studio album by British singer- songwriter Joan Armatrading.\n",
"Q: Which album was released earlier, What'S Inside or Cassandra'S Dream (Album)?\n",
"A: What's Inside was released in the year 1995. Cassandra's Dream (album) was released in the year 2008. Thus, of the two, the album to release earlier is What's Inside. So the answer is: What's Inside.\n",
"\n",
"\n",
"Context:\n",
"Maria Alexandrovna (Marie of Hesse): Maria Alexandrovna , born Princess Marie of Hesse and by Rhine (8 August 1824 3 June 1880) was Empress of Russia as the first wife of Emperor Alexander II.\n",
"Grand Duke Alexei Alexandrovich of Russia: Grand Duke Alexei Alexandrovich of Russia,(Russian: Алексей Александрович; 14 January 1850 (2 January O.S.) in St. Petersburg 14 November 1908 in Paris) was the fifth child and the fourth son of Alexander II of Russia and his first wife Maria Alexandrovna (Marie of Hesse).\n",
"Q: What is the cause of death of Grand Duke Alexei Alexandrovich Of Russia's mother?\n",
"A: The mother of Grand Duke Alexei Alexandrovich of Russia is Maria Alexandrovna. Maria Alexandrovna died from tuberculosis. So the answer is: tuberculosis.\n",
"\n",
"\n",
"Context:\n",
"Laughter in Hell: Laughter in Hell is a 1933 American Pre-Code drama film directed by Edward L. Cahn and starring Pat O'Brien. The film's title was typical of the sensationalistic titles of many Pre-Code films.\n",
"Edward L. Cahn: Edward L. Cahn (February 12, 1899 August 25, 1963) was an American film director.\n",
"Q: When did the director of film Laughter In Hell die?\n",
"A: The film Laughter In Hell was directed by Edward L. Cahn. Edward L. Cahn died on August 25, 1963. So the answer is: August 25, 1963.\n",
"\n",
"Second, please complete the answer by thinking step-by-step.\n",
"\n",
"Context:\n",
"{input_context}\n",
"Q: {input_question}\n",
"A:\n",
"\"\"\""
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"#create the RetrieveUserProxyAgent instance named \"ragproxyagent\"\n",
"corpus_file = \"https://huggingface.co/datasets/thinkall/2WikiMultihopQA/resolve/main/corpus.txt\"\n",
"\n",
"# Create a new collection for NaturalQuestions dataset\n",
"ragproxyagent = RetrieveUserProxyAgent(\n",
" name=\"ragproxyagent\",\n",
" human_input_mode=\"NEVER\",\n",
" max_consecutive_auto_reply=3,\n",
" retrieve_config={\n",
" \"task\": \"qa\",\n",
" \"docs_path\": corpus_file,\n",
" \"chunk_token_size\": 2000,\n",
" \"model\": config_list[0][\"model\"],\n",
" \"client\": chromadb.PersistentClient(path=\"/tmp/chromadb\"),\n",
" \"collection_name\": \"2wikimultihopqa\",\n",
" \"chunk_mode\": \"one_line\",\n",
" \"embedding_model\": \"all-MiniLM-L6-v2\",\n",
" \"customized_prompt\": PROMPT_MULTIHOP,\n",
" \"customized_answer_prefix\": \"the answer is\",\n",
" },\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['Which film came out first, Blind Shaft or The Mask Of Fu Manchu?', 'Are North Marion High School (Oregon) and Seoul High School both located in the same country?']\n",
"[['The Mask Of Fu Manchu'], ['no']]\n"
]
}
],
"source": [
"import json\n",
"\n",
"# queries_file = \"https://huggingface.co/datasets/thinkall/2WikiMultihopQA/resolve/main/queries.jsonl\"\n",
"queries = \"\"\"{\"_id\": \"61a46987092f11ebbdaeac1f6bf848b6\", \"text\": \"Which film came out first, Blind Shaft or The Mask Of Fu Manchu?\", \"metadata\": {\"answer\": [\"The Mask Of Fu Manchu\"]}}\n",
"{\"_id\": \"a7b9672009c311ebbdb0ac1f6bf848b6\", \"text\": \"Are North Marion High School (Oregon) and Seoul High School both located in the same country?\", \"metadata\": {\"answer\": [\"no\"]}}\n",
"\"\"\"\n",
"queries = [json.loads(line) for line in queries.split(\"\\n\") if line]\n",
"questions = [q[\"text\"] for q in queries]\n",
"answers = [q[\"metadata\"][\"answer\"] for q in queries]\n",
"print(questions)\n",
"print(answers)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Collection 2wikimultihopqa already exists.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
">>>>>>>>>>>> Below are outputs of Case 1 <<<<<<<<<<<<\n",
"\n",
"\n",
"Trying to create collection.\n",
"doc_ids: [['doc_12', 'doc_11', 'doc_16', 'doc_19', 'doc_13116', 'doc_14', 'doc_13', 'doc_18', 'doc_977', 'doc_10']]\n",
"\u001b[32mAdding doc_id doc_12 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_11 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_16 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_19 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_13116 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_14 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_13 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_18 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_977 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_10 to context.\u001b[0m\n",
"\u001b[33mragproxyagent\u001b[0m (to assistant):\n",
"\n",
"You're a retrieve augmented chatbot. You answer user's questions based on your own knowledge and the context provided by the user. You must think step-by-step.\n",
"First, please learn the following examples of context and question pairs and their corresponding answers.\n",
"\n",
"Context:\n",
"Kurram Garhi: Kurram Garhi is a small village located near the city of Bannu, which is the part of Khyber Pakhtunkhwa province of Pakistan. Its population is approximately 35000.\n",
"Trojkrsti: Trojkrsti is a village in Municipality of Prilep, Republic of Macedonia.\n",
"Q: Are both Kurram Garhi and Trojkrsti located in the same country?\n",
"A: Kurram Garhi is located in the country of Pakistan. Trojkrsti is located in the country of Republic of Macedonia. Thus, they are not in the same country. So the answer is: no.\n",
"\n",
"\n",
"Context:\n",
"Early Side of Later: Early Side of Later is the third studio album by English singer- songwriter Matt Goss. It was released on 21 June 2004 by Concept Music and reached No. 78 on the UK Albums Chart.\n",
"What's Inside: What's Inside is the fourteenth studio album by British singer- songwriter Joan Armatrading.\n",
"Q: Which album was released earlier, What'S Inside or Cassandra'S Dream (Album)?\n",
"A: What's Inside was released in the year 1995. Cassandra's Dream (album) was released in the year 2008. Thus, of the two, the album to release earlier is What's Inside. So the answer is: What's Inside.\n",
"\n",
"\n",
"Context:\n",
"Maria Alexandrovna (Marie of Hesse): Maria Alexandrovna , born Princess Marie of Hesse and by Rhine (8 August 1824 3 June 1880) was Empress of Russia as the first wife of Emperor Alexander II.\n",
"Grand Duke Alexei Alexandrovich of Russia: Grand Duke Alexei Alexandrovich of Russia,(Russian: Алексей Александрович; 14 January 1850 (2 January O.S.) in St. Petersburg 14 November 1908 in Paris) was the fifth child and the fourth son of Alexander II of Russia and his first wife Maria Alexandrovna (Marie of Hesse).\n",
"Q: What is the cause of death of Grand Duke Alexei Alexandrovich Of Russia's mother?\n",
"A: The mother of Grand Duke Alexei Alexandrovich of Russia is Maria Alexandrovna. Maria Alexandrovna died from tuberculosis. So the answer is: tuberculosis.\n",
"\n",
"\n",
"Context:\n",
"Laughter in Hell: Laughter in Hell is a 1933 American Pre-Code drama film directed by Edward L. Cahn and starring Pat O'Brien. The film's title was typical of the sensationalistic titles of many Pre-Code films.\n",
"Edward L. Cahn: Edward L. Cahn (February 12, 1899 August 25, 1963) was an American film director.\n",
"Q: When did the director of film Laughter In Hell die?\n",
"A: The film Laughter In Hell was directed by Edward L. Cahn. Edward L. Cahn died on August 25, 1963. So the answer is: August 25, 1963.\n",
"\n",
"Second, please complete the answer by thinking step-by-step.\n",
"\n",
"Context:\n",
"The Mask of Fu Manchu: The Mask of Fu Manchu is a 1932 pre-Code adventure film directed by Charles Brabin. It was written by Irene Kuhn, Edgar Allan Woolf and John Willard based on the 1932 novel of the same name by Sax Rohmer. Starring Boris Karloff as Fu Manchu, and featuring Myrna Loy as his depraved daughter, the movie revolves around Fu Manchu's quest for the golden sword and mask of Genghis Khan. Lewis Stone plays his nemesis. Dr. Petrie is absent from this film.\n",
"The Mysterious Dr. Fu Manchu: The Mysterious Dr. Fu Manchu is a 1929 American pre-Code drama film directed by Rowland V. Lee and starring Warner Oland as Dr. Fu Manchu. It was the first Fu Manchu film of the talkie era. Since this was during the transition period to sound, a silent version was also released in the United States.\n",
"The Face of Fu Manchu: The Face of Fu Manchu is a 1965 thriller film directed by Don Sharp and based on the characters created by Sax Rohmer. It stars Christopher Lee as the eponymous villain, a Chinese criminal mastermind, and Nigel Green as his pursuing rival Nayland Smith, a Scotland Yard detective. The film was a British- West German co-production, and was the first in a five- part series starring Lee and produced by Harry Alan Towers for Constantin Film, the second of which was\" The Brides of Fu Manchu\" released the next year, with the final entry being\" The Castle of Fu Manchu\" in 1969. It was shot in Technicolor and Techniscope, on- location in County Dublin, Ireland.\n",
"The Return of Dr. Fu Manchu: The Return of Dr. Fu Manchu is a 1930 American pre-Code film directed by Rowland V. Lee. It is the second of three films starring Warner Oland as the fiendish Fu Manchu, who returns from apparent death in the previous film,\" The Mysterious Dr. Fu Manchu\"( 1929), to seek revenge on those he holds responsible for the death of his wife and child.\n",
"The Vengeance of Fu Manchu: The Vengeance of Fu Manchu is a 1967 British film directed by Jeremy Summers and starring Christopher Lee, Horst Frank, Douglas Wilmer and Tsai Chin. It was the third British/ West German Constantin Film co-production of the Dr. Fu Manchu series and the first to be filmed in Hong Kong. It was generally released in the U.K. through Warner- Pathé( as a support feature to the Lindsay Shonteff film\" The Million Eyes of Sumuru\") on 3 December 1967.\n",
"The Brides of Fu Manchu: The Brides of Fu Manchu is a 1966 British/ West German Constantin Film co-production adventure crime film based on the fictional Chinese villain Dr. Fu Manchu, created by Sax Rohmer. It was the second film in a series, and was preceded by\" The Face of Fu ManchuThe Vengeance of Fu Manchu\" followed in 1967,\" The Blood of Fu Manchu\" in 1968, and\" The Castle of Fu Manchu\" in 1969. It was produced by Harry Alan Towers for Hallam Productions. Like the first film, it was directed by Don Sharp, and starred Christopher Lee as Fu Manchu. Nigel Green was replaced by Douglas Wilmer as Scotland Yard detective Nayland Smith. The action takes place mainly in London, where much of the location filming took place.\n",
"The Castle of Fu Manchu: The Castle of Fu Manchu( also known as The Torture Chamber of Dr. Fu Manchu and also known by its German title Die Folterkammer des Dr. Fu Man Chu) is a 1969 film and the fifth and final Dr. Fu Manchu film with Christopher Lee portraying the title character.\n",
"The Blood of Fu Manchu: The Blood of Fu Manchu, also known as Fu Manchu and the Kiss of Death, Kiss of Death, Kiss and Kill( U.S. title) and Against All Odds( original U.S. video title), is a 1968 British adventure crime film directed by Jesús Franco, based on the fictional Asian villain Dr. Fu Manchu created by Sax Rohmer. It was the fourth film in a series, and was preceded by\" The Vengeance of Fu Manchu The Castle of Fu Manchu\" followed in 1969. It was produced by Harry Alan Towers for Udastex Films. It starred Christopher Lee as Dr. Fu Manchu, Richard Greene as Scotland Yard detective Nayland Smith, and Howard Marion- Crawford as Dr. Petrie. The movie was filmed in Spain and Brazil. Shirley Eaton appears in a scene that she claimed she was never paid for; apparently, the director Jesús Franco had inserted some stock footage of her from one of her films(\" The Girl from Rio\"( 1968)) into the film without telling her. She only found out years later that she had been in a Fu Manchu film.\n",
"Don Sharp: Donald Herman Sharp( 19 April 192114 December 2011) was an Australian- born British film director. His best known films were made for Hammer in the 1960s, and included\" The Kiss of the Vampire\"( 1962) and\" Rasputin, the Mad Monk\"( 1966). In 1965 he directed\" The Face of Fu Manchu\", based on the character created by Sax Rohmer, and starring Christopher Lee. Sharp also directed the sequel\" The Brides of Fu Manchu\"( 1966). In the 1980s he was also responsible for several hugely popular miniseries adapted from the novels of Barbara Taylor Bradford.\n",
"Blind Shaft: Blind Shaft is a 2003 film about a pair of brutal con artists operating in the illegal coal mines of present- day northern China. The film was written and directed by Li Yang( 李杨), and is based on Chinese writer Liu Qingbang's short novel\" Shen MuSacred Wood\").\n",
"\n",
"Q: Which film came out first, Blind Shaft or The Mask Of Fu Manchu?\n",
"A:\n",
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001b[33massistant\u001b[0m (to ragproxyagent):\n",
"\n",
"Blind Shaft is a film directed by Li Yang and was released in the year 2003. The Mask of Fu Manchu, on the other hand, is a pre-Code adventure film directed by Charles Brabin and was released in the year 1932. Thus, The Mask of Fu Manchu came out earlier than Blind Shaft. So the answer is: The Mask of Fu Manchu.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\n",
"\n",
">>>>>>>>>>>> Below are outputs of Case 2 <<<<<<<<<<<<\n",
"\n",
"\n",
"doc_ids: [['doc_50790', 'doc_20244', 'doc_1013', 'doc_4364', 'doc_4366', 'doc_57051', 'doc_2851', 'doc_57053', 'doc_13524', 'doc_1316']]\n",
"\u001b[32mAdding doc_id doc_50790 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_20244 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_1013 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_4364 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_4366 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_57051 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_2851 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_57053 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_13524 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_1316 to context.\u001b[0m\n",
"\u001b[33mragproxyagent\u001b[0m (to assistant):\n",
"\n",
"You're a retrieve augmented chatbot. You answer user's questions based on your own knowledge and the context provided by the user. You must think step-by-step.\n",
"First, please learn the following examples of context and question pairs and their corresponding answers.\n",
"\n",
"Context:\n",
"Kurram Garhi: Kurram Garhi is a small village located near the city of Bannu, which is the part of Khyber Pakhtunkhwa province of Pakistan. Its population is approximately 35000.\n",
"Trojkrsti: Trojkrsti is a village in Municipality of Prilep, Republic of Macedonia.\n",
"Q: Are both Kurram Garhi and Trojkrsti located in the same country?\n",
"A: Kurram Garhi is located in the country of Pakistan. Trojkrsti is located in the country of Republic of Macedonia. Thus, they are not in the same country. So the answer is: no.\n",
"\n",
"\n",
"Context:\n",
"Early Side of Later: Early Side of Later is the third studio album by English singer- songwriter Matt Goss. It was released on 21 June 2004 by Concept Music and reached No. 78 on the UK Albums Chart.\n",
"What's Inside: What's Inside is the fourteenth studio album by British singer- songwriter Joan Armatrading.\n",
"Q: Which album was released earlier, What'S Inside or Cassandra'S Dream (Album)?\n",
"A: What's Inside was released in the year 1995. Cassandra's Dream (album) was released in the year 2008. Thus, of the two, the album to release earlier is What's Inside. So the answer is: What's Inside.\n",
"\n",
"\n",
"Context:\n",
"Maria Alexandrovna (Marie of Hesse): Maria Alexandrovna , born Princess Marie of Hesse and by Rhine (8 August 1824 3 June 1880) was Empress of Russia as the first wife of Emperor Alexander II.\n",
"Grand Duke Alexei Alexandrovich of Russia: Grand Duke Alexei Alexandrovich of Russia,(Russian: Алексей Александрович; 14 January 1850 (2 January O.S.) in St. Petersburg 14 November 1908 in Paris) was the fifth child and the fourth son of Alexander II of Russia and his first wife Maria Alexandrovna (Marie of Hesse).\n",
"Q: What is the cause of death of Grand Duke Alexei Alexandrovich Of Russia's mother?\n",
"A: The mother of Grand Duke Alexei Alexandrovich of Russia is Maria Alexandrovna. Maria Alexandrovna died from tuberculosis. So the answer is: tuberculosis.\n",
"\n",
"\n",
"Context:\n",
"Laughter in Hell: Laughter in Hell is a 1933 American Pre-Code drama film directed by Edward L. Cahn and starring Pat O'Brien. The film's title was typical of the sensationalistic titles of many Pre-Code films.\n",
"Edward L. Cahn: Edward L. Cahn (February 12, 1899 August 25, 1963) was an American film director.\n",
"Q: When did the director of film Laughter In Hell die?\n",
"A: The film Laughter In Hell was directed by Edward L. Cahn. Edward L. Cahn died on August 25, 1963. So the answer is: August 25, 1963.\n",
"\n",
"Second, please complete the answer by thinking step-by-step.\n",
"\n",
"Context:\n",
"Princess Josephine of Baden: Princess Josephine Friederike Luise of Baden( 21 October 1813 19 June 1900) was born at Mannheim, the second daughter of Charles, Grand Duke of Baden and his wife, Stéphanie de Beauharnais. Through her son, Carol I, she is the ancestress of the Romanian royal family and the Yugoslav Royal family. Through her younger daughter Marie, she is also the ancestress of the Belgian royal family and the Grand Ducal family of Luxembourg.\n",
"Archduchess Marie Astrid of Austria: Archduchess Marie Astrid of Austria( née\" Princess Marie Astrid of Luxembourg\"; born 17 February 1954 at Castle Betzdorf) is the elder daughter and eldest child of Grand Duke Jean of Luxembourg and Joséphine- Charlotte of Belgium, and the wife of Archduke Carl Christian of Austria.\n",
"Princess Joséphine Marie of Belgium: Princess Joséphine Marie of Belgium( 30 November 1870 — 18 January 1871) was the daughter of Prince Philippe, Count of Flanders, and Princess Marie of Hohenzollern- Sigmaringen. She was the older twin to Princess Henriette of Belgium. In 1872 Joséphine Marie's mother gave birth to another daughter, who was named Joséphine in her memory.\n",
"Princess Joséphine Marie of Belgium: Princess Joséphine Marie of Belgium (30 November 1870 — 18 January 1871) was the daughter of Prince Philippe, Count of Flanders, and Princess Marie of Hohenzollern-Sigmaringen. She was the older twin to Princess Henriette of Belgium. In 1872 Joséphine Marie's mother gave birth to another daughter, who was named Joséphine in her memory.\n",
"Princess Joséphine Caroline of Belgium: Princess Joséphine Caroline of Belgium( 18 October 1872 6 January 1958) was the youngest daughter of Prince Philippe, Count of Flanders and Princess Marie of Hohenzollern- Sigmaringen. She was an older sister of Albert I of Belgium.\n",
"Federal University of Maranhão: The Federal University of Maranhão( UFMA) is a federal university in the northeastern state of Maranhão, Brazil.\n",
"Princess Margaretha of Liechtenstein: Princess Margaretha of Liechtenstein( born Princess Margaretha of Luxembourg on 15 May 1957) is the fourth child and second and youngest daughter of Grand Duke Jean of Luxembourg and Princess Joséphine- Charlotte of Belgium. As the sister of Grand Duke Henri of Luxembourg and the sister- in- law of Prince Hans- Adam II of Liechtenstein, she is a princess of two current realms and a member of the Luxembourg and Liechtenstein reigning dynasties.\n",
"Federal University, Lokoja: The Federal University, Lokoja, popularly known as Fulokoja, is a federal university in the confluence city of Lokoja, the capital of Kogi State, North- Central Nigeria. Lokoja lies at the confluence of the Niger and Benue rivers. The Federal University, Lokoja was established in February 2011 by the Federal Government of Nigeria as a result of indispensable need to create more universities in the country.\n",
"Princess Luisa Maria of Belgium, Archduchess of Austria-Este: Princess Luisa Maria of Belgium, Archduchess of Austria- Este( Luisa Maria Anna Martine Pilar; born 11 October 1995) is the fourth child and second daughter of Lorenz, Archduke of Austria- Este, and Princess Astrid of Belgium. She was born at the Saint Jean Hospital in Brussels, Belgium, and is currently ninth in line to the Belgian throne.\n",
"Princess Sophie of Greece and Denmark: Princess Sophie of Greece and Denmark( 26 June 1914 24 November 2001) was the fourth child and youngest daughter of Prince Andrew of Greece and Denmark and Princess Alice of Battenberg. The Duke of Edinburgh is her younger brother. Sophie was born at the villa Mon Repos on the island of Corfu in Greece.\n",
"\n",
"Q: Are North Marion High School (Oregon) and Seoul High School both located in the same country?\n",
"A:\n",
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001b[33massistant\u001b[0m (to ragproxyagent):\n",
"\n",
"I'm sorry, I do not have enough information about North Marion High School and Seoul High School to provide an answer. Please provide more context or information about the schools.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001b[32mUpdating context and resetting conversation.\u001b[0m\n",
"doc_ids: [['doc_74', 'doc_68', 'doc_75', 'doc_76', 'doc_19596', 'doc_23187', 'doc_7274', 'doc_11693', 'doc_10593', 'doc_11636']]\n",
"\u001b[32mAdding doc_id doc_74 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_68 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_75 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_76 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_19596 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_23187 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_7274 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_11693 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_10593 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_11636 to context.\u001b[0m\n",
"\u001b[33mragproxyagent\u001b[0m (to assistant):\n",
"\n",
"You're a retrieve augmented chatbot. You answer user's questions based on your own knowledge and the context provided by the user. You must think step-by-step.\n",
"First, please learn the following examples of context and question pairs and their corresponding answers.\n",
"\n",
"Context:\n",
"Kurram Garhi: Kurram Garhi is a small village located near the city of Bannu, which is the part of Khyber Pakhtunkhwa province of Pakistan. Its population is approximately 35000.\n",
"Trojkrsti: Trojkrsti is a village in Municipality of Prilep, Republic of Macedonia.\n",
"Q: Are both Kurram Garhi and Trojkrsti located in the same country?\n",
"A: Kurram Garhi is located in the country of Pakistan. Trojkrsti is located in the country of Republic of Macedonia. Thus, they are not in the same country. So the answer is: no.\n",
"\n",
"\n",
"Context:\n",
"Early Side of Later: Early Side of Later is the third studio album by English singer- songwriter Matt Goss. It was released on 21 June 2004 by Concept Music and reached No. 78 on the UK Albums Chart.\n",
"What's Inside: What's Inside is the fourteenth studio album by British singer- songwriter Joan Armatrading.\n",
"Q: Which album was released earlier, What'S Inside or Cassandra'S Dream (Album)?\n",
"A: What's Inside was released in the year 1995. Cassandra's Dream (album) was released in the year 2008. Thus, of the two, the album to release earlier is What's Inside. So the answer is: What's Inside.\n",
"\n",
"\n",
"Context:\n",
"Maria Alexandrovna (Marie of Hesse): Maria Alexandrovna , born Princess Marie of Hesse and by Rhine (8 August 1824 3 June 1880) was Empress of Russia as the first wife of Emperor Alexander II.\n",
"Grand Duke Alexei Alexandrovich of Russia: Grand Duke Alexei Alexandrovich of Russia,(Russian: Алексей Александрович; 14 January 1850 (2 January O.S.) in St. Petersburg 14 November 1908 in Paris) was the fifth child and the fourth son of Alexander II of Russia and his first wife Maria Alexandrovna (Marie of Hesse).\n",
"Q: What is the cause of death of Grand Duke Alexei Alexandrovich Of Russia's mother?\n",
"A: The mother of Grand Duke Alexei Alexandrovich of Russia is Maria Alexandrovna. Maria Alexandrovna died from tuberculosis. So the answer is: tuberculosis.\n",
"\n",
"\n",
"Context:\n",
"Laughter in Hell: Laughter in Hell is a 1933 American Pre-Code drama film directed by Edward L. Cahn and starring Pat O'Brien. The film's title was typical of the sensationalistic titles of many Pre-Code films.\n",
"Edward L. Cahn: Edward L. Cahn (February 12, 1899 August 25, 1963) was an American film director.\n",
"Q: When did the director of film Laughter In Hell die?\n",
"A: The film Laughter In Hell was directed by Edward L. Cahn. Edward L. Cahn died on August 25, 1963. So the answer is: August 25, 1963.\n",
"\n",
"Second, please complete the answer by thinking step-by-step.\n",
"\n",
"Context:\n",
"Princess Josephine of Baden: Princess Josephine Friederike Luise of Baden( 21 October 1813 19 June 1900) was born at Mannheim, the second daughter of Charles, Grand Duke of Baden and his wife, Stéphanie de Beauharnais. Through her son, Carol I, she is the ancestress of the Romanian royal family and the Yugoslav Royal family. Through her younger daughter Marie, she is also the ancestress of the Belgian royal family and the Grand Ducal family of Luxembourg.\n",
"Archduchess Marie Astrid of Austria: Archduchess Marie Astrid of Austria( née\" Princess Marie Astrid of Luxembourg\"; born 17 February 1954 at Castle Betzdorf) is the elder daughter and eldest child of Grand Duke Jean of Luxembourg and Joséphine- Charlotte of Belgium, and the wife of Archduke Carl Christian of Austria.\n",
"Princess Joséphine Marie of Belgium: Princess Joséphine Marie of Belgium( 30 November 1870 — 18 January 1871) was the daughter of Prince Philippe, Count of Flanders, and Princess Marie of Hohenzollern- Sigmaringen. She was the older twin to Princess Henriette of Belgium. In 1872 Joséphine Marie's mother gave birth to another daughter, who was named Joséphine in her memory.\n",
"Princess Joséphine Marie of Belgium: Princess Joséphine Marie of Belgium (30 November 1870 — 18 January 1871) was the daughter of Prince Philippe, Count of Flanders, and Princess Marie of Hohenzollern-Sigmaringen. She was the older twin to Princess Henriette of Belgium. In 1872 Joséphine Marie's mother gave birth to another daughter, who was named Joséphine in her memory.\n",
"Princess Joséphine Caroline of Belgium: Princess Joséphine Caroline of Belgium( 18 October 1872 6 January 1958) was the youngest daughter of Prince Philippe, Count of Flanders and Princess Marie of Hohenzollern- Sigmaringen. She was an older sister of Albert I of Belgium.\n",
"Federal University of Maranhão: The Federal University of Maranhão( UFMA) is a federal university in the northeastern state of Maranhão, Brazil.\n",
"Princess Margaretha of Liechtenstein: Princess Margaretha of Liechtenstein( born Princess Margaretha of Luxembourg on 15 May 1957) is the fourth child and second and youngest daughter of Grand Duke Jean of Luxembourg and Princess Joséphine- Charlotte of Belgium. As the sister of Grand Duke Henri of Luxembourg and the sister- in- law of Prince Hans- Adam II of Liechtenstein, she is a princess of two current realms and a member of the Luxembourg and Liechtenstein reigning dynasties.\n",
"Federal University, Lokoja: The Federal University, Lokoja, popularly known as Fulokoja, is a federal university in the confluence city of Lokoja, the capital of Kogi State, North- Central Nigeria. Lokoja lies at the confluence of the Niger and Benue rivers. The Federal University, Lokoja was established in February 2011 by the Federal Government of Nigeria as a result of indispensable need to create more universities in the country.\n",
"Princess Luisa Maria of Belgium, Archduchess of Austria-Este: Princess Luisa Maria of Belgium, Archduchess of Austria- Este( Luisa Maria Anna Martine Pilar; born 11 October 1995) is the fourth child and second daughter of Lorenz, Archduke of Austria- Este, and Princess Astrid of Belgium. She was born at the Saint Jean Hospital in Brussels, Belgium, and is currently ninth in line to the Belgian throne.\n",
"Princess Sophie of Greece and Denmark: Princess Sophie of Greece and Denmark( 26 June 1914 24 November 2001) was the fourth child and youngest daughter of Prince Andrew of Greece and Denmark and Princess Alice of Battenberg. The Duke of Edinburgh is her younger brother. Sophie was born at the villa Mon Repos on the island of Corfu in Greece.\n",
"Seoul High School: Seoul High School( Hangul: 서울고등학교) is a public high school located in the heart of Seoul, South Korea.\n",
"Marion High School (Kansas): Marion High School is a public high school in Marion, Kansas, USA. It is one of three schools operated by Marion USD 408, and is the sole high school in the district.\n",
"Marion High School (Indiana): Marion High School is a high school in Marion, Indiana with more than 1,000 students.\n",
"North Marion High School (Oregon): North Marion High School is a public high school in Aurora, Oregon, United States. The school is part of the North Marion School District with all four schools being located on the same campus. The school draws students from the cities of Aurora, Hubbard, and Donald as well as the communities of Broadacres and Butteville.\n",
"Macon County High School: Macon County High School is located in Montezuma, Georgia, United States, which is a part of Macon County. Enrollment as of the 2017- 2018 school year is 491.\n",
"International School of Koje: International School of Koje( ISK) is a privately funded international school located in Geoje, South Korea.\n",
"Springs Boys' High School: Springs Boys' High School is a high school in Springs, Gauteng, South Africa.\n",
"Cherokee High School (Georgia): Cherokee High School is one of six public high schools of the Cherokee County School District in Cherokee County, Georgia, United States. It is located in Canton. Established in 1956, it replaced Canton High School, the county's first high school. There are six high schools in the Cherokee County School District: Etowah High School, Sequoyah High School, Woodstock High School, Creekview High School, and River Ridge High School\n",
"Yoon Jong-hwan: Yoon Jong- Hwan( born 16 February 1973 in Gwangju, South Korea) is a South Korean manager and former football player.\n",
"Hikarigaoka Girls' High School: It was established in 1963.\n",
"I'm sorry, I do not have enough information about North Marion High School and Seoul High School to provide an answer.\n",
"Q: Are North Marion High School (Oregon) and Seoul High School both located in the same country?\n",
"A:\n",
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001b[33massistant\u001b[0m (to ragproxyagent):\n",
"\n",
"No, North Marion High School is located in the United States, specifically in Oregon, while Seoul High School is located in South Korea. They are not located in the same country.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001b[32mUpdating context and resetting conversation.\u001b[0m\n",
"doc_ids: [['doc_68', 'doc_74', 'doc_76', 'doc_75', 'doc_19596', 'doc_69', 'doc_7274', 'doc_24819', 'doc_995', 'doc_23187']]\n",
"\u001b[32mAdding doc_id doc_69 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_24819 to context.\u001b[0m\n",
"\u001b[32mAdding doc_id doc_995 to context.\u001b[0m\n",
"\u001b[33mragproxyagent\u001b[0m (to assistant):\n",
"\n",
"You're a retrieve augmented chatbot. You answer user's questions based on your own knowledge and the context provided by the user. You must think step-by-step.\n",
"First, please learn the following examples of context and question pairs and their corresponding answers.\n",
"\n",
"Context:\n",
"Kurram Garhi: Kurram Garhi is a small village located near the city of Bannu, which is the part of Khyber Pakhtunkhwa province of Pakistan. Its population is approximately 35000.\n",
"Trojkrsti: Trojkrsti is a village in Municipality of Prilep, Republic of Macedonia.\n",
"Q: Are both Kurram Garhi and Trojkrsti located in the same country?\n",
"A: Kurram Garhi is located in the country of Pakistan. Trojkrsti is located in the country of Republic of Macedonia. Thus, they are not in the same country. So the answer is: no.\n",
"\n",
"\n",
"Context:\n",
"Early Side of Later: Early Side of Later is the third studio album by English singer- songwriter Matt Goss. It was released on 21 June 2004 by Concept Music and reached No. 78 on the UK Albums Chart.\n",
"What's Inside: What's Inside is the fourteenth studio album by British singer- songwriter Joan Armatrading.\n",
"Q: Which album was released earlier, What'S Inside or Cassandra'S Dream (Album)?\n",
"A: What's Inside was released in the year 1995. Cassandra's Dream (album) was released in the year 2008. Thus, of the two, the album to release earlier is What's Inside. So the answer is: What's Inside.\n",
"\n",
"\n",
"Context:\n",
"Maria Alexandrovna (Marie of Hesse): Maria Alexandrovna , born Princess Marie of Hesse and by Rhine (8 August 1824 3 June 1880) was Empress of Russia as the first wife of Emperor Alexander II.\n",
"Grand Duke Alexei Alexandrovich of Russia: Grand Duke Alexei Alexandrovich of Russia,(Russian: Алексей Александрович; 14 January 1850 (2 January O.S.) in St. Petersburg 14 November 1908 in Paris) was the fifth child and the fourth son of Alexander II of Russia and his first wife Maria Alexandrovna (Marie of Hesse).\n",
"Q: What is the cause of death of Grand Duke Alexei Alexandrovich Of Russia's mother?\n",
"A: The mother of Grand Duke Alexei Alexandrovich of Russia is Maria Alexandrovna. Maria Alexandrovna died from tuberculosis. So the answer is: tuberculosis.\n",
"\n",
"\n",
"Context:\n",
"Laughter in Hell: Laughter in Hell is a 1933 American Pre-Code drama film directed by Edward L. Cahn and starring Pat O'Brien. The film's title was typical of the sensationalistic titles of many Pre-Code films.\n",
"Edward L. Cahn: Edward L. Cahn (February 12, 1899 August 25, 1963) was an American film director.\n",
"Q: When did the director of film Laughter In Hell die?\n",
"A: The film Laughter In Hell was directed by Edward L. Cahn. Edward L. Cahn died on August 25, 1963. So the answer is: August 25, 1963.\n",
"\n",
"Second, please complete the answer by thinking step-by-step.\n",
"\n",
"Context:\n",
"Princess Josephine of Baden: Princess Josephine Friederike Luise of Baden( 21 October 1813 19 June 1900) was born at Mannheim, the second daughter of Charles, Grand Duke of Baden and his wife, Stéphanie de Beauharnais. Through her son, Carol I, she is the ancestress of the Romanian royal family and the Yugoslav Royal family. Through her younger daughter Marie, she is also the ancestress of the Belgian royal family and the Grand Ducal family of Luxembourg.\n",
"Archduchess Marie Astrid of Austria: Archduchess Marie Astrid of Austria( née\" Princess Marie Astrid of Luxembourg\"; born 17 February 1954 at Castle Betzdorf) is the elder daughter and eldest child of Grand Duke Jean of Luxembourg and Joséphine- Charlotte of Belgium, and the wife of Archduke Carl Christian of Austria.\n",
"Princess Joséphine Marie of Belgium: Princess Joséphine Marie of Belgium( 30 November 1870 — 18 January 1871) was the daughter of Prince Philippe, Count of Flanders, and Princess Marie of Hohenzollern- Sigmaringen. She was the older twin to Princess Henriette of Belgium. In 1872 Joséphine Marie's mother gave birth to another daughter, who was named Joséphine in her memory.\n",
"Princess Joséphine Marie of Belgium: Princess Joséphine Marie of Belgium (30 November 1870 — 18 January 1871) was the daughter of Prince Philippe, Count of Flanders, and Princess Marie of Hohenzollern-Sigmaringen. She was the older twin to Princess Henriette of Belgium. In 1872 Joséphine Marie's mother gave birth to another daughter, who was named Joséphine in her memory.\n",
"Princess Joséphine Caroline of Belgium: Princess Joséphine Caroline of Belgium( 18 October 1872 6 January 1958) was the youngest daughter of Prince Philippe, Count of Flanders and Princess Marie of Hohenzollern- Sigmaringen. She was an older sister of Albert I of Belgium.\n",
"Federal University of Maranhão: The Federal University of Maranhão( UFMA) is a federal university in the northeastern state of Maranhão, Brazil.\n",
"Princess Margaretha of Liechtenstein: Princess Margaretha of Liechtenstein( born Princess Margaretha of Luxembourg on 15 May 1957) is the fourth child and second and youngest daughter of Grand Duke Jean of Luxembourg and Princess Joséphine- Charlotte of Belgium. As the sister of Grand Duke Henri of Luxembourg and the sister- in- law of Prince Hans- Adam II of Liechtenstein, she is a princess of two current realms and a member of the Luxembourg and Liechtenstein reigning dynasties.\n",
"Federal University, Lokoja: The Federal University, Lokoja, popularly known as Fulokoja, is a federal university in the confluence city of Lokoja, the capital of Kogi State, North- Central Nigeria. Lokoja lies at the confluence of the Niger and Benue rivers. The Federal University, Lokoja was established in February 2011 by the Federal Government of Nigeria as a result of indispensable need to create more universities in the country.\n",
"Princess Luisa Maria of Belgium, Archduchess of Austria-Este: Princess Luisa Maria of Belgium, Archduchess of Austria- Este( Luisa Maria Anna Martine Pilar; born 11 October 1995) is the fourth child and second daughter of Lorenz, Archduke of Austria- Este, and Princess Astrid of Belgium. She was born at the Saint Jean Hospital in Brussels, Belgium, and is currently ninth in line to the Belgian throne.\n",
"Princess Sophie of Greece and Denmark: Princess Sophie of Greece and Denmark( 26 June 1914 24 November 2001) was the fourth child and youngest daughter of Prince Andrew of Greece and Denmark and Princess Alice of Battenberg. The Duke of Edinburgh is her younger brother. Sophie was born at the villa Mon Repos on the island of Corfu in Greece.\n",
"Seoul High School: Seoul High School( Hangul: 서울고등학교) is a public high school located in the heart of Seoul, South Korea.\n",
"Marion High School (Kansas): Marion High School is a public high school in Marion, Kansas, USA. It is one of three schools operated by Marion USD 408, and is the sole high school in the district.\n",
"Marion High School (Indiana): Marion High School is a high school in Marion, Indiana with more than 1,000 students.\n",
"North Marion High School (Oregon): North Marion High School is a public high school in Aurora, Oregon, United States. The school is part of the North Marion School District with all four schools being located on the same campus. The school draws students from the cities of Aurora, Hubbard, and Donald as well as the communities of Broadacres and Butteville.\n",
"Macon County High School: Macon County High School is located in Montezuma, Georgia, United States, which is a part of Macon County. Enrollment as of the 2017- 2018 school year is 491.\n",
"International School of Koje: International School of Koje( ISK) is a privately funded international school located in Geoje, South Korea.\n",
"Springs Boys' High School: Springs Boys' High School is a high school in Springs, Gauteng, South Africa.\n",
"Cherokee High School (Georgia): Cherokee High School is one of six public high schools of the Cherokee County School District in Cherokee County, Georgia, United States. It is located in Canton. Established in 1956, it replaced Canton High School, the county's first high school. There are six high schools in the Cherokee County School District: Etowah High School, Sequoyah High School, Woodstock High School, Creekview High School, and River Ridge High School\n",
"Yoon Jong-hwan: Yoon Jong- Hwan( born 16 February 1973 in Gwangju, South Korea) is a South Korean manager and former football player.\n",
"Hikarigaoka Girls' High School: It was established in 1963.\n",
"North Marion High School (West Virginia): North Marion High School is a public Double A (\"AA\") high school in the U.S. state of West Virginia, with a current enrollment of 851 students. North Marion High School is located approximately 4 miles from Farmington, West Virginia on US Route 250 north. While it is closer to the city of Mannington, West Virginia, and is often considered to be located in Rachel, West Virginia, the school mailing address is Farmington. Rachel is a small coal mining community located adjacent to the school, and is an unincorporated municipality. North Marion High School is represented as \"Grantville High School\" in the popular alternative history novel \"1632\" by writer Eric Flint. The novel is set in the fictional town of Grantville, which is based on the real town and surroundings of Mannington.\n",
"Anderson High School (Anderson, Indiana): Anderson High School is a public high school located in Anderson, Indiana.\n",
"Northside High School: Northside High School or North Side High School or Northside Christian School or similar can refer to:\n",
"I'm sorry, I do not have enough information about North Marion High School and Seoul High School to provide an answer.\n",
"No, North Marion High School is located in the United States, specifically in Oregon, while Seoul High School is located in South Korea.\n",
"Q: Are North Marion High School (Oregon) and Seoul High School both located in the same country?\n",
"A:\n",
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001b[33massistant\u001b[0m (to ragproxyagent):\n",
"\n",
"No, North Marion High School is located in the United States, specifically in Oregon, while Seoul High School is located in South Korea. So the answer is: no.\n",
"\n",
"--------------------------------------------------------------------------------\n"
]
}
],
"source": [
"for i in range(len(questions)):\n",
" print(f\"\\n\\n>>>>>>>>>>>> Below are outputs of Case {i+1} <<<<<<<<<<<<\\n\\n\")\n",
"\n",
" # reset the assistant. Always reset the assistant before starting a new conversation.\n",
" assistant.reset()\n",
" \n",
" qa_problem = questions[i]\n",
" ragproxyagent.initiate_chat(assistant, problem=qa_problem, n_results=10)"
]
}
],
"metadata": {
@ -3697,7 +4144,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.10.12"
}
},
"nbformat": 4,

View File

@ -23,6 +23,11 @@ except ImportError:
reason="do not run on MacOS or windows",
)
def test_retrievechat():
try:
import openai
except ImportError:
return
conversations = {}
autogen.ChatCompletion.start_logging(conversations)