class from a stuff chainfrom langchain.chains import RetrievalQAqa_stuff = RetrievalQA.from_chain_type(    llm=llm,     chain_type="stuff",     retriever=retriever,    verbose=True,)query = "What did the president say about Ketanji Brown Jackson?"response = qa_stuff.run(query)            > Entering new RetrievalQA chain...        > Finished chain.print(response)    The President said that he nominated Circuit Court of Appeals Judge Ketanji Brown Jackson, who is one of our nation's top legal minds and will continue Justice Breyer's legacy of excellence. He also mentioned that since her nomination, she has received a broad range of support from various groups, including the Fraternal Order of Police and former judges appointed by Democrats and Republicans.2. Similarity Search with time-based filtering‚ÄãA key use case for Timescale Vector is efficient time-based vector search. Timescale Vector enables this by automatically partitioning vectors (and associated metadata) by time. This allows you to efficiently query vectors by both similarity to a query vector and time.Time-based vector search functionality is helpful for applications like:Storing and retrieving LLM response history (e.g. chatbots)Finding the most recent embeddings that are similar to a query vector (e.g recent news).Constraining similarity search to a relevant time range (e.g asking time-based questions about a knowledge base)To illustrate how to use TimescaleVector's time-based vector search functionality, we'll ask questions about the git log history for TimescaleDB . We'll illustrate how to add documents with a time-based uuid and how run similarity searches with time range filters.Extract content and metadata from git log JSON‚ÄãFirst lets load in the git log data into a new collection in our PostgreSQL database named timescale_commits.import jsonWe'll define a helper funciton to create a uuid for a document and associated vector embedding based on its timestamp. We'll use this function to create
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. ->: class from a stuff chainfrom langchain.chains import RetrievalQAqa_stuff = RetrievalQA.from_chain_type(    llm=llm,     chain_type="stuff",     retriever=retriever,    verbose=True,)query = "What did the president say about Ketanji Brown Jackson?"response = qa_stuff.run(query)            > Entering new RetrievalQA chain...        > Finished chain.print(response)    The President said that he nominated Circuit Court of Appeals Judge Ketanji Brown Jackson, who is one of our nation's top legal minds and will continue Justice Breyer's legacy of excellence. He also mentioned that since her nomination, she has received a broad range of support from various groups, including the Fraternal Order of Police and former judges appointed by Democrats and Republicans.2. Similarity Search with time-based filtering‚ÄãA key use case for Timescale Vector is efficient time-based vector search. Timescale Vector enables this by automatically partitioning vectors (and associated metadata) by time. This allows you to efficiently query vectors by both similarity to a query vector and time.Time-based vector search functionality is helpful for applications like:Storing and retrieving LLM response history (e.g. chatbots)Finding the most recent embeddings that are similar to a query vector (e.g recent news).Constraining similarity search to a relevant time range (e.g asking time-based questions about a knowledge base)To illustrate how to use TimescaleVector's time-based vector search functionality, we'll ask questions about the git log history for TimescaleDB . We'll illustrate how to add documents with a time-based uuid and how run similarity searches with time range filters.Extract content and metadata from git log JSON‚ÄãFirst lets load in the git log data into a new collection in our PostgreSQL database named timescale_commits.import jsonWe'll define a helper funciton to create a uuid for a document and associated vector embedding based on its timestamp. We'll use this function to create