Skip to content

Updated lanchain-couchbase version #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
7bc1c0d
Updated lanchain-couchbase version
AayushTyagi1 Apr 10, 2025
4b2d700
Update Description
AayushTyagi1 Apr 10, 2025
be54386
Upgrade langchain model
AayushTyagi1 Apr 10, 2025
41838b5
Upgrade Langchain in Claude Tutorial
AayushTyagi1 Apr 11, 2025
7f32d8b
Remove SourceUUID from Indexes
AayushTyagi1 Apr 11, 2025
426709e
Update Couchbase Vector Store in Cohere
AayushTyagi1 Apr 11, 2025
72ce69f
Update langchain-couchbase in CrewAI
AayushTyagi1 Apr 11, 2025
cd1b10e
Update langchain-couchbase in JinhaAI
AayushTyagi1 Apr 11, 2025
3b2b318
Update env sample in JinhaAI
AayushTyagi1 Apr 11, 2025
bf4d9db
Update langchain-couchbase in Vector Search Cookbook
AayushTyagi1 Apr 11, 2025
2aa7563
Fix Pydantic AI tutorial
AayushTyagi1 Apr 11, 2025
2b7e65a
Update Timeout after creating a Bucket
AayushTyagi1 Apr 11, 2025
797b912
DA-767 Added Frontmatter to Deepseek Tutorial
AayushTyagi1 Apr 15, 2025
c04b82e
DA-767 Fix Frontmatter
AayushTyagi1 Apr 15, 2025
4218fd9
DA-747 Fix Frontmatter
AayushTyagi1 Apr 16, 2025
c0fcf45
DA-767: Modified Version mentioned
AayushTyagi1 Apr 16, 2025
3a60af4
DA-767: Modified Version mentioned for crewAI Short term
AayushTyagi1 Apr 17, 2025
d12f8a2
AWS Bedrock, ClaudeAI Cohere PydanticAI update
AayushTyagi1 Apr 17, 2025
0ccbf7a
DA-767: Added versioning
AayushTyagi1 Apr 21, 2025
c7787b7
DA-767 Update Version Voyage
AayushTyagi1 Apr 21, 2025
c810b36
DA-767 Update Index Definitions
AayushTyagi1 May 22, 2025
1c0d2fb
CHange to CouchbaseSearchVectorStore
AayushTyagi1 May 22, 2025
820b360
DA-767 Update Hugging Face Tutorial
AayushTyagi1 May 22, 2025
4d320f7
DA-767 Update Jina AI Tutorial
AayushTyagi1 May 22, 2025
561e8c7
DA-767 Remove Output
AayushTyagi1 May 22, 2025
7bf6a92
Updated Ag2 tutorial
AayushTyagi1 May 22, 2025
3f24d3e
DA-767 Clear Cell Output
AayushTyagi1 May 22, 2025
343b637
Merge branch 'main' into DA-767-update-tutorials-as-per-couchbase-lan…
AayushTyagi1 May 22, 2025
78786c0
DA-767 Rename File
AayushTyagi1 May 22, 2025
ed7f0d7
DA-767 Mention Versions
AayushTyagi1 May 22, 2025
66936b9
DA-767 Remove Letta Tutorial
AayushTyagi1 May 26, 2025
c4ddcae
Update tutorials to align with latest Couchbase and Langchain versions
teetangh May 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,9 @@ For more information on creating a vector search index, please follow the [instr
{
"type": "fulltext-index",
"name": "vector_search_azure",
"uuid": "12fe1360b64a69c0",
"uuid": "",
"sourceType": "gocbcore",
"sourceName": "vector-search-testing",
"sourceUUID": "ee9841e7b3a580d76862bb00927affc4",
"planParams": {
"maxPartitionsPerPIndex": 64,
"indexPartitions": 16
Expand Down
29 changes: 20 additions & 9 deletions ag2/agentchat_RetrieveChat_couchbase.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"outputs": [],
"source": [
"!pip install \"pyautogen[openai,retrievechat-couchbase]\" \"flaml[automl]\" couchbase==4.3.3\n",
"%pip install \"pyautogen[openai,retrievechat-couchbase]==0.8.7\" \"flaml[automl]==2.3.4\" couchbase==4.3.3\n",
"# For more information, please refer to the [installation guide](/docs/installation/)."
]
},
Expand Down Expand Up @@ -260,7 +260,7 @@
"\n",
"from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent\n",
"\n",
"# Accepted file formats for that can be stored in\n",
"# Accepted file formats that can be stored in\n",
"# a vector database instance\n",
"from autogen.retrieve_utils import TEXT_FORMATS\n",
"\n",
Expand Down Expand Up @@ -383,7 +383,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {
"id": "NaKfEfFmdM_v"
},
Expand Down Expand Up @@ -444,7 +444,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {
"id": "sPXTA8GhjS_d"
},
Expand Down Expand Up @@ -486,7 +486,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {
"id": "umjcgXZtr9bz"
},
Expand Down Expand Up @@ -553,7 +553,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {
"collapsed": true,
"id": "hTb8DV6Rr_i-"
Expand All @@ -566,11 +566,22 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {
"id": "FOQqd3TqsyeT"
},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"(454, 454)"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(docs_file_paths), len(docs_links)"
]
Expand Down Expand Up @@ -665,7 +676,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 55,
"metadata": {
"id": "qiRGwh1FcUpt"
},
Expand Down
140 changes: 85 additions & 55 deletions awsbedrock/RAG_with_Couchbase_and_Bedrock.ipynb

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions awsbedrock/aws_index.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"type": "fulltext-index",
"name": "vector_search_bedrock",
"uuid": "12fe1360b64a69c0",
"uuid": "",
"sourceType": "gocbcore",
"sourceName": "vector-search-testing",
"sourceUUID": "ee9841e7b3a580d76862bb00927affc4",
"planParams": {
"maxPartitionsPerPIndex": 64,
"indexPartitions": 16
Expand Down
153 changes: 16 additions & 137 deletions azure/RAG_with_Couchbase_and_AzureOpenAI.ipynb

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions azure/azure_index.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"type": "fulltext-index",
"name": "vector_search_azure",
"uuid": "12fe1360b64a69c0",
"uuid": "",
"sourceType": "gocbcore",
"sourceName": "vector-search-testing",
"sourceUUID": "ee9841e7b3a580d76862bb00927affc4",
"planParams": {
"maxPartitionsPerPIndex": 64,
"indexPartitions": 16
Expand Down
9 changes: 5 additions & 4 deletions capella-ai/langchain/RAG_with_Couchbase_Capella.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
"outputs": [],
"source": [
"!pip install --quiet datasets langchain-couchbase langchain-openai"
"!pip install --quiet datasets==3.6.0 langchain-couchbase==0.3.0 langchain-openai==0.3.17"
]
},
{
Expand Down Expand Up @@ -115,7 +115,7 @@
"from langchain_core.output_parsers import StrOutputParser\n",
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_core.runnables import RunnablePassthrough\n",
"from langchain_couchbase.vectorstores import CouchbaseVectorStore\n",
"from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore\n",
"from langchain_openai import ChatOpenAI, OpenAIEmbeddings\n",
"\n",
"from tqdm import tqdm\n",
Expand Down Expand Up @@ -283,6 +283,7 @@
" print(f\"Collection '{collection_name}' already exists. Skipping creation.\")\n",
"\n",
" collection = bucket.scope(scope_name).collection(collection_name)\n",
" time.sleep(2) # Give the collection time to be ready for queries\n",
"\n",
" # Ensure primary index exists\n",
" try:\n",
Expand Down Expand Up @@ -640,7 +641,7 @@
"outputs": [],
"source": [
"try:\n",
" vector_store = CouchbaseVectorStore(\n",
" vector_store = CouchbaseSearchVectorStore(\n",
" cluster=cluster,\n",
" bucket_name=CB_BUCKET_NAME,\n",
" scope_name=SCOPE_NAME,\n",
Expand Down Expand Up @@ -732,7 +733,7 @@
"# Perform Semantic Search\n",
"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.\n",
"\n",
"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."
]
},
{
Expand Down
3 changes: 1 addition & 2 deletions capella-ai/langchain/capella_index.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"type": "fulltext-index",
"name": "model_tutorial.rag.vs-index",
"uuid": "7377c28e3b64270f",
"uuid": "",
"sourceType": "gocbcore",
"sourceName": "model_tutorial",
"sourceUUID": "23a9a323ea50144479be8c1deb2a3ad0",
"planParams": {
"maxPartitionsPerPIndex": 1024,
"indexPartitions": 1
Expand Down
6 changes: 3 additions & 3 deletions capella-ai/llamaindex/RAG_with_Couchbase_Capella.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"outputs": [],
"source": [
"# Install required packages\n",
"%pip install datasets llama-index-vector-stores-couchbase llama-index-embeddings-openai llama-index-llms-openai-like llama-index"
"%pip install datasets llama-index-vector-stores-couchbase==0.4.0 llama-index-embeddings-openai==0.3.1 llama-index-llms-openai-like==0.3.5 llama-index==0.12.37"
]
},
{
Expand Down Expand Up @@ -102,7 +102,7 @@
"from llama_index.core import Settings, Document\n",
"from llama_index.core.ingestion import IngestionPipeline\n",
"from llama_index.core.node_parser import SentenceSplitter\n",
"from llama_index.vector_stores.couchbase import CouchbaseVectorStore\n",
"from llama_index.vector_stores.couchbase import CouchbaseSearchVectorStore\n",
"from llama_index.embeddings.openai import OpenAIEmbedding\n",
"from llama_index.llms.openai_like import OpenAILike\n"
]
Expand Down Expand Up @@ -430,7 +430,7 @@
"source": [
"try:\n",
" # Create the Couchbase vector store\n",
" vector_store = CouchbaseVectorStore(\n",
" vector_store = CouchbaseSearchVectorStore(\n",
" cluster=cluster,\n",
" bucket_name=CB_BUCKET_NAME,\n",
" scope_name=SCOPE_NAME,\n",
Expand Down
9 changes: 5 additions & 4 deletions claudeai/RAG_with_Couchbase_and_Claude(by_Anthropic).ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
}
],
"source": [
"%pip install --quiet datasets langchain-couchbase langchain-anthropic langchain-openai python-dotenv"
"%pip install --quiet datasets==3.5.0 langchain-couchbase==0.3.0 langchain-anthropic==0.3.11 langchain-openai==0.3.13 python-dotenv==1.1.0"
]
},
{
Expand Down Expand Up @@ -124,7 +124,7 @@
" SystemMessagePromptTemplate)\n",
"from langchain_core.runnables import RunnablePassthrough\n",
"from langchain_couchbase.cache import CouchbaseCache\n",
"from langchain_couchbase.vectorstores import CouchbaseVectorStore\n",
"from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore\n",
"from langchain_openai import OpenAIEmbeddings"
]
},
Expand Down Expand Up @@ -330,6 +330,7 @@
" num_replicas=0\n",
" )\n",
" cluster.buckets().create_bucket(bucket_settings)\n",
" time.sleep(2) # Wait for bucket creation to complete and become available\n",
" bucket = cluster.bucket(bucket_name)\n",
" logging.info(f\"Bucket '{bucket_name}' created successfully.\")\n",
"\n",
Expand Down Expand Up @@ -576,7 +577,7 @@
],
"source": [
"try:\n",
" vector_store = CouchbaseVectorStore(\n",
" vector_store = CouchbaseSearchVectorStore(\n",
" cluster=cluster,\n",
" bucket_name=CB_BUCKET_NAME,\n",
" scope_name=SCOPE_NAME,\n",
Expand Down Expand Up @@ -812,7 +813,7 @@
"# Perform Semantic Search\n",
"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. \n",
"\n",
"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."
]
},
{
Expand Down
3 changes: 1 addition & 2 deletions claudeai/claude_index.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"type": "fulltext-index",
"name": "vector_search_claude",
"uuid": "12fe1360b64a69c0",
"uuid": "",
"sourceType": "gocbcore",
"sourceName": "vector-search-testing",
"sourceUUID": "ee9841e7b3a580d76862bb00927affc4",
"planParams": {
"maxPartitionsPerPIndex": 64,
"indexPartitions": 16
Expand Down
9 changes: 5 additions & 4 deletions cohere/RAG_with_Couchbase_and_Cohere.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
}
],
"source": [
"%pip install --quiet datasets langchain-couchbase langchain-cohere python-dotenv"
"%pip install --quiet datasets==3.5.0 langchain-couchbase==0.3.0 langchain-cohere==0.4.4 python-dotenv==1.1.0"
]
},
{
Expand Down Expand Up @@ -126,7 +126,7 @@
"from langchain_core.prompts import ChatPromptTemplate\n",
"from langchain_core.runnables import RunnablePassthrough\n",
"from langchain_couchbase.cache import CouchbaseCache\n",
"from langchain_couchbase.vectorstores import CouchbaseVectorStore"
"from langchain_couchbase.vectorstores import CouchbaseSearchVectorStore"
]
},
{
Expand Down Expand Up @@ -317,6 +317,7 @@
" num_replicas=0\n",
" )\n",
" cluster.buckets().create_bucket(bucket_settings)\n",
" time.sleep(2) # Wait for bucket creation to complete and become available\n",
" bucket = cluster.bucket(bucket_name)\n",
" logging.info(f\"Bucket '{bucket_name}' created successfully.\")\n",
"\n",
Expand Down Expand Up @@ -565,7 +566,7 @@
],
"source": [
"try:\n",
" vector_store = CouchbaseVectorStore(\n",
" vector_store = CouchbaseSearchVectorStore(\n",
" cluster=cluster,\n",
" bucket_name=CB_BUCKET_NAME,\n",
" scope_name=SCOPE_NAME,\n",
Expand Down Expand Up @@ -799,7 +800,7 @@
"# Perform Semantic Search\n",
"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. \n",
"\n",
"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."
]
},
{
Expand Down
3 changes: 1 addition & 2 deletions cohere/cohere_index.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"type": "fulltext-index",
"name": "vector_search_cohere",
"uuid": "12fe1360b64a69c0",
"uuid": "",
"sourceType": "gocbcore",
"sourceName": "vector-search-testing",
"sourceUUID": "ee9841e7b3a580d76862bb00927affc4",
"planParams": {
"maxPartitionsPerPIndex": 64,
"indexPartitions": 16
Expand Down
Loading