username: None        Table Schema:    ---------------------------------------------------    |id                      |Nullable(String)        |    |document                |Nullable(String)        |    |embedding               |Array(Float32)          |    |metadata                |Object('json')          |    |uuid                    |UUID                    |    ---------------------------------------------------    Clickhouse table schema‚ÄãClickhouse table will be automatically created if not exist by default. Advanced users could pre-create the table with optimized settings. For distributed Clickhouse cluster with sharding, table engine should be configured as Distributed.print(f"Clickhouse Table DDL:\n\n{docsearch.schema}")    Clickhouse Table DDL:        CREATE TABLE IF NOT EXISTS default.clickhouse_vector_search_example(        id Nullable(String),        document Nullable(String),        embedding Array(Float32),        metadata JSON,        uuid UUID DEFAULT generateUUIDv4(),        CONSTRAINT cons_vec_len CHECK length(embedding) = 1536,        INDEX vec_idx embedding TYPE annoy(100,'L2Distance') GRANULARITY 1000    ) ENGINE = MergeTree ORDER BY uuid SETTINGS index_granularity = 8192Filtering‚ÄãYou can have direct access to ClickHouse SQL where statement. You can write WHERE clause following standard SQL.NOTE: Please be aware of SQL injection, this interface must not be directly called by end-user.If you custimized your column_map under your setting, you search with filter like this:from langchain.vectorstores import Clickhouse, ClickhouseSettingsfrom langchain.document_loaders import TextLoaderloader = 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()for i, d in enumerate(docs):    d.metadata = {"doc_id": i}docsearch = Clickhouse.from_documents(docs, embeddings)
ClickHouse is the fastest and most resource efficient open-source database for real-time apps and analytics with full SQL support and a wide range of functions to assist users in writing analytical queries. Lately added data structures and distance search functions (like L2Distance) as well as approximate nearest neighbor search indexes enable ClickHouse to be used as a high performance and scalable vector database to store and search vectors with SQL.
ClickHouse is the fastest and most resource efficient open-source database for real-time apps and analytics with full SQL support and a wide range of functions to assist users in writing analytical queries. Lately added data structures and distance search functions (like L2Distance) as well as approximate nearest neighbor search indexes enable ClickHouse to be used as a high performance and scalable vector database to store and search vectors with SQL. ->: username: None        Table Schema:    ---------------------------------------------------    |id                      |Nullable(String)        |    |document                |Nullable(String)        |    |embedding               |Array(Float32)          |    |metadata                |Object('json')          |    |uuid                    |UUID                    |    ---------------------------------------------------    Clickhouse table schema‚ÄãClickhouse table will be automatically created if not exist by default. Advanced users could pre-create the table with optimized settings. For distributed Clickhouse cluster with sharding, table engine should be configured as Distributed.print(f"Clickhouse Table DDL:\n\n{docsearch.schema}")    Clickhouse Table DDL:        CREATE TABLE IF NOT EXISTS default.clickhouse_vector_search_example(        id Nullable(String),        document Nullable(String),        embedding Array(Float32),        metadata JSON,        uuid UUID DEFAULT generateUUIDv4(),        CONSTRAINT cons_vec_len CHECK length(embedding) = 1536,        INDEX vec_idx embedding TYPE annoy(100,'L2Distance') GRANULARITY 1000    ) ENGINE = MergeTree ORDER BY uuid SETTINGS index_granularity = 8192Filtering‚ÄãYou can have direct access to ClickHouse SQL where statement. You can write WHERE clause following standard SQL.NOTE: Please be aware of SQL injection, this interface must not be directly called by end-user.If you custimized your column_map under your setting, you search with filter like this:from langchain.vectorstores import Clickhouse, ClickhouseSettingsfrom langchain.document_loaders import TextLoaderloader = 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()for i, d in enumerate(docs):    d.metadata = {"doc_id": i}docsearch = Clickhouse.from_documents(docs, embeddings)