OnurKerimoglu commited on
Commit
d04e014
·
1 Parent(s): 4def121

nb/QA_chains.ipynb: cleaned the clutter

Browse files
Files changed (1) hide show
  1. notebooks/QA_chains.ipynb +1 -19
notebooks/QA_chains.ipynb CHANGED
@@ -47,19 +47,7 @@
47
  "from langchain_community.embeddings import HuggingFaceEmbeddings\n",
48
  "# from langchain_huggingface import HuggingFaceEmbeddings\n",
49
  "\n",
50
- "# from langchain_core.embeddings import Embeddings\n",
51
- "# from chromadb.api.types import EmbeddingFunction, Documents\n",
52
- "# class LangChainEmbeddingAdapter(EmbeddingFunction[Documents]):\n",
53
- "# def __init__(self, ef: Embeddings):\n",
54
- "# self.ef = ef\n",
55
- "\n",
56
- "# def __call__(self, input: Documents) -> Embeddings:\n",
57
- "# # LC EFs also have embed_query but Chroma doesn't support that so we just use embed_documents\n",
58
- "# # TODO: better type checking\n",
59
- "# return self.ef.embed_documents(input)\n",
60
- "\n",
61
- "lc_embeddings = HuggingFaceEmbeddings(model_name=\"all-MiniLM-L6-v2\")\n",
62
- "# chroma_ef = LangChainEmbeddingAdapter(lc_embeddings)"
63
  ]
64
  },
65
  {
@@ -79,12 +67,6 @@
79
  "client = chromadb.PersistentClient(\n",
80
  " path=persist_directory\n",
81
  " )\n",
82
- "# print(f'Database has {client.count_collections()} collections')\n",
83
- "# collection = client.get_or_create_collection(\n",
84
- "# name=collection_name,\n",
85
- "# embedding_function = chroma_ef,\n",
86
- "# )\n",
87
- "# print(f'Collection {collection_name} has {collection.count()} entries')\n",
88
  "\n",
89
  "from langchain_community.vectorstores import Chroma\n",
90
  "\n",
 
47
  "from langchain_community.embeddings import HuggingFaceEmbeddings\n",
48
  "# from langchain_huggingface import HuggingFaceEmbeddings\n",
49
  "\n",
50
+ "lc_embeddings = HuggingFaceEmbeddings(model_name=\"all-MiniLM-L6-v2\")"
 
 
 
 
 
 
 
 
 
 
 
 
51
  ]
52
  },
53
  {
 
67
  "client = chromadb.PersistentClient(\n",
68
  " path=persist_directory\n",
69
  " )\n",
 
 
 
 
 
 
70
  "\n",
71
  "from langchain_community.vectorstores import Chroma\n",
72
  "\n",