it and use it like this:# docsearch_preexisting = Cassandra(#     embedding=embedding_function,#     session=session,#     keyspace=keyspace_name,#     table_name=table_name,# )# docs = docsearch_preexisting.similarity_search(query, k=2)print(docs[0].page_content)Maximal Marginal Relevance Searches‚ÄãIn addition to using similarity search in the retriever object, you can also use mmr as retriever.retriever = docsearch.as_retriever(search_type="mmr")matched_docs = retriever.get_relevant_documents(query)for i, d in enumerate(matched_docs):    print(f"\n## Document {i}\n")    print(d.page_content)Or use max_marginal_relevance_search directly:found_docs = docsearch.max_marginal_relevance_search(query, k=2, fetch_k=10)for i, doc in enumerate(found_docs):    print(f"{i + 1}.", doc.page_content, "\n")Metadata filtering‚ÄãYou can specify filtering on metadata when running searches in the vector store. By default, when inserting documents, the only metadata is the "source" (but you can customize the metadata at insertion time).Since only one files was inserted, this is just a demonstration of how filters are passed:filter = {"source": SOURCE_FILE_NAME}filtered_docs = docsearch.similarity_search(query, filter=filter, k=5)print(f"{len(filtered_docs)} documents retrieved.")print(f"{filtered_docs[0].page_content[:64]} ...")filter = {"source": "nonexisting_file.txt"}filtered_docs2 = docsearch.similarity_search(query, filter=filter)print(f"{len(filtered_docs2)} documents retrieved.")Please visit the cassIO documentation for more on using vector stores with Langchain.PreviousBagelDBNextChromaPlease provide database connection parameters and secrets:Please provide OpenAI access keyCreation and usage of the Vector StoreMaximal Marginal Relevance SearchesMetadata filteringCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Apache Cassandra¬Æ is a NoSQL, row-oriented, highly scalable and highly available database.
Apache Cassandra¬Æ is a NoSQL, row-oriented, highly scalable and highly available database. ->: it and use it like this:# docsearch_preexisting = Cassandra(#     embedding=embedding_function,#     session=session,#     keyspace=keyspace_name,#     table_name=table_name,# )# docs = docsearch_preexisting.similarity_search(query, k=2)print(docs[0].page_content)Maximal Marginal Relevance Searches‚ÄãIn addition to using similarity search in the retriever object, you can also use mmr as retriever.retriever = docsearch.as_retriever(search_type="mmr")matched_docs = retriever.get_relevant_documents(query)for i, d in enumerate(matched_docs):    print(f"\n## Document {i}\n")    print(d.page_content)Or use max_marginal_relevance_search directly:found_docs = docsearch.max_marginal_relevance_search(query, k=2, fetch_k=10)for i, doc in enumerate(found_docs):    print(f"{i + 1}.", doc.page_content, "\n")Metadata filtering‚ÄãYou can specify filtering on metadata when running searches in the vector store. By default, when inserting documents, the only metadata is the "source" (but you can customize the metadata at insertion time).Since only one files was inserted, this is just a demonstration of how filters are passed:filter = {"source": SOURCE_FILE_NAME}filtered_docs = docsearch.similarity_search(query, filter=filter, k=5)print(f"{len(filtered_docs)} documents retrieved.")print(f"{filtered_docs[0].page_content[:64]} ...")filter = {"source": "nonexisting_file.txt"}filtered_docs2 = docsearch.similarity_search(query, filter=filter)print(f"{len(filtered_docs2)} documents retrieved.")Please visit the cassIO documentation for more on using vector stores with Langchain.PreviousBagelDBNextChromaPlease provide database connection parameters and secrets:Please provide OpenAI access keyCreation and usage of the Vector StoreMaximal Marginal Relevance SearchesMetadata filteringCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.