Spaces:
Runtime error
Runtime error
π Add some examples
Browse files- .gitignore +2 -1
- examples/example.ipynb +70 -0
- examples/files/facts.txt +20 -0
- qnabot/__init__.py +1 -0
- requirements.txt +48 -1
- setup.py +3 -1
.gitignore
CHANGED
|
@@ -3,4 +3,5 @@ __pycache__
|
|
| 3 |
.pytest_cache
|
| 4 |
qnabot.egg-info
|
| 5 |
dist
|
| 6 |
-
build
|
|
|
|
|
|
| 3 |
.pytest_cache
|
| 4 |
qnabot.egg-info
|
| 5 |
dist
|
| 6 |
+
build
|
| 7 |
+
**.pickle
|
examples/example.ipynb
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 15,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [
|
| 8 |
+
{
|
| 9 |
+
"name": "stdout",
|
| 10 |
+
"output_type": "stream",
|
| 11 |
+
"text": [
|
| 12 |
+
"Using model: gpt-3.5-turbo\n",
|
| 13 |
+
"Creating index...\n"
|
| 14 |
+
]
|
| 15 |
+
}
|
| 16 |
+
],
|
| 17 |
+
"source": [
|
| 18 |
+
"from qnabot.QnABot import QnABot\n",
|
| 19 |
+
"import os, sys\n",
|
| 20 |
+
"\n",
|
| 21 |
+
"os.environ[\"OPENAI_API_KEY\"] = \"you api key\"\n",
|
| 22 |
+
"\n",
|
| 23 |
+
"bot = QnABot(directory=\"./files\")"
|
| 24 |
+
]
|
| 25 |
+
},
|
| 26 |
+
{
|
| 27 |
+
"cell_type": "code",
|
| 28 |
+
"execution_count": 18,
|
| 29 |
+
"metadata": {},
|
| 30 |
+
"outputs": [
|
| 31 |
+
{
|
| 32 |
+
"name": "stdout",
|
| 33 |
+
"output_type": "stream",
|
| 34 |
+
"text": [
|
| 35 |
+
"The first roster of the Avengers in comics included Iron Man, Thor, Hulk, Ant-Man, and the Wasp.\n",
|
| 36 |
+
"SOURCES: files/facts.txt\n",
|
| 37 |
+
"Vision is an android superhero who was created by Ultron but ultimately joined the Avengers and became an important member of the team.\n",
|
| 38 |
+
"SOURCES: files/facts.txt\n"
|
| 39 |
+
]
|
| 40 |
+
}
|
| 41 |
+
],
|
| 42 |
+
"source": [
|
| 43 |
+
"bot.print_answer(\"what was the first roster of angers in comics?\")\n",
|
| 44 |
+
"bot.print_answer(\"Who is Vision?\")"
|
| 45 |
+
]
|
| 46 |
+
}
|
| 47 |
+
],
|
| 48 |
+
"metadata": {
|
| 49 |
+
"kernelspec": {
|
| 50 |
+
"display_name": ".venv",
|
| 51 |
+
"language": "python",
|
| 52 |
+
"name": "python3"
|
| 53 |
+
},
|
| 54 |
+
"language_info": {
|
| 55 |
+
"codemirror_mode": {
|
| 56 |
+
"name": "ipython",
|
| 57 |
+
"version": 3
|
| 58 |
+
},
|
| 59 |
+
"file_extension": ".py",
|
| 60 |
+
"mimetype": "text/x-python",
|
| 61 |
+
"name": "python",
|
| 62 |
+
"nbconvert_exporter": "python",
|
| 63 |
+
"pygments_lexer": "ipython3",
|
| 64 |
+
"version": "3.10.0"
|
| 65 |
+
},
|
| 66 |
+
"orig_nbformat": 4
|
| 67 |
+
},
|
| 68 |
+
"nbformat": 4,
|
| 69 |
+
"nbformat_minor": 2
|
| 70 |
+
}
|
examples/files/facts.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The Avengers first appeared in Marvel Comics in September 1963 with "The Avengers #1."
|
| 2 |
+
The original Avengers lineup included Iron Man, Thor, Hulk, Ant-Man, and the Wasp.
|
| 3 |
+
Captain America joined the team in "The Avengers #4" (March 1964) after being discovered frozen in ice.
|
| 4 |
+
The Avengers were created by writer Stan Lee and artist Jack Kirby, two comic book legends.
|
| 5 |
+
The team's battle cry, "Avengers Assemble!", was first used in "The Avengers #10" (November 1964).
|
| 6 |
+
The Avengers have had numerous lineup changes over the years, with many Marvel characters joining and leaving the team.
|
| 7 |
+
The Avengers' primary headquarters is the Avengers Mansion, located in New York City, but they have had other bases such as the Avengers Tower and the Hydrobase.
|
| 8 |
+
Jarvis, the loyal butler, has been a supporting character in the comics, often assisting the team and maintaining the mansion.
|
| 9 |
+
The Avengers have had various sub-teams and spin-offs, including the West Coast Avengers, Secret Avengers, and Young Avengers.
|
| 10 |
+
The 2012 film "The Avengers," directed by Joss Whedon, was the first Marvel Cinematic Universe movie to feature the superhero team.
|
| 11 |
+
In the MCU, the team was initially formed by Nick Fury, director of S.H.I.E.L.D., as part of his "Avengers Initiative."
|
| 12 |
+
The MCU Avengers lineup included Iron Man, Captain America, Thor, Hulk, Black Widow, and Hawkeye.
|
| 13 |
+
"The Avengers" (2012) was the first Marvel film to gross over $1 billion at the box office.
|
| 14 |
+
The MCU Avengers have appeared in four main films: "The Avengers" (2012), "Avengers: Age of Ultron" (2015), "Avengers: Infinity War" (2018), and "Avengers: Endgame" (2019).
|
| 15 |
+
"Avengers: Endgame" (2019) became the highest-grossing film of all time, overtaking "Avatar" (2009).
|
| 16 |
+
The Avengers often face world-threatening villains, such as Loki, Ultron, and Thanos.
|
| 17 |
+
The Vision, an android superhero, was created by Ultron but ultimately joined the Avengers and became an important member of the team.
|
| 18 |
+
In the comics, Scarlet Witch and Quicksilver, who are siblings, initially were members of the villainous Brotherhood of Mutants before joining the Avengers.
|
| 19 |
+
The Avengers have crossed over with other superhero teams, such as the X-Men and the Fantastic Four, in various comic book storylines.
|
| 20 |
+
The Avengers have appeared in numerous animated TV series, including "The Avengers: Earth's Mightiest Heroes" (2010-2012) and "Avengers Assemble" (2013-2019).
|
qnabot/__init__.py
CHANGED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
from .QnABot import QnABot
|
requirements.txt
CHANGED
|
@@ -1,42 +1,70 @@
|
|
| 1 |
aiohttp==3.8.4
|
| 2 |
aiosignal==1.3.1
|
|
|
|
| 3 |
appnope==0.1.3
|
|
|
|
| 4 |
asttokens==2.2.1
|
| 5 |
async-timeout==4.0.2
|
| 6 |
attrs==22.2.0
|
| 7 |
backcall==0.2.0
|
|
|
|
| 8 |
black==23.3.0
|
|
|
|
| 9 |
certifi==2022.12.7
|
| 10 |
charset-normalizer==3.1.0
|
| 11 |
click==8.1.3
|
| 12 |
comm==0.1.3
|
|
|
|
| 13 |
dataclasses-json==0.5.7
|
| 14 |
debugpy==1.6.7
|
| 15 |
decorator==5.1.1
|
|
|
|
|
|
|
|
|
|
| 16 |
executing==1.2.0
|
| 17 |
faiss-cpu==1.7.3
|
| 18 |
frozenlist==1.3.3
|
|
|
|
|
|
|
|
|
|
| 19 |
idna==3.4
|
|
|
|
| 20 |
ipykernel==6.22.0
|
| 21 |
ipython==8.12.0
|
|
|
|
| 22 |
jedi==0.18.2
|
|
|
|
| 23 |
jupyter_client==8.1.0
|
| 24 |
jupyter_core==5.3.0
|
|
|
|
| 25 |
langchain==0.0.137
|
|
|
|
|
|
|
|
|
|
| 26 |
marshmallow==3.19.0
|
| 27 |
marshmallow-enum==1.5.1
|
| 28 |
matplotlib-inline==0.1.6
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
multidict==6.0.4
|
| 30 |
mypy-extensions==1.0.0
|
| 31 |
nest-asyncio==1.5.6
|
| 32 |
-
|
|
|
|
|
|
|
| 33 |
openai==0.27.4
|
| 34 |
openapi-schema-pydantic==1.2.4
|
|
|
|
| 35 |
packaging==23.0
|
|
|
|
| 36 |
parso==0.8.3
|
| 37 |
pathspec==0.11.1
|
| 38 |
pexpect==4.8.0
|
| 39 |
pickleshare==0.7.5
|
|
|
|
|
|
|
| 40 |
platformdirs==3.2.0
|
| 41 |
prompt-toolkit==3.0.38
|
| 42 |
psutil==5.9.4
|
|
@@ -44,20 +72,39 @@ ptyprocess==0.7.0
|
|
| 44 |
pure-eval==0.2.2
|
| 45 |
pydantic==1.10.7
|
| 46 |
Pygments==2.15.0
|
|
|
|
| 47 |
python-dateutil==2.8.2
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
PyYAML==6.0
|
| 49 |
pyzmq==25.0.2
|
|
|
|
|
|
|
|
|
|
| 50 |
requests==2.28.2
|
|
|
|
|
|
|
|
|
|
| 51 |
six==1.16.0
|
|
|
|
| 52 |
SQLAlchemy==1.4.47
|
| 53 |
stack-data==0.6.2
|
| 54 |
tenacity==8.2.2
|
|
|
|
| 55 |
tomli==2.0.1
|
| 56 |
tornado==6.2
|
| 57 |
tqdm==4.65.0
|
| 58 |
traitlets==5.9.0
|
|
|
|
| 59 |
typing-inspect==0.8.0
|
| 60 |
typing_extensions==4.5.0
|
|
|
|
| 61 |
urllib3==1.26.15
|
| 62 |
wcwidth==0.2.6
|
|
|
|
|
|
|
|
|
|
| 63 |
yarl==1.8.2
|
|
|
|
|
|
| 1 |
aiohttp==3.8.4
|
| 2 |
aiosignal==1.3.1
|
| 3 |
+
anyio==3.6.2
|
| 4 |
appnope==0.1.3
|
| 5 |
+
argilla==1.6.0
|
| 6 |
asttokens==2.2.1
|
| 7 |
async-timeout==4.0.2
|
| 8 |
attrs==22.2.0
|
| 9 |
backcall==0.2.0
|
| 10 |
+
backoff==2.2.1
|
| 11 |
black==23.3.0
|
| 12 |
+
bleach==6.0.0
|
| 13 |
certifi==2022.12.7
|
| 14 |
charset-normalizer==3.1.0
|
| 15 |
click==8.1.3
|
| 16 |
comm==0.1.3
|
| 17 |
+
commonmark==0.9.1
|
| 18 |
dataclasses-json==0.5.7
|
| 19 |
debugpy==1.6.7
|
| 20 |
decorator==5.1.1
|
| 21 |
+
Deprecated==1.2.13
|
| 22 |
+
docutils==0.19
|
| 23 |
+
et-xmlfile==1.1.0
|
| 24 |
executing==1.2.0
|
| 25 |
faiss-cpu==1.7.3
|
| 26 |
frozenlist==1.3.3
|
| 27 |
+
h11==0.14.0
|
| 28 |
+
httpcore==0.16.3
|
| 29 |
+
httpx==0.23.3
|
| 30 |
idna==3.4
|
| 31 |
+
importlib-metadata==6.3.0
|
| 32 |
ipykernel==6.22.0
|
| 33 |
ipython==8.12.0
|
| 34 |
+
jaraco.classes==3.2.3
|
| 35 |
jedi==0.18.2
|
| 36 |
+
joblib==1.2.0
|
| 37 |
jupyter_client==8.1.0
|
| 38 |
jupyter_core==5.3.0
|
| 39 |
+
keyring==23.13.1
|
| 40 |
langchain==0.0.137
|
| 41 |
+
lxml==4.9.2
|
| 42 |
+
Markdown==3.4.3
|
| 43 |
+
markdown-it-py==2.2.0
|
| 44 |
marshmallow==3.19.0
|
| 45 |
marshmallow-enum==1.5.1
|
| 46 |
matplotlib-inline==0.1.6
|
| 47 |
+
mdurl==0.1.2
|
| 48 |
+
monotonic==1.6
|
| 49 |
+
more-itertools==9.1.0
|
| 50 |
+
msg-parser==1.2.0
|
| 51 |
multidict==6.0.4
|
| 52 |
mypy-extensions==1.0.0
|
| 53 |
nest-asyncio==1.5.6
|
| 54 |
+
nltk==3.8.1
|
| 55 |
+
numpy==1.23.5
|
| 56 |
+
olefile==0.46
|
| 57 |
openai==0.27.4
|
| 58 |
openapi-schema-pydantic==1.2.4
|
| 59 |
+
openpyxl==3.1.2
|
| 60 |
packaging==23.0
|
| 61 |
+
pandas==1.5.3
|
| 62 |
parso==0.8.3
|
| 63 |
pathspec==0.11.1
|
| 64 |
pexpect==4.8.0
|
| 65 |
pickleshare==0.7.5
|
| 66 |
+
Pillow==9.5.0
|
| 67 |
+
pkginfo==1.9.6
|
| 68 |
platformdirs==3.2.0
|
| 69 |
prompt-toolkit==3.0.38
|
| 70 |
psutil==5.9.4
|
|
|
|
| 72 |
pure-eval==0.2.2
|
| 73 |
pydantic==1.10.7
|
| 74 |
Pygments==2.15.0
|
| 75 |
+
pypandoc==1.11
|
| 76 |
python-dateutil==2.8.2
|
| 77 |
+
python-docx==0.8.11
|
| 78 |
+
python-magic==0.4.27
|
| 79 |
+
python-pptx==0.6.21
|
| 80 |
+
pytz==2023.3
|
| 81 |
PyYAML==6.0
|
| 82 |
pyzmq==25.0.2
|
| 83 |
+
qnabot==0.0.2
|
| 84 |
+
readme-renderer==37.3
|
| 85 |
+
regex==2023.3.23
|
| 86 |
requests==2.28.2
|
| 87 |
+
requests-toolbelt==0.10.1
|
| 88 |
+
rfc3986==1.5.0
|
| 89 |
+
rich==13.0.1
|
| 90 |
six==1.16.0
|
| 91 |
+
sniffio==1.3.0
|
| 92 |
SQLAlchemy==1.4.47
|
| 93 |
stack-data==0.6.2
|
| 94 |
tenacity==8.2.2
|
| 95 |
+
tiktoken==0.3.3
|
| 96 |
tomli==2.0.1
|
| 97 |
tornado==6.2
|
| 98 |
tqdm==4.65.0
|
| 99 |
traitlets==5.9.0
|
| 100 |
+
twine==4.0.2
|
| 101 |
typing-inspect==0.8.0
|
| 102 |
typing_extensions==4.5.0
|
| 103 |
+
unstructured==0.5.11
|
| 104 |
urllib3==1.26.15
|
| 105 |
wcwidth==0.2.6
|
| 106 |
+
webencodings==0.5.1
|
| 107 |
+
wrapt==1.14.1
|
| 108 |
+
XlsxWriter==3.0.9
|
| 109 |
yarl==1.8.2
|
| 110 |
+
zipp==3.15.0
|
setup.py
CHANGED
|
@@ -1,8 +1,10 @@
|
|
| 1 |
from setuptools import setup, find_packages
|
| 2 |
|
|
|
|
|
|
|
| 3 |
setup(
|
| 4 |
name="qnabot",
|
| 5 |
-
version=
|
| 6 |
packages=find_packages(),
|
| 7 |
install_requires=[
|
| 8 |
# List your package's dependencies here, e.g.,
|
|
|
|
| 1 |
from setuptools import setup, find_packages
|
| 2 |
|
| 3 |
+
VERSION = "0.0.3"
|
| 4 |
+
|
| 5 |
setup(
|
| 6 |
name="qnabot",
|
| 7 |
+
version=VERSION,
|
| 8 |
packages=find_packages(),
|
| 9 |
install_requires=[
|
| 10 |
# List your package's dependencies here, e.g.,
|