File size: 1,659 Bytes
2c8cfc0
 
 
 
fcd5226
2c8cfc0
 
 
 
 
 
 
fcd5226
2c8cfc0
 
 
 
fcd5226
 
2c8cfc0
fcd5226
2c8cfc0
fcd5226
 
2c8cfc0
 
 
 
fcd5226
2c8cfc0
 
 
 
 
 
fcd5226
 
2c8cfc0
fcd5226
2c8cfc0
 
 
 
f4e889a
2c8cfc0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Using model: gpt-3.5-turbo\n",
      "Loading path from disk...\n"
     ]
    }
   ],
   "source": [
    "from qnabot import QnABot\n",
    "from dotenv import load_dotenv\n",
    "\n",
    "load_dotenv()\n",
    "\n",
    "bot = QnABot(directory=\"./examples/files\", index=\"./index.pkl\", verbose=True)\n",
    "# bot.save_index(\"./index.pkl\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The first roster of Avengers in comics included Iron Man, Thor, Hulk, Ant-Man, and the Wasp.\n",
      "SOURCES: examples/files/facts.txt\n",
      "Vision is an android superhero who was created by Ultron but ultimately joined the Avengers and became an important member of the team.\n",
      "SOURCES: examples/files/facts.txt\n"
     ]
    }
   ],
   "source": [
    "bot.print_answer(\"what was the first roster of avengers in comics?\")\n",
    "bot.print_answer(\"Who is Vision?\")"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.0"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}