|
94 | 94 | "\n", |
95 | 95 | "\n", |
96 | 96 | "\n", |
97 | | - "\u001b[34m[2024-11-23T22:12:48.901453]\u001b[0m\n", |
| 97 | + "\u001b[34m[2024-11-23T23:16:35.966534]\u001b[0m\n", |
98 | 98 | "\n", |
99 | 99 | "\u001b[31mSystem message:\u001b[0m\n", |
100 | 100 | "\n", |
|
404 | 404 | "\n", |
405 | 405 | "\n", |
406 | 406 | "\n", |
407 | | - "\u001b[34m[2024-11-23T22:12:49.329836]\u001b[0m\n", |
| 407 | + "\u001b[34m[2024-11-23T23:16:36.149518]\u001b[0m\n", |
408 | 408 | "\n", |
409 | 409 | "\u001b[31mSystem message:\u001b[0m\n", |
410 | 410 | "\n", |
|
527 | 527 | "name": "stdout", |
528 | 528 | "output_type": "stream", |
529 | 529 | "text": [ |
530 | | - "Average Metric: 125.68 / 300 (41.9%): 100%|██████████| 300/300 [00:00<00:00, 598.18it/s]" |
| 530 | + "Average Metric: 125.68 / 300 (41.9%): 100%|██████████| 300/300 [00:00<00:00, 666.96it/s]" |
531 | 531 | ] |
532 | 532 | }, |
533 | 533 | { |
534 | 534 | "name": "stderr", |
535 | 535 | "output_type": "stream", |
536 | 536 | "text": [ |
537 | | - "2024/11/23 22:12:49 INFO dspy.evaluate.evaluate: Average Metric: 125.68228336477591 / 300 (41.9%)\n" |
| 537 | + "2024/11/23 23:16:36 INFO dspy.evaluate.evaluate: Average Metric: 125.68228336477591 / 300 (41.9%)\n" |
538 | 538 | ] |
539 | 539 | }, |
540 | 540 | { |
|
699 | 699 | "source": [ |
700 | 700 | "## Set up your system's retriever.\n", |
701 | 701 | "\n", |
702 | | - "As far as DSPy is concerned, you can plug in any Python code for calling tools or retrievers. Here, we'll just use OpenAI Embeddings and do top-K search locally, just for convenience." |
| 702 | + "As far as DSPy is concerned, you can plug in any Python code for calling tools or retrievers. Here, we'll just use OpenAI Embeddings and do top-K search locally, just for convenience.\n", |
| 703 | + "\n", |
| 704 | + "**Note:** The step below will require that you either do `pip install -U faiss-cpu` or pass `brute_force_threshold=30_000` to `dspy.retrievers.Embeddings` to avoid faiss." |
703 | 705 | ] |
704 | 706 | }, |
705 | 707 | { |
706 | 708 | "cell_type": "code", |
707 | 709 | "execution_count": 13, |
708 | 710 | "metadata": {}, |
| 711 | + "outputs": [], |
| 712 | + "source": [ |
| 713 | + "# %pip install -U faiss-cpu # or faiss-gpu if you have a GPU" |
| 714 | + ] |
| 715 | + }, |
| 716 | + { |
| 717 | + "cell_type": "code", |
| 718 | + "execution_count": 14, |
| 719 | + "metadata": {}, |
709 | 720 | "outputs": [ |
710 | 721 | { |
711 | 722 | "name": "stdout", |
|
744 | 755 | }, |
745 | 756 | { |
746 | 757 | "cell_type": "code", |
747 | | - "execution_count": 14, |
| 758 | + "execution_count": 15, |
748 | 759 | "metadata": {}, |
749 | 760 | "outputs": [], |
750 | 761 | "source": [ |
|
767 | 778 | }, |
768 | 779 | { |
769 | 780 | "cell_type": "code", |
770 | | - "execution_count": 15, |
| 781 | + "execution_count": 16, |
771 | 782 | "metadata": {}, |
772 | 783 | "outputs": [ |
773 | 784 | { |
|
779 | 790 | ")" |
780 | 791 | ] |
781 | 792 | }, |
782 | | - "execution_count": 15, |
| 793 | + "execution_count": 16, |
783 | 794 | "metadata": {}, |
784 | 795 | "output_type": "execute_result" |
785 | 796 | } |
|
791 | 802 | }, |
792 | 803 | { |
793 | 804 | "cell_type": "code", |
794 | | - "execution_count": 16, |
| 805 | + "execution_count": 17, |
795 | 806 | "metadata": {}, |
796 | 807 | "outputs": [ |
797 | 808 | { |
|
802 | 813 | "\n", |
803 | 814 | "\n", |
804 | 815 | "\n", |
805 | | - "\u001b[34m[2024-11-23T22:13:02.348625]\u001b[0m\n", |
| 816 | + "\u001b[34m[2024-11-23T23:16:49.175612]\u001b[0m\n", |
806 | 817 | "\n", |
807 | 818 | "\u001b[31mSystem message:\u001b[0m\n", |
808 | 819 | "\n", |
|
879 | 890 | }, |
880 | 891 | { |
881 | 892 | "cell_type": "code", |
882 | | - "execution_count": 17, |
| 893 | + "execution_count": 18, |
883 | 894 | "metadata": {}, |
884 | 895 | "outputs": [ |
885 | 896 | { |
886 | 897 | "name": "stdout", |
887 | 898 | "output_type": "stream", |
888 | 899 | "text": [ |
889 | | - "Average Metric: 166.39 / 300 (55.5%): 100%|██████████| 300/300 [00:14<00:00, 20.29it/s]" |
| 900 | + "Average Metric: 166.54 / 300 (55.5%): 100%|██████████| 300/300 [00:04<00:00, 61.40it/s] " |
890 | 901 | ] |
891 | 902 | }, |
892 | 903 | { |
893 | 904 | "name": "stderr", |
894 | 905 | "output_type": "stream", |
895 | 906 | "text": [ |
896 | | - "2024/11/23 22:13:17 INFO dspy.evaluate.evaluate: Average Metric: 166.39410892098812 / 300 (55.5%)\n" |
| 907 | + "2024/11/23 23:16:54 INFO dspy.evaluate.evaluate: Average Metric: 166.53601368289284 / 300 (55.5%)\n" |
897 | 908 | ] |
898 | 909 | }, |
899 | 910 | { |
|
1008 | 1019 | { |
1009 | 1020 | "data": { |
1010 | 1021 | "text/plain": [ |
1011 | | - "55.46" |
| 1022 | + "55.51" |
1012 | 1023 | ] |
1013 | 1024 | }, |
1014 | | - "execution_count": 17, |
| 1025 | + "execution_count": 18, |
1015 | 1026 | "metadata": {}, |
1016 | 1027 | "output_type": "execute_result" |
1017 | 1028 | } |
|
1057 | 1068 | }, |
1058 | 1069 | { |
1059 | 1070 | "cell_type": "code", |
1060 | | - "execution_count": 19, |
| 1071 | + "execution_count": 20, |
1061 | 1072 | "metadata": {}, |
1062 | 1073 | "outputs": [ |
1063 | 1074 | { |
|
1075 | 1086 | }, |
1076 | 1087 | { |
1077 | 1088 | "cell_type": "code", |
1078 | | - "execution_count": 20, |
| 1089 | + "execution_count": 21, |
1079 | 1090 | "metadata": {}, |
1080 | 1091 | "outputs": [ |
1081 | 1092 | { |
|
1111 | 1122 | }, |
1112 | 1123 | { |
1113 | 1124 | "cell_type": "code", |
1114 | | - "execution_count": 21, |
| 1125 | + "execution_count": 22, |
1115 | 1126 | "metadata": {}, |
1116 | 1127 | "outputs": [ |
1117 | 1128 | { |
1118 | 1129 | "name": "stdout", |
1119 | 1130 | "output_type": "stream", |
1120 | 1131 | "text": [ |
1121 | | - "Average Metric: 183.28 / 300 (61.1%): 100%|██████████| 300/300 [00:13<00:00, 22.20it/s] " |
| 1132 | + "Average Metric: 183.32 / 300 (61.1%): 100%|██████████| 300/300 [00:02<00:00, 104.48it/s]" |
1122 | 1133 | ] |
1123 | 1134 | }, |
1124 | 1135 | { |
1125 | 1136 | "name": "stderr", |
1126 | 1137 | "output_type": "stream", |
1127 | 1138 | "text": [ |
1128 | | - "2024/11/23 22:14:01 INFO dspy.evaluate.evaluate: Average Metric: 183.27658621624977 / 300 (61.1%)\n" |
| 1139 | + "2024/11/23 23:17:21 INFO dspy.evaluate.evaluate: Average Metric: 183.3194433591069 / 300 (61.1%)\n" |
1129 | 1140 | ] |
1130 | 1141 | }, |
1131 | 1142 | { |
|
1240 | 1251 | { |
1241 | 1252 | "data": { |
1242 | 1253 | "text/plain": [ |
1243 | | - "61.09" |
| 1254 | + "61.11" |
1244 | 1255 | ] |
1245 | 1256 | }, |
1246 | | - "execution_count": 21, |
| 1257 | + "execution_count": 22, |
1247 | 1258 | "metadata": {}, |
1248 | 1259 | "output_type": "execute_result" |
1249 | 1260 | } |
|
1263 | 1274 | }, |
1264 | 1275 | { |
1265 | 1276 | "cell_type": "code", |
1266 | | - "execution_count": 22, |
| 1277 | + "execution_count": 23, |
1267 | 1278 | "metadata": {}, |
1268 | 1279 | "outputs": [], |
1269 | 1280 | "source": [ |
|
1283 | 1294 | }, |
1284 | 1295 | { |
1285 | 1296 | "cell_type": "code", |
1286 | | - "execution_count": 23, |
| 1297 | + "execution_count": 24, |
1287 | 1298 | "metadata": {}, |
1288 | 1299 | "outputs": [ |
1289 | 1300 | { |
|
1295 | 1306 | ")" |
1296 | 1307 | ] |
1297 | 1308 | }, |
1298 | | - "execution_count": 23, |
| 1309 | + "execution_count": 24, |
1299 | 1310 | "metadata": {}, |
1300 | 1311 | "output_type": "execute_result" |
1301 | 1312 | } |
|
0 commit comments