Spaces:
Build error
Build error
| # %% | |
| from utils import retrieve_collections, get_chroma_client | |
| from load_model import load_embedding | |
| #retrieve_collections() | |
| client = get_chroma_client() | |
| # %% | |
| client.reset() | |
| # %% | |
| collections = tuple( [collection.name for collection in client.list_collections()] ) ##Keine Embedding function in der Collection angelegt... | |
| ef = load_embedding("hkunlp/instructor-large") | |
| collection="heikostest2" | |
| client.create_collection(collection, embedding_function=ef, metadata={"loaded_docs":[]}) | |
| # %% | |
| my_col = client.list_collections() | |
| # %% | |
| my_col.embedding_function | |
| # %% | |
| from langchain.vectorstores import Chroma | |
| import load_model | |
| from load_model import load_embedding | |
| persist_directory = load_model.persist_directory | |
| ef = load_embedding("hkunlp/instructor-large") | |
| vectorstore = Chroma( | |
| collection_name="papers", | |
| embedding_function=ef, | |
| persist_directory=persist_directory, | |
| ) | |
| # %% | |
| query = "What did the president say about Ketanji Brown Jackson" | |
| docs = vectorstore.similarity_search(query) | |
| # %% | |
| docs | |
| # %% | |
| vectorstore.similarity_search_with_score(query) |