existing TimescaleVector storeCOLLECTION_NAME = "timescale_commits"embeddings = OpenAIEmbeddings()db = TimescaleVector(    collection_name=COLLECTION_NAME,    service_url=SERVICE_URL,    embedding_function=embeddings,)Using the create_index() function without additional arguments will create a timescale_vector_index by default, using the default parameters.# create an index# by default this will create a Timescale Vector (DiskANN) indexdb.create_index()You can also specify the parameters for the index. See the Timescale Vector documentation for a full discussion of the different parameters and their effects on performance.Note: You don't need to specify parameters as we set smart defaults. But you can always specify your own parameters if you want to experiment eek out more performance for your specific dataset.#drop the old indexdb.drop_index()# create an index# Note: You don't need to specify m and ef_construction parameters as we set smart defaults.  db.create_index(index_type="tsv", max_alpha=1.0, num_neighbors=50)Timescale Vector also supports the HNSW ANN indexing algorithm, as well as the ivfflat ANN indexing algorithm. Simply specify in the index_type argument which index you'd like to create, and optionally specify the parameters for the index.#drop the old indexdb.drop_index()# Create an HNSW index# Note: You don't need to specify m and ef_construction parameters as we set smart defaults.  db.create_index(index_type="hnsw", m=16, ef_construction=64)#drop the old indexdb.drop_index()# Create an IVFFLAT index# Note: You don't need to specify num_lists and num_records parameters as we set smart defaults.db.create_index(index_type="ivfflat", num_lists=20, num_records=1000)In general, we recommend using the default timescale vector index, or the HNSW index.#drop the old indexdb.drop_index()# Create a new timescale vector indexdb.create_index()4. Self Querying Retriever with Timescale Vector‚ÄãTimescale Vector also supports the self-querying retriever
This notebook shows how to use the Postgres vector database Timescale Vector. You'll learn how to use TimescaleVector for (1) semantic search, (2) time-based vector search, (3) self-querying, and (4) how to create indexes to speed up queries.
This notebook shows how to use the Postgres vector database Timescale Vector. You'll learn how to use TimescaleVector for (1) semantic search, (2) time-based vector search, (3) self-querying, and (4) how to create indexes to speed up queries. ->: existing TimescaleVector storeCOLLECTION_NAME = "timescale_commits"embeddings = OpenAIEmbeddings()db = TimescaleVector(    collection_name=COLLECTION_NAME,    service_url=SERVICE_URL,    embedding_function=embeddings,)Using the create_index() function without additional arguments will create a timescale_vector_index by default, using the default parameters.# create an index# by default this will create a Timescale Vector (DiskANN) indexdb.create_index()You can also specify the parameters for the index. See the Timescale Vector documentation for a full discussion of the different parameters and their effects on performance.Note: You don't need to specify parameters as we set smart defaults. But you can always specify your own parameters if you want to experiment eek out more performance for your specific dataset.#drop the old indexdb.drop_index()# create an index# Note: You don't need to specify m and ef_construction parameters as we set smart defaults.  db.create_index(index_type="tsv", max_alpha=1.0, num_neighbors=50)Timescale Vector also supports the HNSW ANN indexing algorithm, as well as the ivfflat ANN indexing algorithm. Simply specify in the index_type argument which index you'd like to create, and optionally specify the parameters for the index.#drop the old indexdb.drop_index()# Create an HNSW index# Note: You don't need to specify m and ef_construction parameters as we set smart defaults.  db.create_index(index_type="hnsw", m=16, ef_construction=64)#drop the old indexdb.drop_index()# Create an IVFFLAT index# Note: You don't need to specify num_lists and num_records parameters as we set smart defaults.db.create_index(index_type="ivfflat", num_lists=20, num_records=1000)In general, we recommend using the default timescale vector index, or the HNSW index.#drop the old indexdb.drop_index()# Create a new timescale vector indexdb.create_index()4. Self Querying Retriever with Timescale Vector‚ÄãTimescale Vector also supports the self-querying retriever