import TextLoader# Load text samplesloader = TextLoader("../../modules/state_of_the_union.txt")documents = loader.load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)docs = text_splitter.split_documents(documents)embeddings = OpenAIEmbeddings()There are several ways to establish a connection to the database. You can either set up environment variables or pass named parameters to the SingleStoreDB constructor. Alternatively, you may provide these parameters to the from_documents and from_texts methods.# Setup connection url as environment variableos.environ["SINGLESTOREDB_URL"] = "root:pass@localhost:3306/db"# Load documents to the storedocsearch = SingleStoreDB.from_documents(    docs,    embeddings,    table_name="notebook",  # use table with a custom name)query = "What did the president say about Ketanji Brown Jackson"docs = docsearch.similarity_search(query)  # Find documents that correspond to the queryprint(docs[0].page_content)PreviousScaNNNextscikit-learnCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
SingleStoreDB is a high-performance distributed SQL database that supports deployment both in the cloud and on-premises. It provides vector storage, and vector functions including dotproduct and euclideandistance, thereby supporting AI applications that require text similarity matching.
SingleStoreDB is a high-performance distributed SQL database that supports deployment both in the cloud and on-premises. It provides vector storage, and vector functions including dotproduct and euclideandistance, thereby supporting AI applications that require text similarity matching. ->: import TextLoader# Load text samplesloader = TextLoader("../../modules/state_of_the_union.txt")documents = loader.load()text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)docs = text_splitter.split_documents(documents)embeddings = OpenAIEmbeddings()There are several ways to establish a connection to the database. You can either set up environment variables or pass named parameters to the SingleStoreDB constructor. Alternatively, you may provide these parameters to the from_documents and from_texts methods.# Setup connection url as environment variableos.environ["SINGLESTOREDB_URL"] = "root:pass@localhost:3306/db"# Load documents to the storedocsearch = SingleStoreDB.from_documents(    docs,    embeddings,    table_name="notebook",  # use table with a custom name)query = "What did the president say about Ketanji Brown Jackson"docs = docsearch.similarity_search(query)  # Find documents that correspond to the queryprint(docs[0].page_content)PreviousScaNNNextscikit-learnCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.