From 01f4f363982507d835a53b9b536c5846a7d15ad5 Mon Sep 17 00:00:00 2001 From: AayushTyagi1 Date: Tue, 15 Apr 2025 14:46:48 +0530 Subject: [PATCH] DA-767: Modified: Rename CouchbaseVectorStore to CouchbaseSearchVectorStore --- .../CouchbaseStorage_Demo.md | 4 ++-- .../RAG_with_Couchbase_and_AzureOpenAI.md | 6 +++--- .../RAG_with_Couchbase_and_Bedrock.md | 6 +++--- ...with_Couchbase_and_Claude(by_Anthropic).md | 6 +++--- .../RAG_with_Couchbase_and_Cohere.md | 6 +++--- .../RAG_with_Couchbase_and_CrewAI.md | 4 ++-- .../RAG_with_Couchbase_and_Jina_AI.md | 6 +++--- .../RAG_with_Couchbase_and_PydanticAI.md | 8 ++++---- .../RAG_with_Couchbase_and_SmolAgents.md | 6 +++--- .../RAG_with_Couchbase_and_Voyage.md | 6 +++--- .../vector-search-cookbook/memGpt_letta.md | 4 ++-- .../nodejs-langchain-pdf-chat.md | 20 +++++++++---------- .../bedrock-serverless-pdf-chat.md | 14 ++++++------- .../gemini-langchain-pdf-chat-py.md | 12 +++++------ .../nvidia-nim-llama3-pdf-chat.md | 12 +++++------ .../python-haystack-pdf-chat.md | 2 +- .../python-langchain-pdf-chat.md | 12 +++++------ 17 files changed, 67 insertions(+), 67 deletions(-) diff --git a/tutorial/markdown/generated/vector-search-cookbook/CouchbaseStorage_Demo.md b/tutorial/markdown/generated/vector-search-cookbook/CouchbaseStorage_Demo.md index 819cede..71903da 100644 --- a/tutorial/markdown/generated/vector-search-cookbook/CouchbaseStorage_Demo.md +++ b/tutorial/markdown/generated/vector-search-cookbook/CouchbaseStorage_Demo.md @@ -140,7 +140,7 @@ from couchbase.cluster import Cluster from couchbase.options import ClusterOptions from couchbase.auth import PasswordAuthenticator from couchbase.diagnostics import PingState, ServiceType -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore from langchain_openai import OpenAIEmbeddings, ChatOpenAI import time import json @@ -380,7 +380,7 @@ class CouchbaseStorage(RAGStorage): self.index_name = os.getenv('INDEX_NAME', 'vector_search_crew') # Initialize vector store - self.vector_store = CouchbaseVectorStore( + self.vector_store = CouchbaseSearchVectorStore( cluster=self.cluster, bucket_name=self.bucket_name, scope_name=self.scope_name, diff --git a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_AzureOpenAI.md b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_AzureOpenAI.md index c172a70..3c0e5b5 100644 --- a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_AzureOpenAI.md +++ b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_AzureOpenAI.md @@ -93,7 +93,7 @@ from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_core.runnables import RunnablePassthrough from langchain_couchbase.cache import CouchbaseCache -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore from langchain_openai import AzureChatOpenAI, AzureOpenAIEmbeddings from tqdm import tqdm ``` @@ -404,7 +404,7 @@ The vector store is set up to manage the embeddings created in the previous step ```python try: - vector_store = CouchbaseVectorStore( + vector_store = CouchbaseSearchVectorStore( cluster=cluster, bucket_name=CB_BUCKET_NAME, scope_name=SCOPE_NAME, @@ -495,7 +495,7 @@ except Exception as e: # Perform Semantic Search Semantic search in Couchbase involves converting queries and documents into vector representations using an embeddings model. These vectors capture the semantic meaning of the text and are stored directly in Couchbase. When a query is made, Couchbase performs a similarity search by comparing the query vector against the stored document vectors. The similarity metric used for this comparison is configurable, allowing flexibility in how the relevance of documents is determined. Common metrics include cosine similarity, Euclidean distance, or dot product, but other metrics can be implemented based on specific use cases. Different embedding models like BERT, Word2Vec, or GloVe can also be used depending on the application's needs, with the vectors generated by these models stored and searched within Couchbase itself. -In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. +In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseSearchVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. ```python diff --git a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Bedrock.md b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Bedrock.md index a5abd2e..dcf4009 100644 --- a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Bedrock.md +++ b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Bedrock.md @@ -97,7 +97,7 @@ from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts.chat import ChatPromptTemplate from langchain_core.runnables import RunnablePassthrough from langchain_couchbase.cache import CouchbaseCache -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore from tqdm import tqdm ``` @@ -386,7 +386,7 @@ A vector store is where we'll keep our embeddings. Unlike the FTS index, which i ```python try: - vector_store = CouchbaseVectorStore( + vector_store = CouchbaseSearchVectorStore( cluster=cluster, bucket_name=CB_BUCKET_NAME, scope_name=SCOPE_NAME, @@ -554,7 +554,7 @@ except Exception as e: # Perform Semantic Search Semantic search in Couchbase involves converting queries and documents into vector representations using an embeddings model. These vectors capture the semantic meaning of the text and are stored directly in Couchbase. When a query is made, Couchbase performs a similarity search by comparing the query vector against the stored document vectors. The similarity metric used for this comparison is configurable, allowing flexibility in how the relevance of documents is determined. Common metrics include cosine similarity, Euclidean distance, or dot product, but other metrics can be implemented based on specific use cases. Different embedding models like BERT, Word2Vec, or GloVe can also be used depending on the application's needs, with the vectors generated by these models stored and searched within Couchbase itself. -In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. +In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseSearchVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. ```python diff --git a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Claude(by_Anthropic).md b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Claude(by_Anthropic).md index 999c433..d07a0ef 100644 --- a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Claude(by_Anthropic).md +++ b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Claude(by_Anthropic).md @@ -98,7 +98,7 @@ from langchain_core.prompts.chat import (ChatPromptTemplate, SystemMessagePromptTemplate) from langchain_core.runnables import RunnablePassthrough from langchain_couchbase.cache import CouchbaseCache -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore from langchain_openai import OpenAIEmbeddings ``` @@ -392,7 +392,7 @@ A vector store is where we'll keep our embeddings. Unlike the FTS index, which i ```python try: - vector_store = CouchbaseVectorStore( + vector_store = CouchbaseSearchVectorStore( cluster=cluster, bucket_name=CB_BUCKET_NAME, scope_name=SCOPE_NAME, @@ -540,7 +540,7 @@ except Exception as e: # Perform Semantic Search Semantic search in Couchbase involves converting queries and documents into vector representations using an embeddings model. These vectors capture the semantic meaning of the text and are stored directly in Couchbase. When a query is made, Couchbase performs a similarity search by comparing the query vector against the stored document vectors. The similarity metric used for this comparison is configurable, allowing flexibility in how the relevance of documents is determined. -In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. +In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseSearchVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. ```python diff --git a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Cohere.md b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Cohere.md index d28fe86..337f1f7 100644 --- a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Cohere.md +++ b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Cohere.md @@ -96,7 +96,7 @@ from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_core.runnables import RunnablePassthrough from langchain_couchbase.cache import CouchbaseCache -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore ``` # Setup Logging @@ -386,7 +386,7 @@ The vector store is set up to manage the embeddings created in the previous step ```python try: - vector_store = CouchbaseVectorStore( + vector_store = CouchbaseSearchVectorStore( cluster=cluster, bucket_name=CB_BUCKET_NAME, scope_name=SCOPE_NAME, @@ -531,7 +531,7 @@ except Exception as e: # Perform Semantic Search Semantic search in Couchbase involves converting queries and documents into vector representations using an embeddings model. These vectors capture the semantic meaning of the text and are stored directly in Couchbase. When a query is made, Couchbase performs a similarity search by comparing the query vector against the stored document vectors. The similarity metric used for this comparison is configurable, allowing flexibility in how the relevance of documents is determined. -In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. +In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseSearchVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. ```python diff --git a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_CrewAI.md b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_CrewAI.md index 24d1a93..d2c37e9 100644 --- a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_CrewAI.md +++ b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_CrewAI.md @@ -98,7 +98,7 @@ from couchbase.options import ClusterOptions from datasets import load_dataset from dotenv import load_dotenv from crewai.tools import tool -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore from langchain_openai import ChatOpenAI, OpenAIEmbeddings from crewai import Agent, Crew, Process, Task @@ -440,7 +440,7 @@ A vector store is where we'll keep our embeddings. Unlike the FTS index, which i ```python # Setup vector store -vector_store = CouchbaseVectorStore( +vector_store = CouchbaseSearchVectorStore( cluster=cluster, bucket_name=CB_BUCKET_NAME, scope_name=SCOPE_NAME, diff --git a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Jina_AI.md b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Jina_AI.md index 187f973..880ad2c 100644 --- a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Jina_AI.md +++ b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Jina_AI.md @@ -97,7 +97,7 @@ from langchain_core.prompts import ChatPromptTemplate from langchain_core.prompts.chat import ChatPromptTemplate from langchain_core.runnables import RunnablePassthrough from langchain_couchbase.cache import CouchbaseCache -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore ``` # Setup Logging @@ -394,7 +394,7 @@ A vector store is where we'll keep our embeddings. Unlike the FTS index, which i ```python try: - vector_store = CouchbaseVectorStore( + vector_store = CouchbaseSearchVectorStore( cluster=cluster, bucket_name=CB_BUCKET_NAME, scope_name=SCOPE_NAME, @@ -559,7 +559,7 @@ except Exception as e: ## Perform Semantic Search Semantic search in Couchbase involves converting queries and documents into vector representations using an embeddings model. These vectors capture the semantic meaning of the text and are stored directly in Couchbase. When a query is made, Couchbase performs a similarity search by comparing the query vector against the stored document vectors. The similarity metric used for this comparison is configurable, allowing flexibility in how the relevance of documents is determined. -In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. +In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseSearchVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. ### Note on Retry Mechanism The search implementation includes a retry mechanism to handle rate limiting and API errors gracefully. If a rate limit error (HTTP 429) is encountered, the system will automatically retry the request up to 3 times with exponential backoff, waiting 2 seconds initially and doubling the wait time between each retry. This helps manage API usage limits while maintaining service reliability. For other types of errors, such as payment requirements or general failures, appropriate error messages and troubleshooting steps are provided to help diagnose and resolve the issue. diff --git a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_PydanticAI.md b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_PydanticAI.md index 159cf61..3cb5b41 100644 --- a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_PydanticAI.md +++ b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_PydanticAI.md @@ -83,7 +83,7 @@ from couchbase.management.search import SearchIndex from couchbase.options import ClusterOptions from datasets import load_dataset from dotenv import load_dotenv -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore from langchain_openai import OpenAIEmbeddings from tqdm import tqdm @@ -334,7 +334,7 @@ The vector store is set up to manage the embeddings created in the previous step ```python try: - vector_store = CouchbaseVectorStore( + vector_store = CouchbaseSearchVectorStore( cluster=cluster, bucket_name=CB_BUCKET_NAME, scope_name=SCOPE_NAME, @@ -443,7 +443,7 @@ PydanticAI allows us to define agents and tools easily to create Gen-AI apps in PydanticAI makes heavy use of dependency injection to provide data and services to your agent's system prompts and tools. We define dependencies using a `dataclass`, which serves as a container for our dependencies. -In our case, the only dependency for our agent to work in the `CouchbaseVectorStore` instance. However, we will still use a `dataclass` as it is good practice. In the future, in case we wish to add more dependencies, we can just add more fields to the `dataclass` `Deps`. +In our case, the only dependency for our agent to work in the `CouchbaseSearchVectorStore` instance. However, we will still use a `dataclass` as it is good practice. In the future, in case we wish to add more dependencies, we can just add more fields to the `dataclass` `Deps`. We also initialize an agent as a GPT-4o model. PydanticAI supports many different LLM providers, including Anthropic, Google, Cohere, etc. which can also be used. While initializing the agent, we also pass the type of the dependencies. This is mainly used for type checking, and not actually used at runtime. @@ -451,7 +451,7 @@ We also initialize an agent as a GPT-4o model. PydanticAI supports many differen ```python @dataclass class Deps: - vector_store: CouchbaseVectorStore + vector_store: CouchbaseSearchVectorStore agent = Agent("openai:gpt-4o", deps_type=Deps) ``` diff --git a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_SmolAgents.md b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_SmolAgents.md index e13e057..03125f4 100644 --- a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_SmolAgents.md +++ b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_SmolAgents.md @@ -81,7 +81,7 @@ from couchbase.management.search import SearchIndex from couchbase.options import ClusterOptions from datasets import load_dataset from dotenv import load_dotenv -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore from langchain_openai import OpenAIEmbeddings from smolagents import Tool, OpenAIServerModel, ToolCallingAgent @@ -362,7 +362,7 @@ A vector store is where we'll keep our embeddings. Unlike the FTS index, which i ```python try: - vector_store = CouchbaseVectorStore( + vector_store = CouchbaseSearchVectorStore( cluster=cluster, bucket_name=CB_BUCKET_NAME, scope_name=SCOPE_NAME, @@ -512,7 +512,7 @@ class RetrieverTool(Tool): } output_type = "string" - def __init__(self, vector_store: CouchbaseVectorStore, **kwargs): + def __init__(self, vector_store: CouchbaseSearchVectorStore, **kwargs): super().__init__(**kwargs) self.vector_store = vector_store diff --git a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Voyage.md b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Voyage.md index 1bcaf35..5e0a2f7 100644 --- a/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Voyage.md +++ b/tutorial/markdown/generated/vector-search-cookbook/RAG_with_Couchbase_and_Voyage.md @@ -94,7 +94,7 @@ from langchain_core.output_parsers import StrOutputParser from langchain_core.prompts import ChatPromptTemplate from langchain_core.runnables import RunnablePassthrough from langchain_couchbase.cache import CouchbaseCache -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore from langchain_openai import ChatOpenAI from langchain_voyageai import VoyageAIEmbeddings ``` @@ -383,7 +383,7 @@ The vector store is set up to manage the embeddings created in the previous step ```python try: - vector_store = CouchbaseVectorStore( + vector_store = CouchbaseSearchVectorStore( cluster=cluster, bucket_name=CB_BUCKET_NAME, scope_name=SCOPE_NAME, @@ -528,7 +528,7 @@ except Exception as e: # Perform Semantic Search Semantic search in Couchbase involves converting queries and documents into vector representations using an embeddings model. These vectors capture the semantic meaning of the text and are stored directly in Couchbase. When a query is made, Couchbase performs a similarity search by comparing the query vector against the stored document vectors. The similarity metric used for this comparison is configurable, allowing flexibility in how the relevance of documents is determined. -In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. +In the provided code, the search process begins by recording the start time, followed by executing the similarity_search_with_score method of the CouchbaseSearchVectorStore. This method searches Couchbase for the most relevant documents based on the vector similarity to the query. The search results include the document content and a similarity score that reflects how closely each document aligns with the query in the defined semantic space. The time taken to perform this search is then calculated and logged, and the results are displayed, showing the most relevant documents along with their similarity scores. This approach leverages Couchbase as both a storage and retrieval engine for vector data, enabling efficient and scalable semantic searches. The integration of vector storage and search capabilities within Couchbase allows for sophisticated semantic search operations without relying on external services for vector storage or comparison. ```python diff --git a/tutorial/markdown/generated/vector-search-cookbook/memGpt_letta.md b/tutorial/markdown/generated/vector-search-cookbook/memGpt_letta.md index fe7c984..ac0c8ff 100644 --- a/tutorial/markdown/generated/vector-search-cookbook/memGpt_letta.md +++ b/tutorial/markdown/generated/vector-search-cookbook/memGpt_letta.md @@ -182,7 +182,7 @@ def ask_climate_search( from couchbase.auth import PasswordAuthenticator from datetime import timedelta from langchain_openai import OpenAIEmbeddings - from langchain_couchbase.vectorstores import CouchbaseVectorStore + from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore import os from pydantic import SecretStr @@ -202,7 +202,7 @@ def ask_climate_search( cluster = Cluster(conn_str, options) cluster.wait_until_ready(timedelta(seconds=5)) embedding = OpenAIEmbeddings(api_key=SecretStr(openai_api_key)) - cb_vector_store = CouchbaseVectorStore( + cb_vector_store = CouchbaseSearchVectorStore( cluster, bucket_name, scope_name, diff --git a/tutorial/markdown/nodejs/nodejs-langchain-pdf-chat/nodejs-langchain-pdf-chat.md b/tutorial/markdown/nodejs/nodejs-langchain-pdf-chat/nodejs-langchain-pdf-chat.md index fd9dfcf..dcf5d4b 100644 --- a/tutorial/markdown/nodejs/nodejs-langchain-pdf-chat/nodejs-langchain-pdf-chat.md +++ b/tutorial/markdown/nodejs/nodejs-langchain-pdf-chat/nodejs-langchain-pdf-chat.md @@ -256,7 +256,7 @@ When a user asks a question or provides a prompt: - The app retrieves the text content associated with these nearest neighbor embeddings, providing the necessary context for generating a relevant response. - Couchbase's Vector Search supports advanced indexing techniques, such as [scoped indexes](https://docs.couchbase.com/nodejs-sdk/current/howtos/full-text-searching-with-sdk.html#scoped-vs-global-indexes), [dynamic indexing](https://docs.couchbase.com/server/current/fts/fts-creating-index-from-REST-dynamic.html) and [hybrid search](https://docs.couchbase.com/nodejs-sdk/current/howtos/full-text-searching-with-sdk.html#combining-fts-and-vector-queries), allowing for efficient management, better scaling of the vector store and multiple types of search supported. - The search index facilitates fast and accurate retrieval, enabling the app to provide context-aware and relevant responses to the user's queries, even when the phrasing or terminology differs from the PDF content. -- Couchbase's Vector Search integrates seamlessly with LangChain's [CouchbaseVectorStore](https://js.langchain.com/docs/integrations/vectorstores/couchbase#create-vector-store) class, abstracting away the complexities of vector similarity calculations. +- Couchbase's Vector Search integrates seamlessly with LangChain's [CouchbaseSearchVectorStore](https://js.langchain.com/docs/integrations/vectorstores/couchbase#create-vector-store) class, abstracting away the complexities of vector similarity calculations. ### LangChain.js @@ -267,7 +267,7 @@ In the PDF Chat app, LangChain is used for several tasks: - **Loading and processing PDF documents**: LangChain's [_PDFLoader_](https://js.langchain.com/docs/integrations/document_loaders/file_loaders/pdf) is used to load the PDF files and convert them into text documents. - **Text splitting**: LangChain's [_RecursiveCharacterTextSplitter_](https://js.langchain.com/docs/modules/data_connection/document_transformers/recursive_text_splitter) is used to split the text from the PDF documents into smaller chunks or passages, which are more suitable for embedding and retrieval. - **Embedding generation**: LangChain integrates with [various embedding models](https://js.langchain.com/docs/integrations/text_embedding), such as OpenAI's embeddings, to convert the text chunks into embeddings. -- **Vector store integration**: LangChain provides a [_CouchbaseVectorStore_](https://js.langchain.com/docs/integrations/vectorstores/couchbase#create-vector-store) class that seamlessly integrates with Couchbase's Vector Search, allowing the app to store and search through the embeddings and their corresponding text. +- **Vector store integration**: LangChain provides a [_CouchbaseSearchVectorStore_](https://js.langchain.com/docs/integrations/vectorstores/couchbase#create-vector-store) class that seamlessly integrates with Couchbase's Vector Search, allowing the app to store and search through the embeddings and their corresponding text. - **Chains**: LangChain provides various [chains](https://js.langchain.com/docs/modules/chains/) for different requirements. For using RAG concept, we require _Retrieval Chain_ for Retrieval and _Question Answering Chain_ for Generation part. We also add _Prompts_ that guide the language model's behavior and output. These all are combined to form a single chain which gives output from user questions. - **Streaming Output**: LangChain integrates with the [_StreamingTextResponse_](https://js.langchain.com/docs/expression_language/streaming) class, allowing the app to stream the generated answer to the client in real-time. @@ -414,7 +414,7 @@ const docs = await textSplitter.splitDocuments(rawDocs); ### Initialize OpenAI and Couchbase Vector Store -We will now initialize [OpenAI embeddings](https://js.langchain.com/docs/integrations/text_embedding/openai) which will be used by CouchbaseVectorStore for converting the split docs defined above to vectors (embeddings). +We will now initialize [OpenAI embeddings](https://js.langchain.com/docs/integrations/text_embedding/openai) which will be used by CouchbaseSearchVectorStore for converting the split docs defined above to vectors (embeddings). We will also initialize couchbase vector store with couchbase bucket info. Firstly we will connect to couchbase cluster using[`createCouchbaseCluster`](#connecting-to-couchbase). @@ -438,7 +438,7 @@ const embeddingKey = "embedding"; const scopedIndex = true; const cluster = await createCouchbaseCluster(); -const couchbaseConfig: CouchbaseVectorStoreArgs = { +const couchbaseConfig: CouchbaseSearchVectorStoreArgs = { cluster, bucketName, scopeName, @@ -452,10 +452,10 @@ const couchbaseConfig: CouchbaseVectorStoreArgs = { ### Create Vector Store From Documents -With everything ready for initializing Vector store, we create it using [_CouchbaseVectorStore.fromDocuments_](https://js.langchain.com/docs/integrations/vectorstores/couchbase#create-vector-store) function in LangChain. This function requires the documents which user wants to upload, details of couchbase vector store and an embeddings client which will create text to vector (embeddings). +With everything ready for initializing Vector store, we create it using [_CouchbaseSearchVectorStore.fromDocuments_](https://js.langchain.com/docs/integrations/vectorstores/couchbase#create-vector-store) function in LangChain. This function requires the documents which user wants to upload, details of couchbase vector store and an embeddings client which will create text to vector (embeddings). ```typescript -await CouchbaseVectorStore.fromDocuments(docs, embeddings, couchbaseConfig); +await CouchbaseSearchVectorStore.fromDocuments(docs, embeddings, couchbaseConfig); ``` ### Save PDF File @@ -532,7 +532,7 @@ const embeddings = new OpenAIEmbeddings({ ### Initialize Couchbase Vector Store -Just like in [PDF Ingest API](#Initialize-OpenAI-and-Couchbase-Vector-Store), we will initialize the couchbase vector store here. Use the same details here as well of couchbase collection and index. Now we will initialize the store using [_CouchbaseVectorStore.initialize()_](https://js.langchain.com/docs/integrations/vectorstores/couchbase#create-vector-store) method. +Just like in [PDF Ingest API](#Initialize-OpenAI-and-Couchbase-Vector-Store), we will initialize the couchbase vector store here. Use the same details here as well of couchbase collection and index. Now we will initialize the store using [_CouchbaseSearchVectorStore.initialize()_](https://js.langchain.com/docs/integrations/vectorstores/couchbase#create-vector-store) method. We also create the [retriever](https://js.langchain.com/docs/modules/data_connection/retrievers/vectorstore) of the couchbase vector store. This retriever will be used to retrieve the previously documents which are similar to current query. We also define a callback to get document details as well. @@ -546,7 +546,7 @@ const embeddingKey = "embedding"; const scopedIndex = true; const cluster = await createCouchbaseCluster(); -const couchbaseConfig: CouchbaseVectorStoreArgs = { +const couchbaseConfig: CouchbaseSearchVectorStoreArgs = { cluster, bucketName, scopeName, @@ -556,12 +556,12 @@ const couchbaseConfig: CouchbaseVectorStoreArgs = { embeddingKey, scopedIndex, }; -const couchbaseVectorStore = await CouchbaseVectorStore.initialize( +const CouchbaseSearchVectorStore = await CouchbaseSearchVectorStore.initialize( embeddings, couchbaseConfig ); -const retriever = couchbaseVectorStore.asRetriever({ +const retriever = CouchbaseSearchVectorStore.asRetriever({ callbacks: [ { handleRetrieverEnd(documents) { diff --git a/tutorial/markdown/python/bedrock-serverless-pdf-chat/bedrock-serverless-pdf-chat.md b/tutorial/markdown/python/bedrock-serverless-pdf-chat/bedrock-serverless-pdf-chat.md index 33bdce1..3493617 100644 --- a/tutorial/markdown/python/bedrock-serverless-pdf-chat/bedrock-serverless-pdf-chat.md +++ b/tutorial/markdown/python/bedrock-serverless-pdf-chat/bedrock-serverless-pdf-chat.md @@ -321,7 +321,7 @@ When a user asks a question or provides a prompt: - The app retrieves the text content associated with these nearest neighbor embeddings, providing the necessary context for generating a relevant response. - Couchbase's Vector Search supports advanced indexing techniques, such as [scoped indexes](https://docs.couchbase.com/python-sdk/current/howtos/full-text-searching-with-sdk.html#scoped-vs-global-indexes), [dynamic indexing](https://docs.couchbase.com/server/current/fts/fts-creating-index-from-REST-dynamic.html) and [hybrid search](https://docs.couchbase.com/python-sdk/current/howtos/full-text-searching-with-sdk.html#combining-fts-and-vector-queries), allowing for efficient management, better scaling of the vector store and multiple types of search supported. - The search index facilitates fast and accurate retrieval, enabling the app to provide context-aware and relevant responses to the user's queries, even when the phrasing or terminology differs from the PDF content. -- Couchbase's Vector Search integrates seamlessly with LangChain's [CouchbaseVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class, abstracting away the complexities of vector similarity calculations. +- Couchbase's Vector Search integrates seamlessly with LangChain's [CouchbaseSearchVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class, abstracting away the complexities of vector similarity calculations. ### LangChain @@ -332,7 +332,7 @@ In the PDF Chat app, LangChain is used for several tasks: - **Loading and processing PDF documents**: LangChain's [_PDFLoader_](https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf/) is used to load the PDF files and convert them into text documents. - **Text splitting**: LangChain's [_RecursiveCharacterTextSplitter_](https://python.langchain.com/docs/modules/data_connection/document_transformers/recursive_text_splitter/) is used to split the text from the PDF documents into smaller chunks or passages, which are more suitable for embedding and retrieval. - **Embedding generation**: LangChain integrates with [various embedding models](https://python.langchain.com/docs/modules/data_connection/text_embedding/), such as OpenAI's embeddings, to convert the text chunks into embeddings. -- **Vector store integration**: LangChain provides a [_CouchbaseVectorStore_](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class that seamlessly integrates with Couchbase's Vector Search, allowing the app to store and search through the embeddings and their corresponding text. +- **Vector store integration**: LangChain provides a [_CouchbaseSearchVectorStore_](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class that seamlessly integrates with Couchbase's Vector Search, allowing the app to store and search through the embeddings and their corresponding text. - **Chains**: LangChain provides various [chains](https://python.langchain.com/docs/modules/chains/) for different requirements. For using RAG concept, we require _Retrieval Chain_ for Retrieval and _Question Answering Chain_ for Generation part. We also add _Prompts_ that guide the language model's behavior and output. These all are combined to form a single chain which gives output from user questions. - **Streaming Output**: LangChain supports [streaming](https://python.langchain.com/docs/expression_language/streaming/), allowing the app to stream the generated answer to the client in real-time. @@ -382,7 +382,7 @@ Lambda calls AWS Bedrock service to get embedding of a particular text. Bedrock #### F. Send Embeddings To Couchbase -Lambda uses Couchbase Python SDK to update the corresponding Couchbase Document. Embedding is added to the Document. Here LangChain's `CouchbaseVectorStore` is used to abstract multiple methods. +Lambda uses Couchbase Python SDK to update the corresponding Couchbase Document. Embedding is added to the Document. Here LangChain's `CouchbaseSearchVectorStore` is used to abstract multiple methods. ### Chat with PDF Flow @@ -496,10 +496,10 @@ embedding = BedrockEmbeddings(client=bedrock, model_id="amazon.titan-embed-image LangChain has a Couchbase Vector Store support. We use this vector store to abstract out all the internals of getting the embeddings and sending it back to couchbase. -We will use `add_texts` method of CouchbaseVectorStore object to add text with appropriate embedding. +We will use `add_texts` method of CouchbaseSearchVectorStore object to add text with appropriate embedding. ```python -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore cb_vector_store = get_vector_store(cluster, bucket_name, scope_name, collection_name, embedding, index_name) @@ -528,7 +528,7 @@ embedding = BedrockEmbeddings(client=bedrock, model_id="amazon.titan-embed-image Similar to last section, We will create an object for couchbase vector store as part of langchain. However, now as we need to use Couchbase Vector Search feature, the vector store needs to act as a retriever. Therefore, Couchbase Vector Store Retriever as part LangChain Chain Expression Language (LCEL) will be used ahead. ```python -from langchain_couchbase.vectorstores import CouchbaseVectorStore +from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore vector_store = get_vector_store(cluster, bucket_name, scope_name, collection_name, embedding, index_name) retriever = vector_store.as_retriever() @@ -641,7 +641,7 @@ else: st.success("PDF processed and stored successfully!") ``` -> Note: Alternatively, `CouchbaseVectorStore` can be used for document ingestion with embeddings, eliminating the need for serverless architecture. The eventing method described in this tutorial is preferable for existing documents or when a dedicated server isn't used. +> Note: Alternatively, `CouchbaseSearchVectorStore` can be used for document ingestion with embeddings, eliminating the need for serverless architecture. The eventing method described in this tutorial is preferable for existing documents or when a dedicated server isn't used. #### Ask Question diff --git a/tutorial/markdown/python/gemini-langchain-pdf-chat/gemini-langchain-pdf-chat-py.md b/tutorial/markdown/python/gemini-langchain-pdf-chat/gemini-langchain-pdf-chat-py.md index 4b05028..0faee59 100644 --- a/tutorial/markdown/python/gemini-langchain-pdf-chat/gemini-langchain-pdf-chat-py.md +++ b/tutorial/markdown/python/gemini-langchain-pdf-chat/gemini-langchain-pdf-chat-py.md @@ -264,7 +264,7 @@ When a user asks a question or provides a prompt: - The app retrieves the text content associated with these nearest neighbor embeddings, providing the necessary context for generating a relevant response. - Couchbase's Vector Search supports advanced indexing techniques, such as [scoped indexes](https://docs.couchbase.com/python-sdk/current/howtos/full-text-searching-with-sdk.html#scoped-vs-global-indexes), [dynamic indexing](https://docs.couchbase.com/server/current/fts/fts-creating-index-from-REST-dynamic.html) and [hybrid search](https://docs.couchbase.com/python-sdk/current/howtos/full-text-searching-with-sdk.html#combining-fts-and-vector-queries), allowing for efficient management, better scaling of the vector store and multiple types of search supported. - The search index facilitates fast and accurate retrieval, enabling the app to provide context-aware and relevant responses to the user's queries, even when the phrasing or terminology differs from the PDF content. -- Couchbase's Vector Search integrates seamlessly with LangChain's [CouchbaseVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class, abstracting away the complexities of vector similarity calculations. +- Couchbase's Vector Search integrates seamlessly with LangChain's [CouchbaseSearchVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class, abstracting away the complexities of vector similarity calculations. ### LangChain @@ -275,7 +275,7 @@ In the PDF Chat app, LangChain is used for several tasks: - **Loading and processing PDF documents**: LangChain's [_PDFLoader_](https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf/) is used to load the PDF files and convert them into text documents. - **Text splitting**: LangChain's [_RecursiveCharacterTextSplitter_](https://python.langchain.com/docs/modules/data_connection/document_transformers/recursive_text_splitter/) is used to split the text from the PDF documents into smaller chunks or passages, which are more suitable for embedding and retrieval. - **Embedding generation**: LangChain integrates with [various embedding models](https://python.langchain.com/docs/modules/data_connection/text_embedding/), such as [GoogleGenerativeAIEmbeddings](https://python.langchain.com/docs/integrations/text_embedding/google_generative_ai/) embeddings, to convert the text chunks into embeddings. -- **Vector store integration**: LangChain provides a [_CouchbaseVectorStore_](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class that seamlessly integrates with Couchbase's Vector Search, allowing the app to store and search through the embeddings and their corresponding text. +- **Vector store integration**: LangChain provides a [_CouchbaseSearchVectorStore_](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class that seamlessly integrates with Couchbase's Vector Search, allowing the app to store and search through the embeddings and their corresponding text. - **Chains**: LangChain provides various [chains](https://python.langchain.com/docs/modules/chains/) for different requirements. For using RAG concept, we require _Retrieval Chain_ for Retrieval and _Question Answering Chain_ for Generation part. We also add _Prompts_ that guide the language model's behavior and output. These all are combined to form a single chain which gives output from user questions. - **Streaming Output**: LangChain supports [streaming](https://python.langchain.com/docs/expression_language/streaming/), allowing the app to stream the generated answer to the client in real-time. @@ -320,7 +320,7 @@ def connect_to_couchbase(connection_string, db_username, db_password): ## Initialize Embeddings and Couchbase Vector Store -We will now initialize [Google Generative AI Embeddings](https://python.langchain.com/docs/integrations/text_embedding/google_generative_ai/) which will be used by CouchbaseVectorStore for converting the split docs defined above to vectors (embeddings). +We will now initialize [Google Generative AI Embeddings](https://python.langchain.com/docs/integrations/text_embedding/google_generative_ai/) which will be used by CouchbaseSearchVectorStore for converting the split docs defined above to vectors (embeddings). We will also initialize Couchbase vector store with Couchbase bucket info. Firstly we will connect to Couchbase cluster using [`connect_to_couchbase`](#connecting-to-couchbase) method. @@ -345,7 +345,7 @@ vector_store = get_vector_store( ) ``` -We are using `get_vector_store` method which initializes LangChain's [CouchbaseVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase) +We are using `get_vector_store` method which initializes LangChain's [CouchbaseSearchVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase) ```python def get_vector_store( @@ -357,7 +357,7 @@ def get_vector_store( index_name, ): """Return the Couchbase vector store""" - vector_store = CouchbaseVectorStore( + vector_store = CouchbaseSearchVectorStore( cluster=_cluster, bucket_name=db_bucket, scope_name=db_scope, @@ -370,7 +370,7 @@ def get_vector_store( ## Uploading And Ingesting PDF -`save_to_vector_store` function takes care of uploading the PDF file in vector format to Couchbase Database using CouchbaseVectorStore in LangChain. It splits text into small chunks, generate embeddings for those chunks, and ingest the chunks and their embeddings into a Couchbase vector store. Let's go step by step on how it does. +`save_to_vector_store` function takes care of uploading the PDF file in vector format to Couchbase Database using CouchbaseSearchVectorStore in LangChain. It splits text into small chunks, generate embeddings for those chunks, and ingest the chunks and their embeddings into a Couchbase vector store. Let's go step by step on how it does. ### Upload PDF diff --git a/tutorial/markdown/python/nvidia-nim-llama3-pdf-chat/nvidia-nim-llama3-pdf-chat.md b/tutorial/markdown/python/nvidia-nim-llama3-pdf-chat/nvidia-nim-llama3-pdf-chat.md index c3113a2..4a1a908 100644 --- a/tutorial/markdown/python/nvidia-nim-llama3-pdf-chat/nvidia-nim-llama3-pdf-chat.md +++ b/tutorial/markdown/python/nvidia-nim-llama3-pdf-chat/nvidia-nim-llama3-pdf-chat.md @@ -274,7 +274,7 @@ When a user asks a question or provides a prompt: - The app retrieves the text content associated with these nearest neighbor embeddings, providing the necessary context for generating a relevant response. - Couchbase's Vector Search supports advanced indexing techniques, such as [scoped indexes](https://docs.couchbase.com/python-sdk/current/howtos/full-text-searching-with-sdk.html#scoped-vs-global-indexes), [dynamic indexing](https://docs.couchbase.com/server/current/fts/fts-creating-index-from-REST-dynamic.html) and [hybrid search](https://docs.couchbase.com/python-sdk/current/howtos/full-text-searching-with-sdk.html#combining-fts-and-vector-queries), allowing for efficient management, better scaling of the vector store and multiple types of search supported. - The search index facilitates fast and accurate retrieval, enabling the app to provide context-aware and relevant responses to the user's queries, even when the phrasing or terminology differs from the PDF content. -- Couchbase's Vector Search integrates seamlessly with LangChain's [CouchbaseVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class, abstracting away the complexities of vector similarity calculations. +- Couchbase's Vector Search integrates seamlessly with LangChain's [CouchbaseSearchVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class, abstracting away the complexities of vector similarity calculations. ### LangChain @@ -285,7 +285,7 @@ In the PDF Chat app, LangChain is used for several tasks: - **Loading and processing PDF documents**: LangChain's [_PDFLoader_](https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf/) is used to load the PDF files and convert them into text documents. - **Text splitting**: LangChain's [_RecursiveCharacterTextSplitter_](https://python.langchain.com/docs/modules/data_connection/document_transformers/recursive_text_splitter/) is used to split the text from the PDF documents into smaller chunks or passages, which are more suitable for embedding and retrieval. - **Embedding generation**: LangChain integrates with [various embedding models](https://python.langchain.com/docs/modules/data_connection/text_embedding/), such as [Nvidia QA Embedding Models](https://python.langchain.com/docs/integrations/text_embedding/nvidia_ai_endpoints/) embeddings, to convert the text chunks into embeddings. -- **Vector store integration**: LangChain provides a [_CouchbaseVectorStore_](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class that seamlessly integrates with Couchbase's Vector Search, allowing the app to store and search through the embeddings and their corresponding text. +- **Vector store integration**: LangChain provides a [_CouchbaseSearchVectorStore_](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class that seamlessly integrates with Couchbase's Vector Search, allowing the app to store and search through the embeddings and their corresponding text. - **Chains**: LangChain provides various [chains](https://python.langchain.com/docs/modules/chains/) for different requirements. For using RAG concept, we require _Retrieval Chain_ for Retrieval and _Question Answering Chain_ for Generation part. We also add _Prompts_ that guide the language model's behavior and output. These all are combined to form a single chain which gives output from user questions. - **Streaming Output**: LangChain supports [streaming](https://python.langchain.com/docs/expression_language/streaming/), allowing the app to stream the generated answer to the client in real-time. @@ -343,7 +343,7 @@ def connect_to_couchbase(connection_string, db_username, db_password): ## Initialize Embeddings and Couchbase Vector Store -We will now initialize [Nvidia Embed QA 4 Model](https://build.nvidia.com/nvidia/embed-qa-4) powered by [langchain integration](https://python.langchain.com/docs/integrations/text_embedding/nvidia_ai_endpoints/) which will be used by CouchbaseVectorStore for converting the split docs defined above to vectors (embeddings). +We will now initialize [Nvidia Embed QA 4 Model](https://build.nvidia.com/nvidia/embed-qa-4) powered by [langchain integration](https://python.langchain.com/docs/integrations/text_embedding/nvidia_ai_endpoints/) which will be used by CouchbaseSearchVectorStore for converting the split docs defined above to vectors (embeddings). We will also initialize Couchbase vector store with Couchbase bucket info. Firstly we will connect to Couchbase cluster using [`connect_to_couchbase`](#connecting-to-couchbase) method. @@ -368,7 +368,7 @@ vector_store = get_vector_store( ) ``` -We are using `get_vector_store` method which initializes LangChain's [CouchbaseVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase) +We are using `get_vector_store` method which initializes LangChain's [CouchbaseSearchVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase) ```python def get_vector_store( @@ -380,7 +380,7 @@ def get_vector_store( index_name, ): """Return the Couchbase vector store""" - vector_store = CouchbaseVectorStore( + vector_store = CouchbaseSearchVectorStore( cluster=_cluster, bucket_name=db_bucket, scope_name=db_scope, @@ -393,7 +393,7 @@ def get_vector_store( ## Uploading And Ingesting PDF -`save_to_vector_store` function takes care of uploading the PDF file in vector format to Couchbase Database using CouchbaseVectorStore in LangChain. It splits text into small chunks, generate embeddings for those chunks, and ingest the chunks and their embeddings into a Couchbase vector store. Let's go step by step on how it does. +`save_to_vector_store` function takes care of uploading the PDF file in vector format to Couchbase Database using CouchbaseSearchVectorStore in LangChain. It splits text into small chunks, generate embeddings for those chunks, and ingest the chunks and their embeddings into a Couchbase vector store. Let's go step by step on how it does. ### Upload PDF diff --git a/tutorial/markdown/python/python-haystack-pdf-chat/python-haystack-pdf-chat.md b/tutorial/markdown/python/python-haystack-pdf-chat/python-haystack-pdf-chat.md index 03d7ae6..4efa213 100644 --- a/tutorial/markdown/python/python-haystack-pdf-chat/python-haystack-pdf-chat.md +++ b/tutorial/markdown/python/python-haystack-pdf-chat/python-haystack-pdf-chat.md @@ -256,7 +256,7 @@ When a user asks a question or provides a prompt: - The app retrieves the text content associated with these nearest neighbor embeddings, providing the necessary context for generating a relevant response. - Couchbase's Vector Search supports advanced indexing techniques, such as [scoped indexes](https://docs.couchbase.com/python-sdk/current/howtos/full-text-searching-with-sdk.html#scoped-vs-global-indexes), [dynamic indexing](https://docs.couchbase.com/server/current/fts/fts-creating-index-from-REST-dynamic.html) and [hybrid search](https://docs.couchbase.com/python-sdk/current/howtos/full-text-searching-with-sdk.html#combining-fts-and-vector-queries), allowing for efficient management, better scaling of the vector store and multiple types of search supported. - The search index facilitates fast and accurate retrieval, enabling the app to provide context-aware and relevant responses to the user's queries, even when the phrasing or terminology differs from the PDF content. -- Couchbase's Vector Search integrates seamlessly with Haystack's [CouchbaseVectorStore](https://haystack.deepset.ai/integrations/couchbase-document-store) class, abstracting away the complexities of vector similarity calculations. +- Couchbase's Vector Search integrates seamlessly with Haystack's [CouchbaseSearchVectorStore](https://haystack.deepset.ai/integrations/couchbase-document-store) class, abstracting away the complexities of vector similarity calculations. ### Haystack diff --git a/tutorial/markdown/python/python-langchain-pdf-chat/python-langchain-pdf-chat.md b/tutorial/markdown/python/python-langchain-pdf-chat/python-langchain-pdf-chat.md index 5384da4..aa4a8a5 100644 --- a/tutorial/markdown/python/python-langchain-pdf-chat/python-langchain-pdf-chat.md +++ b/tutorial/markdown/python/python-langchain-pdf-chat/python-langchain-pdf-chat.md @@ -263,7 +263,7 @@ When a user asks a question or provides a prompt: - The app retrieves the text content associated with these nearest neighbor embeddings, providing the necessary context for generating a relevant response. - Couchbase's Vector Search supports advanced indexing techniques, such as [scoped indexes](https://docs.couchbase.com/python-sdk/current/howtos/full-text-searching-with-sdk.html#scoped-vs-global-indexes), [dynamic indexing](https://docs.couchbase.com/server/current/fts/fts-creating-index-from-REST-dynamic.html) and [hybrid search](https://docs.couchbase.com/python-sdk/current/howtos/full-text-searching-with-sdk.html#combining-fts-and-vector-queries), allowing for efficient management, better scaling of the vector store and multiple types of search supported. - The search index facilitates fast and accurate retrieval, enabling the app to provide context-aware and relevant responses to the user's queries, even when the phrasing or terminology differs from the PDF content. -- Couchbase's Vector Search integrates seamlessly with LangChain's [CouchbaseVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class, abstracting away the complexities of vector similarity calculations. +- Couchbase's Vector Search integrates seamlessly with LangChain's [CouchbaseSearchVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class, abstracting away the complexities of vector similarity calculations. ### LangChain @@ -274,7 +274,7 @@ In the PDF Chat app, LangChain is used for several tasks: - **Loading and processing PDF documents**: LangChain's [_PDFLoader_](https://python.langchain.com/docs/modules/data_connection/document_loaders/pdf/) is used to load the PDF files and convert them into text documents. - **Text splitting**: LangChain's [_RecursiveCharacterTextSplitter_](https://python.langchain.com/docs/modules/data_connection/document_transformers/recursive_text_splitter/) is used to split the text from the PDF documents into smaller chunks or passages, which are more suitable for embedding and retrieval. - **Embedding generation**: LangChain integrates with [various embedding models](https://python.langchain.com/docs/modules/data_connection/text_embedding/), such as OpenAI's embeddings, to convert the text chunks into embeddings. -- **Vector store integration**: LangChain provides a [_CouchbaseVectorStore_](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class that seamlessly integrates with Couchbase's Vector Search, allowing the app to store and search through the embeddings and their corresponding text. +- **Vector store integration**: LangChain provides a [_CouchbaseSearchVectorStore_](https://python.langchain.com/docs/integrations/vectorstores/couchbase/) class that seamlessly integrates with Couchbase's Vector Search, allowing the app to store and search through the embeddings and their corresponding text. - **Chains**: LangChain provides various [chains](https://python.langchain.com/docs/modules/chains/) for different requirements. For using RAG concept, we require _Retrieval Chain_ for Retrieval and _Question Answering Chain_ for Generation part. We also add _Prompts_ that guide the language model's behavior and output. These all are combined to form a single chain which gives output from user questions. - **Streaming Output**: LangChain supports [streaming](https://python.langchain.com/docs/expression_language/streaming/), allowing the app to stream the generated answer to the client in real-time. @@ -319,7 +319,7 @@ def connect_to_couchbase(connection_string, db_username, db_password): ## Initialize OpenAI and Couchbase Vector Store -We will now initialize [OpenAI embeddings](https://python.langchain.com/docs/integrations/text_embedding/openai/) which will be used by CouchbaseVectorStore for converting the split docs defined above to vectors (embeddings). +We will now initialize [OpenAI embeddings](https://python.langchain.com/docs/integrations/text_embedding/openai/) which will be used by CouchbaseSearchVectorStore for converting the split docs defined above to vectors (embeddings). We will also initialize Couchbase vector store with Couchbase bucket info. Firstly we will connect to Couchbase cluster using [`connect_to_couchbase`](#connecting-to-couchbase) method. @@ -342,7 +342,7 @@ vector_store = get_vector_store( ) ``` -We are using `get_vector_store` method which initializes LangChain's [CouchbaseVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase) +We are using `get_vector_store` method which initializes LangChain's [CouchbaseSearchVectorStore](https://python.langchain.com/docs/integrations/vectorstores/couchbase) ```python def get_vector_store( @@ -354,7 +354,7 @@ def get_vector_store( index_name, ): """Return the Couchbase vector store""" - vector_store = CouchbaseVectorStore( + vector_store = CouchbaseSearchVectorStore( cluster=_cluster, bucket_name=db_bucket, scope_name=db_scope, @@ -367,7 +367,7 @@ def get_vector_store( ## Uploading And Ingesting PDF -`save_to_vector_store` function takes care of uploading the PDF file in vector format to Couchbase Database using CouchbaseVectorStore in LangChain. It splits text into small chunks, generate embeddings for those chunks, and ingest the chunks and their embeddings into a Couchbase vector store. Let's go step by step on how it does. +`save_to_vector_store` function takes care of uploading the PDF file in vector format to Couchbase Database using CouchbaseSearchVectorStore in LangChain. It splits text into small chunks, generate embeddings for those chunks, and ingest the chunks and their embeddings into a Couchbase vector store. Let's go step by step on how it does. ### Upload PDF