|
38 | 38 | }, |
39 | 39 | { |
40 | 40 | "cell_type": "code", |
41 | | - "execution_count": 13, |
| 41 | + "execution_count": 3, |
42 | 42 | "metadata": {}, |
43 | 43 | "outputs": [ |
44 | 44 | { |
|
50 | 50 | "\n", |
51 | 51 | "\n", |
52 | 52 | "Installing hub:\u001b[35m/\u001b[0m\u001b[35m/guardrails/\u001b[0m\u001b[95mcompetitor_check...\u001b[0m\n", |
53 | | - "✅Successfully installed guardrails/competitor_check version \u001b[1;36m0.0\u001b[0m.\u001b[1;36m1\u001b[0m!\n", |
| 53 | + "✅Successfully installed guardrails/competitor_check!\n", |
54 | 54 | "\n", |
55 | 55 | "\n" |
56 | 56 | ] |
57 | 57 | } |
58 | 58 | ], |
59 | 59 | "source": [ |
60 | | - "! guardrails hub install hub://guardrails/detect_pii --no-install-local-models -q\n", |
61 | | - "! guardrails hub install hub://guardrails/competitor_check --no-install-local-models -q" |
| 60 | + "! guardrails hub install hub://guardrails/detect_pii hub://guardrails/competitor_check --no-install-local-models -q" |
62 | 61 | ] |
63 | 62 | }, |
64 | 63 | { |
|
70 | 69 | }, |
71 | 70 | { |
72 | 71 | "cell_type": "code", |
73 | | - "execution_count": 6, |
| 72 | + "execution_count": 4, |
74 | 73 | "metadata": {}, |
75 | 74 | "outputs": [ |
76 | 75 | { |
|
79 | 78 | "text": [ |
80 | 79 | " % Total % Received % Xferd Average Speed Time Time Time Current\n", |
81 | 80 | " Dload Upload Total Spent Left Speed\n", |
82 | | - "100 75042 100 75042 0 0 959k 0 --:--:-- --:--:-- --:--:-- 964k\n" |
| 81 | + "100 75042 100 75042 0 0 353k 0 --:--:-- --:--:-- --:--:-- 354k\n" |
83 | 82 | ] |
84 | 83 | } |
85 | 84 | ], |
|
99 | 98 | }, |
100 | 99 | { |
101 | 100 | "cell_type": "code", |
102 | | - "execution_count": 7, |
| 101 | + "execution_count": 1, |
103 | 102 | "metadata": {}, |
104 | 103 | "outputs": [], |
105 | 104 | "source": [ |
|
136 | 135 | }, |
137 | 136 | { |
138 | 137 | "cell_type": "code", |
139 | | - "execution_count": 8, |
| 138 | + "execution_count": 2, |
140 | 139 | "metadata": {}, |
141 | 140 | "outputs": [], |
142 | 141 | "source": [ |
|
148 | 147 | " competitors=[\"Fortran\", \"Ada\", \"Pascal\"],\n", |
149 | 148 | " on_fail=\"fix\"\n", |
150 | 149 | " )\n", |
151 | | - ").use(DetectPII(pii_entities=\"pii\", on_fail=\"fix\"))" |
| 150 | + ").use(DetectPII(pii_entities=[\"PERSON\", \"EMAIL_ADDRESS\"], on_fail=\"fix\"))" |
152 | 151 | ] |
153 | 152 | }, |
154 | 153 | { |
|
162 | 161 | }, |
163 | 162 | { |
164 | 163 | "cell_type": "code", |
165 | | - "execution_count": 9, |
| 164 | + "execution_count": 3, |
166 | 165 | "metadata": {}, |
167 | 166 | "outputs": [ |
168 | 167 | { |
169 | 168 | "name": "stdout", |
170 | 169 | "output_type": "stream", |
171 | 170 | "text": [ |
172 | | - "The author worked on writing short stories and programming, starting with early attempts on an IBM 1401 using Fortran in 9th grade, and later transitioning to microcomputers like the TRS-80 and Apple II to write games, rocket prediction programs, and a word processor.\n" |
| 171 | + "The author is Paul Graham. Growing up, he worked on writing short stories and programming, starting with the IBM 1401 in 9th grade using an early version of Fortran. Later, he transitioned to microcomputers like the TRS-80 and began programming more extensively, creating simple games and a word processor.\n" |
173 | 172 | ] |
174 | 173 | } |
175 | 174 | ], |
176 | 175 | "source": [ |
177 | 176 | "# Use index on it's own\n", |
178 | 177 | "query_engine = index.as_query_engine()\n", |
179 | | - "response = query_engine.query(\"What did the author do growing up?\")\n", |
| 178 | + "response = query_engine.query(\"Who is the author and what did they do growing up?\")\n", |
180 | 179 | "print(response)" |
181 | 180 | ] |
182 | 181 | }, |
|
189 | 188 | }, |
190 | 189 | { |
191 | 190 | "cell_type": "code", |
192 | | - "execution_count": 11, |
| 191 | + "execution_count": null, |
193 | 192 | "metadata": {}, |
194 | 193 | "outputs": [ |
195 | 194 | { |
196 | 195 | "name": "stdout", |
197 | 196 | "output_type": "stream", |
198 | 197 | "text": [ |
199 | | - "The author worked on writing short stories and programming, starting with early attempts on an IBM 1401 using [COMPETITOR] in 9th <URL>er, the author transitioned to microcomputers, building a Heathkit kit and eventually getting a TRS-80 to write simple games and <URL>spite enjoying programming, the author initially planned to study philosophy in college but eventually switched to AI due to a lack of interest in philosophy courses.\n" |
| 198 | + "The author is <PERSON>. Growing up, he worked on writing short stories and programming, starting with the IBM 1401 in 9th grade using an early version of [COMPETITOR]. Later, he transitioned to microcomputers like the TRS-80 and Apple II, where he wrote simple games, programs, and a word processor. \n" |
200 | 199 | ] |
201 | 200 | } |
202 | 201 | ], |
|
206 | 205 | "\n", |
207 | 206 | "guardrails_query_engine = GuardrailsQueryEngine(engine=query_engine, guard=guard)\n", |
208 | 207 | "\n", |
209 | | - "response = guardrails_query_engine.query(\"What did the author do growing up?\")\n", |
| 208 | + "response = guardrails_query_engine.query(\"Who is the author and what did they do growing up?\")\n", |
210 | 209 | "print(response)\n", |
211 | 210 | " " |
212 | 211 | ] |
|
220 | 219 | }, |
221 | 220 | { |
222 | 221 | "cell_type": "code", |
223 | | - "execution_count": 12, |
| 222 | + "execution_count": null, |
224 | 223 | "metadata": {}, |
225 | 224 | "outputs": [ |
226 | 225 | { |
227 | 226 | "name": "stdout", |
228 | 227 | "output_type": "stream", |
229 | 228 | "text": [ |
230 | | - "The author worked on writing short stories and programming while growing <URL>ey started with early attempts on an IBM 1401 using [COMPETITOR] in 9th <URL>er, they transitioned to microcomputers, building simple games and a word processor on a TRS-80 in <DATE_TIME>.\n" |
| 229 | + "The author is <PERSON>. Growing up, he worked on writing short stories and programming. He started with early attempts on an IBM 1401 using [COMPETITOR] in 9th grade. Later, he transitioned to microcomputers, building a Heathkit kit and eventually getting a TRS-80 to write simple games and programs. Despite enjoying programming, he initially planned to study philosophy in college but eventually switched to AI due to a lack of interest in philosophy courses. \n" |
231 | 230 | ] |
232 | 231 | } |
233 | 232 | ], |
|
237 | 236 | "chat_engine = index.as_chat_engine()\n", |
238 | 237 | "guardrails_chat_engine = GuardrailsChatEngine(engine=chat_engine, guard=guard)\n", |
239 | 238 | "\n", |
240 | | - "response = guardrails_chat_engine.chat(\"Tell me what the author did growing up.\")\n", |
| 239 | + "response = guardrails_chat_engine.chat(\"Tell me who the author is and what they did growing up.\")\n", |
241 | 240 | "print(response)" |
242 | 241 | ] |
243 | 242 | } |
|
0 commit comments