(comma-separated, empty for localhost) "    ).strip()depending on whether local or cloud-based Astra DB, create the corresponding database connection "Session" object‚Äãfrom cassandra.cluster import Clusterfrom cassandra.auth import PlainTextAuthProviderif database_mode == "C":    if CASSANDRA_CONTACT_POINTS:        cluster = Cluster(            [cp.strip() for cp in CASSANDRA_CONTACT_POINTS.split(",") if cp.strip()]        )    else:        cluster = Cluster()    session = cluster.connect()elif database_mode == "A":    ASTRA_DB_CLIENT_ID = "token"    cluster = Cluster(        cloud={            "secure_connect_bundle": ASTRA_DB_SECURE_BUNDLE_PATH,        },        auth_provider=PlainTextAuthProvider(            ASTRA_DB_CLIENT_ID,            ASTRA_DB_APPLICATION_TOKEN,        ),    )    session = cluster.connect()else:    raise NotImplementedErrorPlease provide OpenAI access key‚ÄãWe want to use OpenAIEmbeddings so we have to get the OpenAI API Key.os.environ["OPENAI_API_KEY"] = getpass.getpass("OpenAI API Key:")Creation and usage of the Vector Store‚Äãfrom langchain.embeddings.openai import OpenAIEmbeddingsfrom langchain.text_splitter import CharacterTextSplitterfrom langchain.vectorstores import Cassandrafrom langchain.document_loaders import TextLoaderfrom langchain.document_loaders import TextLoaderSOURCE_FILE_NAME = "../../modules/state_of_the_union.txt"loader = TextLoader(SOURCE_FILE_NAME)documents = loader.load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)docs = text_splitter.split_documents(documents)embedding_function = OpenAIEmbeddings()table_name = "my_vector_db_table"docsearch = Cassandra.from_documents(    documents=docs,    embedding=embedding_function,    session=session,    keyspace=keyspace_name,    table_name=table_name,)query = "What did the president say about Ketanji Brown Jackson"docs = docsearch.similarity_search(query)## if you already have an index, you can load it and use it like this:# docsearch_preexisting =
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. ->: (comma-separated, empty for localhost) "    ).strip()depending on whether local or cloud-based Astra DB, create the corresponding database connection "Session" object‚Äãfrom cassandra.cluster import Clusterfrom cassandra.auth import PlainTextAuthProviderif database_mode == "C":    if CASSANDRA_CONTACT_POINTS:        cluster = Cluster(            [cp.strip() for cp in CASSANDRA_CONTACT_POINTS.split(",") if cp.strip()]        )    else:        cluster = Cluster()    session = cluster.connect()elif database_mode == "A":    ASTRA_DB_CLIENT_ID = "token"    cluster = Cluster(        cloud={            "secure_connect_bundle": ASTRA_DB_SECURE_BUNDLE_PATH,        },        auth_provider=PlainTextAuthProvider(            ASTRA_DB_CLIENT_ID,            ASTRA_DB_APPLICATION_TOKEN,        ),    )    session = cluster.connect()else:    raise NotImplementedErrorPlease provide OpenAI access key‚ÄãWe want to use OpenAIEmbeddings so we have to get the OpenAI API Key.os.environ["OPENAI_API_KEY"] = getpass.getpass("OpenAI API Key:")Creation and usage of the Vector Store‚Äãfrom langchain.embeddings.openai import OpenAIEmbeddingsfrom langchain.text_splitter import CharacterTextSplitterfrom langchain.vectorstores import Cassandrafrom langchain.document_loaders import TextLoaderfrom langchain.document_loaders import TextLoaderSOURCE_FILE_NAME = "../../modules/state_of_the_union.txt"loader = TextLoader(SOURCE_FILE_NAME)documents = loader.load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)docs = text_splitter.split_documents(documents)embedding_function = OpenAIEmbeddings()table_name = "my_vector_db_table"docsearch = Cassandra.from_documents(    documents=docs,    embedding=embedding_function,    session=session,    keyspace=keyspace_name,    table_name=table_name,)query = "What did the president say about Ketanji Brown Jackson"docs = docsearch.similarity_search(query)## if you already have an index, you can load it and use it like this:# docsearch_preexisting =