Skip to content

Commit

Permalink
Merge pull request #3 from krflorian/feature/intent_classification
Browse files Browse the repository at this point in the history
Feature/intent classification
  • Loading branch information
krflorian authored Feb 3, 2024
2 parents b3e7bc0 + 9574561 commit cc1aeab
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 364 deletions.
4 changes: 3 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
)
nli_classifier_model = pipeline(
"zero-shot-classification",
model=config.get("nli_classifier", "facebook/bart-large-mnli"),
model=config.get(
"nli_classifier", "MoritzLaurer/deberta-v3-large-zeroshot-v1.1-all-33"
),
)


Expand Down
2 changes: 1 addition & 1 deletion configs/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ cards_db_file: "../data/artifacts/card_db_gte.p"
rules_db_file: "../data/artifacts/rules_db_gte.p"
vector_model_name: "../data/models/gte-large"
halucination_model_name: "../data/models/hallucination_evaluation_model"
nli_classifier: "../data/models/bart-large-mnli"
nli_classifier: "../data/models/deberta-v3-large-zeroshot-v1.1-all-33"
174 changes: 92 additions & 82 deletions notebooks/evaluation_intent_classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
"from src.util import load_config\n",
"\n",
"config = load_config(Path(\"configs/config.yaml\"))\n",
"model = pipeline(\n",
"\n",
"from transformers import pipeline\n",
"\n",
"zeroshot_classifier = pipeline(\n",
" \"zero-shot-classification\",\n",
" model=config.get(\"nli_classifier\", \"facebook/bart-large-mnli\"),\n",
" model=\"../data/models/deberta-v3-large-zeroshot-v1.1-all-33\",\n",
")\n",
"\n",
"with open(\"data/evaluation/intent_classification.json\", \"r\", encoding=\"utf-8\") as infile: \n",
Expand All @@ -32,77 +35,85 @@
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[38;20m2024-01-28 13:29:39,601 - src.nli - INFO - classified intent: situation 0.73 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:40,272 - src.nli - INFO - classified intent: situation 0.70 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:41,052 - src.nli - INFO - classified intent: situation 0.77 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:41,797 - src.nli - INFO - classified intent: situation 0.60 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:42,600 - src.nli - INFO - classified intent: situation 0.82 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:43,314 - src.nli - INFO - classified intent: situation 0.71 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:43,979 - src.nli - INFO - classified intent: situation 0.80 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:44,665 - src.nli - INFO - classified intent: situation 0.67 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:45,336 - src.nli - INFO - classified intent: situation 0.83 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:46,144 - src.nli - INFO - classified intent: situation 0.74 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:46,865 - src.nli - INFO - classified intent: deckbuilding 0.68 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:47,543 - src.nli - INFO - classified intent: deckbuilding 0.59 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:48,246 - src.nli - INFO - classified intent: deckbuilding 0.70 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:48,892 - src.nli - INFO - classified intent: deckbuilding 0.46 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:49,534 - src.nli - INFO - classified intent: deckbuilding 0.69 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:50,173 - src.nli - INFO - classified intent: deckbuilding 0.68 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:50,801 - src.nli - INFO - classified intent: deckbuilding 0.70 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:51,579 - src.nli - INFO - classified intent: deckbuilding 0.51 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:52,321 - src.nli - INFO - classified intent: deckbuilding 0.68 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:53,202 - src.nli - INFO - classified intent: situation 0.51 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:53,900 - src.nli - INFO - classified intent: situation 0.47 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:54,581 - src.nli - INFO - classified intent: situation 0.83 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:55,396 - src.nli - INFO - classified intent: situation 0.74 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:56,074 - src.nli - INFO - classified intent: situation 0.74 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:56,756 - src.nli - INFO - classified intent: rules 0.79 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:57,452 - src.nli - INFO - classified intent: situation 0.52 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:58,188 - src.nli - INFO - classified intent: situation 0.52 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:58,860 - src.nli - INFO - classified intent: situation 0.76 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:29:59,671 - src.nli - INFO - classified intent: situation 0.75 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:00,353 - src.nli - INFO - classified intent: situation 0.76 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:01,005 - src.nli - INFO - classified intent: situation 0.49 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:01,635 - src.nli - INFO - classified intent: conversation 0.67 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:02,289 - src.nli - INFO - classified intent: situation 0.63 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:03,158 - src.nli - INFO - classified intent: conversation 0.41 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:03,953 - src.nli - INFO - classified intent: conversation 0.54 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:05,317 - src.nli - INFO - classified intent: situation 0.78 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:06,427 - src.nli - INFO - classified intent: situation 0.60 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:07,820 - src.nli - INFO - classified intent: situation 0.57 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:09,428 - src.nli - INFO - classified intent: situation 0.67 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:11,342 - src.nli - INFO - classified intent: rules 0.73 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:12,658 - src.nli - INFO - classified intent: situation 0.69 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:13,934 - src.nli - INFO - classified intent: deckbuilding 0.75 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:15,450 - src.nli - INFO - classified intent: deckbuilding 0.72 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:16,883 - src.nli - INFO - classified intent: deckbuilding 0.78 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:18,293 - src.nli - INFO - classified intent: deckbuilding 0.72 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:19,704 - src.nli - INFO - classified intent: deckbuilding 0.49 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:20,979 - src.nli - INFO - classified intent: deckbuilding 0.77 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:22,204 - src.nli - INFO - classified intent: situation 0.73 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:23,143 - src.nli - INFO - classified intent: situation 0.75 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:24,294 - src.nli - INFO - classified intent: situation 0.75 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:25,462 - src.nli - INFO - classified intent: situation 0.79 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:26,654 - src.nli - INFO - classified intent: situation 0.80 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:27,939 - src.nli - INFO - classified intent: situation 0.79 (nli.py:21)\u001b[0m\n",
"\u001b[38;20m2024-01-28 13:30:28,760 - src.nli - INFO - classified intent: situation 0.63 (nli.py:21)\u001b[0m\n"
"\u001b[38;20m2024-02-03 13:10:05,888 - src.nli - INFO - classified intent: conversation 0.87 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:10:10,573 - src.nli - INFO - classified intent: conversation 0.96 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:10:15,781 - src.nli - INFO - classified intent: conversation 0.45 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:10:21,000 - src.nli - INFO - classified intent: conversation 0.99 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:10:25,909 - src.nli - INFO - classified intent: conversation 0.67 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:10:30,731 - src.nli - INFO - classified intent: conversation 0.99 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:10:35,576 - src.nli - INFO - classified intent: rules 0.35 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:10:40,743 - src.nli - INFO - classified intent: conversation 0.82 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:10:45,632 - src.nli - INFO - classified intent: conversation 0.92 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:10:54,262 - src.nli - INFO - classified intent: deckbuilding 0.28 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:11:07,174 - src.nli - INFO - classified intent: deckbuilding 0.79 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:11:13,067 - src.nli - INFO - classified intent: deckbuilding 0.51 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:11:18,762 - src.nli - INFO - classified intent: deckbuilding 0.36 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:11:24,025 - src.nli - INFO - classified intent: deckbuilding 0.27 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:11:29,178 - src.nli - INFO - classified intent: deckbuilding 0.86 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:11:33,868 - src.nli - INFO - classified intent: deckbuilding 0.62 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:11:39,036 - src.nli - INFO - classified intent: deckbuilding 0.88 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:11:44,116 - src.nli - INFO - classified intent: deckbuilding 0.40 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:11:50,080 - src.nli - INFO - classified intent: deckbuilding 0.65 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:11:55,969 - src.nli - INFO - classified intent: deckbuilding 0.31 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:01,144 - src.nli - INFO - classified intent: rules 0.63 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:05,711 - src.nli - INFO - classified intent: rules 0.58 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:10,996 - src.nli - INFO - classified intent: rules 0.83 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:16,023 - src.nli - INFO - classified intent: deckbuilding 0.29 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:20,906 - src.nli - INFO - classified intent: rules 0.47 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:25,722 - src.nli - INFO - classified intent: rules 0.51 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:30,405 - src.nli - INFO - classified intent: rules 0.24 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:35,591 - src.nli - INFO - classified intent: rules 0.50 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:41,214 - src.nli - INFO - classified intent: rules 0.77 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:46,578 - src.nli - INFO - classified intent: rules 0.30 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:51,687 - src.nli - INFO - classified intent: rules 0.67 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:12:56,886 - src.nli - INFO - classified intent: deckbuilding 0.27 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:13:01,638 - src.nli - INFO - classified intent: rules 0.18 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:13:06,331 - src.nli - INFO - classified intent: deckbuilding 0.63 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:13:11,094 - src.nli - INFO - classified intent: deckbuilding 0.16 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:13:18,032 - src.nli - INFO - classified intent: rules 0.83 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:13:24,475 - src.nli - INFO - classified intent: rules 0.53 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:13:30,797 - src.nli - INFO - classified intent: rules 0.65 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:13:36,889 - src.nli - INFO - classified intent: rules 0.64 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:13:42,728 - src.nli - INFO - classified intent: rules 0.71 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:13:48,454 - src.nli - INFO - classified intent: rules 0.89 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:13:54,246 - src.nli - INFO - classified intent: deckbuilding 0.42 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:14:00,348 - src.nli - INFO - classified intent: deckbuilding 0.83 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:14:06,094 - src.nli - INFO - classified intent: deckbuilding 0.80 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:14:12,059 - src.nli - INFO - classified intent: deckbuilding 0.39 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:14:17,969 - src.nli - INFO - classified intent: deckbuilding 0.57 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:14:23,538 - src.nli - INFO - classified intent: deckbuilding 0.81 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:14:29,261 - src.nli - INFO - classified intent: conversation 0.50 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:14:35,241 - src.nli - INFO - classified intent: conversation 0.80 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:14:40,986 - src.nli - INFO - classified intent: conversation 1.00 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:14:46,474 - src.nli - INFO - classified intent: conversation 0.97 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:14:52,011 - src.nli - INFO - classified intent: conversation 0.73 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:14:57,716 - src.nli - INFO - classified intent: conversation 0.95 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:15:01,980 - src.nli - INFO - classified intent: deckbuilding 0.53 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:15:06,333 - src.nli - INFO - classified intent: deckbuilding 0.65 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:15:10,968 - src.nli - INFO - classified intent: deckbuilding 0.30 (nli.py:42)\u001b[0m\n",
"\u001b[38;20m2024-02-03 13:15:15,241 - src.nli - INFO - classified intent: deckbuilding 0.20 (nli.py:42)\u001b[0m\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"classified 54 documents\n"
"runtime 314.84 - 5.523514\n",
"classified 57 documents\n"
]
}
],
"source": [
"import time \n",
"\n",
"start = time.time()\n",
"predictions, references = [], []\n",
"for text, expected_intent in data: \n",
" intent, score = classify_intent(text, model)\n",
" intent, score = classify_intent(text, zeroshot_classifier)\n",
" predictions.append(intent)\n",
" references.append(expected_intent)\n",
"runtime = time.time()-start\n",
"print(f\"runtime {runtime:.2f} - {runtime/len(data):2f}\")\n",
"print(\"classified \", len(predictions), \" documents\")"
]
},
Expand Down Expand Up @@ -148,30 +159,30 @@
" <tr>\n",
" <th>2</th>\n",
" <td>conversation</td>\n",
" <td>0.260870</td>\n",
" <td>0.1500</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>rules</td>\n",
" <td>0.800000</td>\n",
" <td>0.666667</td>\n",
" <td>1.0000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>deckbuilding</td>\n",
" <td>0.967742</td>\n",
" <td>0.9375</td>\n",
" <td>0.837209</td>\n",
" <td>1.000000</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>rules</td>\n",
" <td>0.888889</td>\n",
" <td>0.888889</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" labels f1 recall\n",
"2 conversation 0.260870 0.1500\n",
"1 rules 0.666667 1.0000\n",
"0 deckbuilding 0.967742 0.9375"
" labels f1 recall\n",
"2 conversation 0.800000 0.666667\n",
"0 deckbuilding 0.837209 1.000000\n",
"1 rules 0.888889 0.888889"
]
},
"execution_count": 5,
Expand All @@ -181,7 +192,6 @@
],
"source": [
"from sklearn.metrics import f1_score, confusion_matrix, recall_score\n",
"from src.nli import Intent\n",
"import pandas as pd \n",
"\n",
"classes = [\"deckbuilding\", \"rules\", \"conversation\"]\n",
Expand Down Expand Up @@ -235,31 +245,31 @@
" <tbody>\n",
" <tr>\n",
" <th>deckbuilding</th>\n",
" <td>15</td>\n",
" <td>1</td>\n",
" <td>18</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>rules</th>\n",
" <td>0</td>\n",
" <td>18</td>\n",
" <td>2</td>\n",
" <td>16</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>conversation</th>\n",
" <td>0</td>\n",
" <td>17</td>\n",
" <td>3</td>\n",
" <td>5</td>\n",
" <td>2</td>\n",
" <td>14</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" deckbuilding rules conversation\n",
"deckbuilding 15 1 0\n",
"rules 0 18 0\n",
"conversation 0 17 3"
"deckbuilding 18 0 0\n",
"rules 2 16 0\n",
"conversation 5 2 14"
]
},
"execution_count": 6,
Expand Down
15 changes: 8 additions & 7 deletions src/etl/create_card_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,18 @@ def parse_card_data(data: list[dict], keywords: list[str]) -> list[Card]:
return cards


def create_card_db(cards: list[Card]) -> VectorDB:
texts, cards = [], []
def create_card_db(cards: list[Card], model: SentenceTransformer) -> VectorDB:
texts, cards_in_db = [], []
for card in cards:
texts.append(card.to_text(include_price=False))
cards.append(card)
cards_in_db.append(card)

texts.append(card.name)
cards_in_db.append(card)

card_db = VectorDB(
texts=texts,
data=cards,
data=cards_in_db,
model=model,
)
return card_db
Expand Down Expand Up @@ -93,9 +96,7 @@ def create_card_db(cards: list[Card]) -> VectorDB:
)
card_db.add(embeddings_and_data)
else:
card_db = VectorDB(
[card.to_text(include_price=False) for card in cards], cards, model=model
)
card_db = create_card_db(cards, model)

# save
card_db.dump(ARTIFACT_PATH / f"{db_name}.p")
Loading

0 comments on commit cc1aeab

Please sign in to comment.