From 3f9ac0ef2deec0227a3d33f860b27e1fa53b8d76 Mon Sep 17 00:00:00 2001 From: Parikshit Sharma Date: Wed, 29 Apr 2026 20:07:40 +0530 Subject: [PATCH 1/4] feat: add enterprise RAG with multi-tenancy (LangChain + Weaviate) --- .../rag-with-multi-tenancy/.env.example | 2 + .../rag-with-multi-tenancy/README.md | 32 +++++ .../enterprise_multitenant_rag.ipynb | 132 ++++++++++++++++++ .../rag-with-multi-tenancy/requirements.txt | 2 + 4 files changed, 168 insertions(+) create mode 100644 integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.env.example create mode 100644 integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/README.md create mode 100644 integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb create mode 100644 integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/requirements.txt diff --git a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.env.example b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.env.example new file mode 100644 index 00000000..6b200345 --- /dev/null +++ b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.env.example @@ -0,0 +1,2 @@ +# No keys needed for local development +# Run with: jupyter notebook diff --git a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/README.md b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/README.md new file mode 100644 index 00000000..bb0bfe22 --- /dev/null +++ b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/README.md @@ -0,0 +1,32 @@ +# Enterprise Multi-Tenant RAG with Weaviate + LangChain + +A production pattern for RAG systems serving multiple isolated tenants +from a single Weaviate collection — the architecture behind enterprise +internal knowledge bases. + +## What this covers + +- Multi-tenant collection setup with per-tenant isolation +- Scoped document ingestion per tenant +- Tenant-aware hybrid search (semantic + BM25) +- LangChain retriever with tenant context +- Graceful handling of empty tenants + +## When to use this pattern + +Use multi-tenancy when: +- Multiple teams/BUs share infrastructure but need data isolation +- You can't afford separate Weaviate instances per team +- You need tenant-level access control + +## Setup + +1. Create a free Weaviate Cloud cluster at console.weaviate.cloud +2. Copy `.env.example` to `.env` and fill in your credentials +3. `pip install -r requirements.txt` +4. Run the notebook top to bottom + +## Author + +[Parikshit Sharma](https://github.com/parikshitiiitb) — +Principal ML Engineer, production RAG systems diff --git a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb new file mode 100644 index 00000000..cb2b19a0 --- /dev/null +++ b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb @@ -0,0 +1,132 @@ +# ============================================================================= +# RUNNING THIS NOTEBOOK +# ============================================================================= +# +# MODE 1 — Local (default, no setup needed) +# ----------------------------------------- +# Uses Weaviate Embedded + sentence-transformers. Runs on CPU. Free. +# Just run: jupyter notebook +# +# MODE 2 — Production (Weaviate Cloud + OpenAI) +# ---------------------------------------------- +# Step 1: Create free cluster at console.weaviate.cloud +# Copy your cluster URL and API key +# +# Step 2: Get OpenAI API key at platform.openai.com +# +# Step 3: Replace Cell 1 with: +# +# client = weaviate.connect_to_weaviate_cloud( +# cluster_url = "YOUR_WEAVIATE_URL", +# auth_credentials = weaviate.auth.AuthApiKey("YOUR_WEAVIATE_API_KEY"), +# headers = {"X-OpenAI-Api-Key": "YOUR_OPENAI_API_KEY"} +# ) +# +# Step 4: Replace collection creation in Cell 2 with: +# +# client.collections.create( +# name = "EnterpriseKnowledgeBase", +# multi_tenancy_config = Configure.multi_tenancy(enabled=True), +# vectorizer_config = Configure.Vectorizer.text2vec_openai(), +# ... +# ) +# +# Step 5: Replace tenant_search() in Cell 5 with LangChain WeaviateVectorStore +# (see langchain-weaviate docs for full example) +# +# ============================================================================= +# Cell 1 — Local setup (no API keys needed) +import weaviate +from weaviate.embedded import EmbeddedOptions + +# Starts Weaviate in-process — no Docker, no cloud, no API key +client = weaviate.WeaviateClient( + embedded_options=EmbeddedOptions() +) +client.connect() +print("Connected:", client.is_ready()) + +# Cell 2 — Collection with local vectorizer (no OpenAI) +from weaviate.classes.config import Configure, Property, DataType + +client.collections.delete("EnterpriseKnowledgeBase") + +client.collections.create( + name="EnterpriseKnowledgeBase", + multi_tenancy_config=Configure.multi_tenancy(enabled=True), + # No external vectorizer — we'll provide our own vectors + properties=[ + Property(name="content", data_type=DataType.TEXT), + Property(name="source", data_type=DataType.TEXT), + Property(name="department", data_type=DataType.TEXT), + ] +) + +# Cell 3 — Add tenants (business units) +from weaviate.classes.tenants import Tenant + +collection = client.collections.get("EnterpriseKnowledgeBase") + +collection.tenants.create([ + Tenant(name="engineering"), + Tenant(name="finance"), + Tenant(name="legal"), +]) +print("Tenants created: engineering, finance, legal") + +# Cell 4 — Ingest documents per tenant +engineering_docs = [ + {"content": "Our RAG system uses Weaviate for vector storage with semantic chunking.", + "source": "eng-wiki", "department": "engineering"}, + {"content": "ML inference pipeline serves 5M predictions/day with <80ms p99 latency.", + "source": "eng-wiki", "department": "engineering"}, +] + +finance_docs = [ + {"content": "Q3 budget approved for ML infrastructure: $2.4M allocated.", + "source": "finance-portal", "department": "finance"}, + {"content": "Cloud spend optimization achieved 38% reduction via spot instances.", + "source": "finance-portal", "department": "finance"}, +] + +# Ingest into scoped tenant — finance cannot see engineering docs +eng_collection = collection.with_tenant("engineering") +fin_collection = collection.with_tenant("finance") + +with eng_collection.batch.dynamic() as batch: + for doc in engineering_docs: + batch.add_object(properties=doc) + +with fin_collection.batch.dynamic() as batch: + for doc in finance_docs: + batch.add_object(properties=doc) + +print("Documents ingested into isolated tenant partitions") + +# Cell 5 — Local embeddings via sentence-transformers (free, runs on CPU) +from sentence_transformers import SentenceTransformer +import numpy as np + +model = SentenceTransformer("all-MiniLM-L6-v2") # 80MB, downloads once + +def embed(text: str) -> list: + return model.encode(text).tolist() + +def tenant_search(tenant_name: str, query: str, top_k: int = 2): + """Search within a specific tenant using local embeddings.""" + collection = client.collections.get("EnterpriseKnowledgeBase") + tenant_col = collection.with_tenant(tenant_name) + query_vec = embed(query) + + results = tenant_col.query.near_vector( + near_vector=query_vec, + limit=top_k, + return_properties=["content", "source", "department"] + ) + return results.objects + +# Test +results = tenant_search("engineering", "RAG system latency") +for r in results: + print(r.properties["content"]) + diff --git a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/requirements.txt b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/requirements.txt new file mode 100644 index 00000000..47f34799 --- /dev/null +++ b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/requirements.txt @@ -0,0 +1,2 @@ +weaviate-client>=4.0.0 +sentence-transformers>=2.7.0 From bf6abd855e7f0e80ad39a4f1ac05a718162da086 Mon Sep 17 00:00:00 2001 From: Parikshit Sharma Date: Wed, 29 Apr 2026 21:45:28 +0530 Subject: [PATCH 2/4] feat: add enterprise RAG with multi-tenancy (LangChain + Weaviate) --- .../.ipython/profile_default/startup/README | 11 + .../rag-with-multi-tenancy/README.md | 24 +- .../enterprise_multitenant_rag.ipynb | 444 +++++++++---- .../executed_notebook.ipynb | 583 ++++++++++++++++++ .../rag-with-multi-tenancy/requirements.txt | 2 + 5 files changed, 921 insertions(+), 143 deletions(-) create mode 100644 integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.ipython/profile_default/startup/README create mode 100644 integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/executed_notebook.ipynb diff --git a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.ipython/profile_default/startup/README b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.ipython/profile_default/startup/README new file mode 100644 index 00000000..61d47000 --- /dev/null +++ b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.ipython/profile_default/startup/README @@ -0,0 +1,11 @@ +This is the IPython startup directory + +.py and .ipy files in this directory will be run *prior* to any code or files specified +via the exec_lines or exec_files configurables whenever you load this profile. + +Files will be run in lexicographical order, so you can control the execution order of files +with a prefix, e.g.:: + + 00-first.py + 50-middle.py + 99-last.ipy diff --git a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/README.md b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/README.md index bb0bfe22..68117166 100644 --- a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/README.md +++ b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/README.md @@ -1,32 +1,34 @@ # Enterprise Multi-Tenant RAG with Weaviate + LangChain A production pattern for RAG systems serving multiple isolated tenants -from a single Weaviate collection — the architecture behind enterprise +from a single Weaviate collection: the architecture behind enterprise internal knowledge bases. ## What this covers -- Multi-tenant collection setup with per-tenant isolation +- Multi tenant collection setup with per-tenant isolation - Scoped document ingestion per tenant -- Tenant-aware hybrid search (semantic + BM25) -- LangChain retriever with tenant context -- Graceful handling of empty tenants +- Tenant aware hybrid search (semantic + BM25) +- Minimal LangChain integration demonstrating tenant aware retrieval +- Basic handling of empty tenant queries ## When to use this pattern -Use multi-tenancy when: +Use multi tenancy when: - Multiple teams/BUs share infrastructure but need data isolation - You can't afford separate Weaviate instances per team - You need tenant-level access control ## Setup -1. Create a free Weaviate Cloud cluster at console.weaviate.cloud -2. Copy `.env.example` to `.env` and fill in your credentials -3. `pip install -r requirements.txt` -4. Run the notebook top to bottom +### Local (default) +1. `pip install -r requirements.txt` +2. Run the notebook top to bottom + +### Optional: Production (Weaviate Cloud + OpenAI) +See the "MODE 2" section in the notebook for migration steps. ## Author [Parikshit Sharma](https://github.com/parikshitiiitb) — -Principal ML Engineer, production RAG systems +Principal ML Engineer, production RAG systems \ No newline at end of file diff --git a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb index cb2b19a0..286fc72a 100644 --- a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb +++ b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb @@ -1,132 +1,312 @@ -# ============================================================================= -# RUNNING THIS NOTEBOOK -# ============================================================================= -# -# MODE 1 — Local (default, no setup needed) -# ----------------------------------------- -# Uses Weaviate Embedded + sentence-transformers. Runs on CPU. Free. -# Just run: jupyter notebook -# -# MODE 2 — Production (Weaviate Cloud + OpenAI) -# ---------------------------------------------- -# Step 1: Create free cluster at console.weaviate.cloud -# Copy your cluster URL and API key -# -# Step 2: Get OpenAI API key at platform.openai.com -# -# Step 3: Replace Cell 1 with: -# -# client = weaviate.connect_to_weaviate_cloud( -# cluster_url = "YOUR_WEAVIATE_URL", -# auth_credentials = weaviate.auth.AuthApiKey("YOUR_WEAVIATE_API_KEY"), -# headers = {"X-OpenAI-Api-Key": "YOUR_OPENAI_API_KEY"} -# ) -# -# Step 4: Replace collection creation in Cell 2 with: -# -# client.collections.create( -# name = "EnterpriseKnowledgeBase", -# multi_tenancy_config = Configure.multi_tenancy(enabled=True), -# vectorizer_config = Configure.Vectorizer.text2vec_openai(), -# ... -# ) -# -# Step 5: Replace tenant_search() in Cell 5 with LangChain WeaviateVectorStore -# (see langchain-weaviate docs for full example) -# -# ============================================================================= -# Cell 1 — Local setup (no API keys needed) -import weaviate -from weaviate.embedded import EmbeddedOptions - -# Starts Weaviate in-process — no Docker, no cloud, no API key -client = weaviate.WeaviateClient( - embedded_options=EmbeddedOptions() -) -client.connect() -print("Connected:", client.is_ready()) - -# Cell 2 — Collection with local vectorizer (no OpenAI) -from weaviate.classes.config import Configure, Property, DataType - -client.collections.delete("EnterpriseKnowledgeBase") - -client.collections.create( - name="EnterpriseKnowledgeBase", - multi_tenancy_config=Configure.multi_tenancy(enabled=True), - # No external vectorizer — we'll provide our own vectors - properties=[ - Property(name="content", data_type=DataType.TEXT), - Property(name="source", data_type=DataType.TEXT), - Property(name="department", data_type=DataType.TEXT), - ] -) - -# Cell 3 — Add tenants (business units) -from weaviate.classes.tenants import Tenant - -collection = client.collections.get("EnterpriseKnowledgeBase") - -collection.tenants.create([ - Tenant(name="engineering"), - Tenant(name="finance"), - Tenant(name="legal"), -]) -print("Tenants created: engineering, finance, legal") - -# Cell 4 — Ingest documents per tenant -engineering_docs = [ - {"content": "Our RAG system uses Weaviate for vector storage with semantic chunking.", - "source": "eng-wiki", "department": "engineering"}, - {"content": "ML inference pipeline serves 5M predictions/day with <80ms p99 latency.", - "source": "eng-wiki", "department": "engineering"}, -] - -finance_docs = [ - {"content": "Q3 budget approved for ML infrastructure: $2.4M allocated.", - "source": "finance-portal", "department": "finance"}, - {"content": "Cloud spend optimization achieved 38% reduction via spot instances.", - "source": "finance-portal", "department": "finance"}, -] - -# Ingest into scoped tenant — finance cannot see engineering docs -eng_collection = collection.with_tenant("engineering") -fin_collection = collection.with_tenant("finance") - -with eng_collection.batch.dynamic() as batch: - for doc in engineering_docs: - batch.add_object(properties=doc) - -with fin_collection.batch.dynamic() as batch: - for doc in finance_docs: - batch.add_object(properties=doc) - -print("Documents ingested into isolated tenant partitions") - -# Cell 5 — Local embeddings via sentence-transformers (free, runs on CPU) -from sentence_transformers import SentenceTransformer -import numpy as np - -model = SentenceTransformer("all-MiniLM-L6-v2") # 80MB, downloads once - -def embed(text: str) -> list: - return model.encode(text).tolist() - -def tenant_search(tenant_name: str, query: str, top_k: int = 2): - """Search within a specific tenant using local embeddings.""" - collection = client.collections.get("EnterpriseKnowledgeBase") - tenant_col = collection.with_tenant(tenant_name) - query_vec = embed(query) - - results = tenant_col.query.near_vector( - near_vector=query_vec, - limit=top_k, - return_properties=["content", "source", "department"] - ) - return results.objects - -# Test -results = tenant_search("engineering", "RAG system latency") -for r in results: - print(r.properties["content"]) - +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# RUNNING THIS NOTEBOOK\n", + "\n", + "## MODE 1 - Local (default, no setup needed)\n", + "Uses Weaviate Embedded + sentence-transformers. Runs on CPU. Free.\n", + "\n", + "Run:\n", + "`jupyter notebook`\n", + "\n", + "## MODE 2 - Production (Weaviate Cloud + OpenAI)\n", + "1. Create a free cluster at console.weaviate.cloud, then copy your cluster URL and API key.\n", + "2. Get an OpenAI API key at platform.openai.com.\n", + "3. Replace Cell 1 with:\n", + "\n", + "```python\n", + "client = weaviate.connect_to_weaviate_cloud(\n", + " cluster_url=\"YOUR_WEAVIATE_URL\",\n", + " auth_credentials=weaviate.auth.AuthApiKey(\"YOUR_WEAVIATE_API_KEY\"),\n", + " headers={\"X-OpenAI-Api-Key\": \"YOUR_OPENAI_API_KEY\"},\n", + ")\n", + "```\n", + "\n", + "4. Replace collection creation in Cell 2 with:\n", + "\n", + "```python\n", + "client.collections.create(\n", + " name=\"EnterpriseKnowledgeBase\",\n", + " multi_tenancy_config=Configure.multi_tenancy(enabled=True),\n", + " vectorizer_config=Configure.Vectorizer.text2vec_openai(),\n", + " ...\n", + ")\n", + "```\n", + "\n", + "5. Replace `tenant_search()` in Cell 5 with LangChain `WeaviateVectorStore` (see langchain-weaviate docs for a full example)." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Enterprise Multi-Tenant RAG with Weaviate + LangChain\n", + "\n", + "This notebook demonstrates a **production-style multi-tenant RAG system** using Weaviate.\n", + "\n", + "Key features:\n", + "- Tenant isolation\n", + "- Hybrid search (vector + BM25)\n", + "- Local embeddings (no API keys)\n", + "- LangChain-style retrieval" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 1. Setup Weaviate (Local Embedded) + Create Collection" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import weaviate\n", + "from weaviate.embedded import EmbeddedOptions\n", + "\n", + "client = weaviate.WeaviateClient(\n", + " embedded_options=EmbeddedOptions()\n", + ")\n", + "\n", + "client.connect()\n", + "print(\"Connected:\", client.is_ready())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "from weaviate.classes.config import Configure, Property, DataType\n", + "\n", + "client.collections.delete(\"EnterpriseKnowledgeBase\")\n", + "\n", + "client.collections.create(\n", + " name=\"EnterpriseKnowledgeBase\",\n", + " multi_tenancy_config=Configure.multi_tenancy(enabled=True),\n", + " properties=[\n", + " Property(name=\"content\", data_type=DataType.TEXT),\n", + " Property(name=\"source\", data_type=DataType.TEXT),\n", + " Property(name=\"department\", data_type=DataType.TEXT),\n", + " ]\n", + ")\n", + "\n", + "print(\"Collection created\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 2. Create Tenants (Isolation Layer)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from weaviate.classes.tenants import Tenant\n", + "\n", + "collection = client.collections.get(\"EnterpriseKnowledgeBase\")\n", + "existing = collection.tenants.get()\n", + "\n", + "if not existing:\n", + " collection.tenants.create([\n", + " Tenant(name=\"engineering\"),\n", + " Tenant(name=\"finance\"),\n", + " Tenant(name=\"legal\"),\n", + " ])\n", + "\n", + "print(\"Tenants ensured\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 3. Local Embeddings (No API Key Needed)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from sentence_transformers import SentenceTransformer\n", + "\n", + "model = SentenceTransformer(\"all-MiniLM-L6-v2\")\n", + "\n", + "def embed(text):\n", + " return model.encode(text).tolist()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 4. Ingest Documents per Tenant\n", + "\n", + "Each tenant gets completely isolated data." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "engineering_docs = [\n", + " {\"content\": \"RAG uses semantic chunking.\", \"source\": \"eng\", \"department\": \"engineering\"},\n", + " {\"content\": \"Pipeline serves 5M predictions/day.\", \"source\": \"eng\", \"department\": \"engineering\"},\n", + "]\n", + "\n", + "finance_docs = [\n", + " {\"content\": \"Budget allocated $2.4M.\", \"source\": \"fin\", \"department\": \"finance\"},\n", + " {\"content\": \"Cloud cost reduced 38%.\", \"source\": \"fin\", \"department\": \"finance\"},\n", + "]\n", + "\n", + "eng = collection.with_tenant(\"engineering\")\n", + "fin = collection.with_tenant(\"finance\")\n", + "\n", + "with eng.batch.dynamic() as batch:\n", + " for doc in engineering_docs:\n", + " batch.add_object(\n", + " properties=doc,\n", + " vector=embed(doc[\"content\"])\n", + " )\n", + "\n", + "with fin.batch.dynamic() as batch:\n", + " for doc in finance_docs:\n", + " batch.add_object(\n", + " properties=doc,\n", + " vector=embed(doc[\"content\"])\n", + " )\n", + "\n", + "print(\"Data ingested\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 5. Hybrid Search (Vector + Keyword)\n", + "\n", + "This is critical for production RAG." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def tenant_search(tenant_name, query, top_k=2):\n", + " col = client.collections.get(\"EnterpriseKnowledgeBase\")\n", + " tenant_col = col.with_tenant(tenant_name)\n", + "\n", + " query_vec = embed(query)\n", + "\n", + " results = tenant_col.query.hybrid(\n", + " query=query,\n", + " vector=query_vec,\n", + " alpha=0.5,\n", + " limit=top_k,\n", + " return_properties=[\"content\", \"source\", \"department\"]\n", + " )\n", + "\n", + " if not results.objects:\n", + " print(f\"No results for tenant: {tenant_name}\")\n", + " return []\n", + "\n", + " return results.objects\n", + "\n", + "results = tenant_search(\"engineering\", \"RAG system\")\n", + "for r in results:\n", + " print(r.properties[\"content\"])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 6. Metadata Filtering (Enterprise Control Layer)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from weaviate.classes.query import Filter\n", + "\n", + "def filtered_search(tenant_name, query):\n", + " col = client.collections.get(\"EnterpriseKnowledgeBase\")\n", + " tenant_col = col.with_tenant(tenant_name)\n", + "\n", + " results = tenant_col.query.hybrid(\n", + " query=query,\n", + " vector=embed(query),\n", + " alpha=0.5,\n", + " filters=Filter.by_property(\"department\").equal(tenant_name),\n", + " limit=2,\n", + " return_properties=[\"content\"]\n", + " )\n", + "\n", + " return results.objects\n", + "\n", + "results = filtered_search(\"engineering\", \"pipeline\")\n", + "for r in results:\n", + " print(r.properties[\"content\"])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 7. LangChain-style Retriever (Minimal)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from langchain_core.documents import Document\n", + "\n", + "def langchain_retriever(tenant, query):\n", + " results = tenant_search(tenant, query)\n", + "\n", + " return [\n", + " Document(page_content=r.properties[\"content\"], metadata=r.properties)\n", + " for r in results\n", + " ]\n", + "\n", + "docs = langchain_retriever(\"engineering\", \"RAG\")\n", + "for d in docs:\n", + " print(d.page_content)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "name": "python" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/executed_notebook.ipynb b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/executed_notebook.ipynb new file mode 100644 index 00000000..638e42d6 --- /dev/null +++ b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/executed_notebook.ipynb @@ -0,0 +1,583 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# RUNNING THIS NOTEBOOK\n", + "\n", + "## MODE 1 - Local (default, no setup needed)\n", + "Uses Weaviate Embedded + sentence-transformers. Runs on CPU. Free.\n", + "\n", + "Run:\n", + "`jupyter notebook`\n", + "\n", + "## MODE 2 - Production (Weaviate Cloud + OpenAI)\n", + "1. Create a free cluster at console.weaviate.cloud, then copy your cluster URL and API key.\n", + "2. Get an OpenAI API key at platform.openai.com.\n", + "3. Replace Cell 1 with:\n", + "\n", + "```python\n", + "client = weaviate.connect_to_weaviate_cloud(\n", + " cluster_url=\"YOUR_WEAVIATE_URL\",\n", + " auth_credentials=weaviate.auth.AuthApiKey(\"YOUR_WEAVIATE_API_KEY\"),\n", + " headers={\"X-OpenAI-Api-Key\": \"YOUR_OPENAI_API_KEY\"},\n", + ")\n", + "```\n", + "\n", + "4. Replace collection creation in Cell 2 with:\n", + "\n", + "```python\n", + "client.collections.create(\n", + " name=\"EnterpriseKnowledgeBase\",\n", + " multi_tenancy_config=Configure.multi_tenancy(enabled=True),\n", + " vectorizer_config=Configure.Vectorizer.text2vec_openai(),\n", + " ...\n", + ")\n", + "```\n", + "\n", + "5. Replace `tenant_search()` in Cell 5 with LangChain `WeaviateVectorStore` (see langchain-weaviate docs for a full example)." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Enterprise Multi-Tenant RAG with Weaviate + LangChain\n", + "\n", + "This notebook demonstrates a **production-style multi-tenant RAG system** using Weaviate.\n", + "\n", + "Key features:\n", + "- Tenant isolation\n", + "- Hybrid search (vector + BM25)\n", + "- Local embeddings (no API keys)\n", + "- LangChain-style retrieval" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 1. Setup Weaviate (Local Embedded) + Create Collection" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "execution": { + "iopub.execute_input": "2026-04-29T16:11:32.082295Z", + "iopub.status.busy": "2026-04-29T16:11:32.082182Z", + "iopub.status.idle": "2026-04-29T16:11:37.369806Z", + "shell.execute_reply": "2026-04-29T16:11:37.368896Z" + } + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/arkajamishra/Desktop/opensource_prs/recipes/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.venv-run/lib/python3.13/site-packages/authlib/_joserfc_helpers.py:8: AuthlibDeprecationWarning: authlib.jose module is deprecated, please use joserfc instead.\n", + "It will be compatible before version 2.0.0.\n", + " from authlib.jose import ECKey\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"warning\",\"log_level_env\":\"\",\"msg\":\"log level not recognized, defaulting to info\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"action\":\"startup\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"Feature flag LD integration disabled: could not locate WEAVIATE_LD_API_KEY env variable\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"action\":\"startup\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"default_vectorizer_module\":\"none\",\"level\":\"info\",\"msg\":\"the default vectorizer modules is set to \\\"none\\\", as a result all new schema classes without an explicit vectorizer setting, will use this vectorizer\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"action\":\"startup\",\"auto_schema_enabled\":{},\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"auto schema enabled setting is set to \\\"\\u0026{\\u003cnil\\u003e {{{} {0 0}} 0 0 {{} 0} {{} 0}} true}\\\"\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"No resource limits set, weaviate will use all available memory and CPU. To limit resources, set LIMIT_RESOURCES=true\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"module offload-s3 is enabled\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"flag_key\":\"collection-retrieval-strategy\",\"level\":\"info\",\"msg\":\"feature flag instantiated\",\"time\":\"2026-04-29T21:41:35+05:30\",\"tool\":\"feature_flag\",\"value\":\"LeaderOnly\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"warning\",\"msg\":\"Multiple vector spaces are present, GraphQL Explore and REST API list objects endpoint module include params has been disabled as a result.\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"open cluster service\",\"servers\":{\"Embedded_at_8079\":58211},\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"address\":\"192.168.1.6:58212\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"starting cloud rpc server ...\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"starting raft sub-system ...\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"address\":\"192.168.1.6:58211\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"tcp transport\",\"tcpMaxPool\":3,\"tcpTimeout\":10000000000,\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"loading local db\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"local DB successfully loaded\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"schema manager loaded\",\"n\":0,\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"metadata_only_voters\":false,\"msg\":\"construct a new raft node\",\"name\":\"Embedded_at_8079\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"index\":17,\"level\":\"info\",\"msg\":\"initial configuration\",\"servers\":\"[[{Suffrage:Voter ID:Embedded_at_8079 Address:192.168.1.6:54376}]]\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"last_snapshot_index\":0,\"last_store_applied_index_on_start\":20,\"level\":\"info\",\"msg\":\"raft node constructed\",\"raft_applied_index\":0,\"raft_last_index\":20,\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"hasState\":true,\"level\":\"info\",\"msg\":\"raft init\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"attempting to join\",\"remoteNodes\":{\"Embedded_at_8079\":\"192.168.1.6:58211\"},\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"follower\":{},\"leader-address\":\"\",\"leader-id\":\"\",\"level\":\"info\",\"msg\":\"entering follower state\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"attempted to join and failed\",\"remoteNode\":\"192.168.1.6:58211\",\"status\":8,\"time\":\"2026-04-29T21:41:35+05:30\"}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "{\"action\":\"read_disk_use\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"warning\",\"msg\":\"disk usage currently at 80.57%, threshold set to 80.00%\",\"path\":\"/Users/arkajamishra/.local/share/weaviate\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"attempting to join\",\"remoteNodes\":{\"Embedded_at_8079\":\"192.168.1.6:58211\"},\"time\":\"2026-04-29T21:41:36+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"attempted to join and failed\",\"remoteNode\":\"192.168.1.6:58211\",\"status\":8,\"time\":\"2026-04-29T21:41:36+05:30\"}\n", + "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"last-leader-addr\":\"\",\"last-leader-id\":\"\",\"level\":\"warning\",\"msg\":\"heartbeat timeout reached, starting election\",\"time\":\"2026-04-29T21:41:36+05:30\"}\n", + "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"entering candidate state\",\"node\":{},\"term\":6,\"time\":\"2026-04-29T21:41:36+05:30\"}\n", + "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"pre-vote successful, starting election\",\"refused\":0,\"tally\":1,\"term\":6,\"time\":\"2026-04-29T21:41:36+05:30\",\"votesNeeded\":1}\n", + "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"election won\",\"tally\":1,\"term\":6,\"time\":\"2026-04-29T21:41:36+05:30\"}\n", + "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"leader\":{},\"level\":\"info\",\"msg\":\"entering leader state\",\"time\":\"2026-04-29T21:41:36+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"last_store_log_applied_index\":20,\"level\":\"info\",\"log_index\":20,\"log_name\":\"LogCommand\",\"log_type\":0,\"msg\":\"reloading local DB as RAFT and local DB are now caught up\",\"time\":\"2026-04-29T21:41:36+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"reload local db: update schema ...\",\"time\":\"2026-04-29T21:41:36+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"index\":\"EnterpriseKnowledgeBase\",\"level\":\"info\",\"msg\":\"reload local index\",\"time\":\"2026-04-29T21:41:36+05:30\"}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"configured versions\",\"server_version\":\"1.30.5\",\"time\":\"2026-04-29T21:41:37+05:30\",\"version\":\"1.30.5\"}\n", + "{\"action\":\"grpc_startup\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"grpc server listening at [::]:50060\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"action\":\"restapi_management\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"Serving weaviate at http://127.0.0.1:8079\",\"time\":\"2026-04-29T21:41:37+05:30\",\"version\":\"1.30.5\"}\n", + "{\"address\":\"192.168.1.6:58211\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"current Leader\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"attempting to join\",\"remoteNodes\":{\"Embedded_at_8079\":\"192.168.1.6:58211\"},\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"command\":0,\"level\":\"info\",\"msg\":\"updating configuration\",\"server-addr\":\"192.168.1.6:58211\",\"server-id\":\"Embedded_at_8079\",\"servers\":\"[[{Suffrage:Voter ID:Embedded_at_8079 Address:192.168.1.6:58211}]]\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Connected: True\n" + ] + } + ], + "source": [ + "import weaviate\n", + "from weaviate.embedded import EmbeddedOptions\n", + "\n", + "client = weaviate.WeaviateClient(\n", + " embedded_options=EmbeddedOptions()\n", + ")\n", + "\n", + "client.connect()\n", + "print(\"Connected:\", client.is_ready())" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "from weaviate.classes.config import Configure, Property, DataType\n", + "\n", + "client.collections.delete(\"EnterpriseKnowledgeBase\")\n", + "\n", + "client.collections.create(\n", + " name=\"EnterpriseKnowledgeBase\",\n", + " multi_tenancy_config=Configure.multi_tenancy(enabled=True),\n", + " properties=[\n", + " Property(name=\"content\", data_type=DataType.TEXT),\n", + " Property(name=\"source\", data_type=DataType.TEXT),\n", + " Property(name=\"department\", data_type=DataType.TEXT),\n", + " ]\n", + ")\n", + "\n", + "print(\"Collection created\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 2. Create Tenants (Isolation Layer)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "execution": { + "iopub.execute_input": "2026-04-29T16:11:37.371727Z", + "iopub.status.busy": "2026-04-29T16:11:37.371584Z", + "iopub.status.idle": "2026-04-29T16:11:37.375866Z", + "shell.execute_reply": "2026-04-29T16:11:37.375531Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Tenants ensured\n" + ] + } + ], + "source": [ + "from weaviate.classes.tenants import Tenant\n", + "\n", + "collection = client.collections.get(\"EnterpriseKnowledgeBase\")\n", + "existing = collection.tenants.get()\n", + "\n", + "if not existing:\n", + " collection.tenants.create([\n", + " Tenant(name=\"engineering\"),\n", + " Tenant(name=\"finance\"),\n", + " Tenant(name=\"legal\"),\n", + " ])\n", + "\n", + "print(\"Tenants ensured\")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## 3. Local Embeddings (No API Key Needed)" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "execution": { + "iopub.execute_input": "2026-04-29T16:11:37.377015Z", + "iopub.status.busy": "2026-04-29T16:11:37.376950Z", + "iopub.status.idle": "2026-04-29T16:12:17.835122Z", + "shell.execute_reply": "2026-04-29T16:12:17.832671Z" + } + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_source/segment-1777476288880931000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/objects/segment-1777476288880862000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_department/segment-1777476288880863000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_content/segment-1777476288880869000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property__id/segment-1777476288880930000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_content_searchable/segment-1777476288881358000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_department_searchable/segment-1777476288881435000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_source_searchable/segment-1777476288881256000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"action\":\"hnsw_prefill_cache_async\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"not waiting for vector cache prefill, running in background\",\"time\":\"2026-04-29T21:41:37+05:30\",\"wait_for_cache_prefill\":false}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"Completed loading shard enterpriseknowledgebase_engineering in 10.526042ms\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", + "{\"action\":\"hnsw_vector_cache_prefill\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"count\":3000,\"index_id\":\"vectors_default\",\"level\":\"info\",\"limit\":1000000000000,\"msg\":\"prefilled vector cache\",\"time\":\"2026-04-29T21:41:37+05:30\",\"took\":52250}\n", + "{\"action\":\"telemetry_push\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"telemetry started\",\"payload\":\"\\u0026{MachineID:422adb5a-1d5c-4984-87b4-80eec8728093 Type:INIT Version:1.30.5 ObjectsCount:0 OS:darwin Arch:arm64 UsedModules:[none] CollectionsCount:1}\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/arkajamishra/Desktop/opensource_prs/recipes/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.venv-run/lib/python3.13/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", + " from .autonotebook import tqdm as notebook_tqdm\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property__id/segment-1777476289989109000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_content/segment-1777476289989993000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_source/segment-1777476289989544000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_department/segment-1777476289989927000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/objects/segment-1777476289989527000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_content_searchable/segment-1777476289990723000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_source_searchable/segment-1777476289990113000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", + "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_department_searchable/segment-1777476289990276000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", + "{\"action\":\"hnsw_prefill_cache_async\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"not waiting for vector cache prefill, running in background\",\"time\":\"2026-04-29T21:41:38+05:30\",\"wait_for_cache_prefill\":false}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"Completed loading shard enterpriseknowledgebase_finance in 2.683375ms\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", + "{\"action\":\"hnsw_vector_cache_prefill\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"count\":3000,\"index_id\":\"vectors_default\",\"level\":\"info\",\"limit\":1000000000000,\"msg\":\"prefilled vector cache\",\"time\":\"2026-04-29T21:41:38+05:30\",\"took\":83417}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "{\"action\":\"hnsw_prefill_cache_async\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"not waiting for vector cache prefill, running in background\",\"time\":\"2026-04-29T21:41:39+05:30\",\"wait_for_cache_prefill\":false}\n", + "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"Completed loading shard enterpriseknowledgebase_legal in 4.30325ms\",\"time\":\"2026-04-29T21:41:39+05:30\"}\n", + "{\"action\":\"hnsw_vector_cache_prefill\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"count\":3000,\"index_id\":\"vectors_default\",\"level\":\"info\",\"limit\":1000000000000,\"msg\":\"prefilled vector cache\",\"time\":\"2026-04-29T21:41:39+05:30\",\"took\":282958}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "{\"action\":\"read_disk_use\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"warning\",\"msg\":\"disk usage currently at 80.56%, threshold set to 80.00%\",\"path\":\"/Users/arkajamishra/.local/share/weaviate\",\"time\":\"2026-04-29T21:42:06+05:30\"}\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.\n" + ] + }, + { + "name": "stderr", + "output_type": "stream", + "text": [ + "\r", + "Loading weights: 0%| | 0/103 [00:00=4.0.0 sentence-transformers>=2.7.0 +langchain>=0.1.0 +notebook>=7.0.0 From ccf079dfc116ec146d66def86fbd802afcd191f4 Mon Sep 17 00:00:00 2001 From: Parikshit Sharma Date: Wed, 29 Apr 2026 21:55:21 +0530 Subject: [PATCH 3/4] chore: remove local artifacts and generated notebook --- .../.ipython/profile_default/startup/README | 11 - .../executed_notebook.ipynb | 583 ------------------ 2 files changed, 594 deletions(-) delete mode 100644 integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.ipython/profile_default/startup/README delete mode 100644 integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/executed_notebook.ipynb diff --git a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.ipython/profile_default/startup/README b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.ipython/profile_default/startup/README deleted file mode 100644 index 61d47000..00000000 --- a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.ipython/profile_default/startup/README +++ /dev/null @@ -1,11 +0,0 @@ -This is the IPython startup directory - -.py and .ipy files in this directory will be run *prior* to any code or files specified -via the exec_lines or exec_files configurables whenever you load this profile. - -Files will be run in lexicographical order, so you can control the execution order of files -with a prefix, e.g.:: - - 00-first.py - 50-middle.py - 99-last.ipy diff --git a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/executed_notebook.ipynb b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/executed_notebook.ipynb deleted file mode 100644 index 638e42d6..00000000 --- a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/executed_notebook.ipynb +++ /dev/null @@ -1,583 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# RUNNING THIS NOTEBOOK\n", - "\n", - "## MODE 1 - Local (default, no setup needed)\n", - "Uses Weaviate Embedded + sentence-transformers. Runs on CPU. Free.\n", - "\n", - "Run:\n", - "`jupyter notebook`\n", - "\n", - "## MODE 2 - Production (Weaviate Cloud + OpenAI)\n", - "1. Create a free cluster at console.weaviate.cloud, then copy your cluster URL and API key.\n", - "2. Get an OpenAI API key at platform.openai.com.\n", - "3. Replace Cell 1 with:\n", - "\n", - "```python\n", - "client = weaviate.connect_to_weaviate_cloud(\n", - " cluster_url=\"YOUR_WEAVIATE_URL\",\n", - " auth_credentials=weaviate.auth.AuthApiKey(\"YOUR_WEAVIATE_API_KEY\"),\n", - " headers={\"X-OpenAI-Api-Key\": \"YOUR_OPENAI_API_KEY\"},\n", - ")\n", - "```\n", - "\n", - "4. Replace collection creation in Cell 2 with:\n", - "\n", - "```python\n", - "client.collections.create(\n", - " name=\"EnterpriseKnowledgeBase\",\n", - " multi_tenancy_config=Configure.multi_tenancy(enabled=True),\n", - " vectorizer_config=Configure.Vectorizer.text2vec_openai(),\n", - " ...\n", - ")\n", - "```\n", - "\n", - "5. Replace `tenant_search()` in Cell 5 with LangChain `WeaviateVectorStore` (see langchain-weaviate docs for a full example)." - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Enterprise Multi-Tenant RAG with Weaviate + LangChain\n", - "\n", - "This notebook demonstrates a **production-style multi-tenant RAG system** using Weaviate.\n", - "\n", - "Key features:\n", - "- Tenant isolation\n", - "- Hybrid search (vector + BM25)\n", - "- Local embeddings (no API keys)\n", - "- LangChain-style retrieval" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## 1. Setup Weaviate (Local Embedded) + Create Collection" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "execution": { - "iopub.execute_input": "2026-04-29T16:11:32.082295Z", - "iopub.status.busy": "2026-04-29T16:11:32.082182Z", - "iopub.status.idle": "2026-04-29T16:11:37.369806Z", - "shell.execute_reply": "2026-04-29T16:11:37.368896Z" - } - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/arkajamishra/Desktop/opensource_prs/recipes/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.venv-run/lib/python3.13/site-packages/authlib/_joserfc_helpers.py:8: AuthlibDeprecationWarning: authlib.jose module is deprecated, please use joserfc instead.\n", - "It will be compatible before version 2.0.0.\n", - " from authlib.jose import ECKey\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"warning\",\"log_level_env\":\"\",\"msg\":\"log level not recognized, defaulting to info\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"action\":\"startup\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"Feature flag LD integration disabled: could not locate WEAVIATE_LD_API_KEY env variable\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"action\":\"startup\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"default_vectorizer_module\":\"none\",\"level\":\"info\",\"msg\":\"the default vectorizer modules is set to \\\"none\\\", as a result all new schema classes without an explicit vectorizer setting, will use this vectorizer\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"action\":\"startup\",\"auto_schema_enabled\":{},\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"auto schema enabled setting is set to \\\"\\u0026{\\u003cnil\\u003e {{{} {0 0}} 0 0 {{} 0} {{} 0}} true}\\\"\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"No resource limits set, weaviate will use all available memory and CPU. To limit resources, set LIMIT_RESOURCES=true\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"module offload-s3 is enabled\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"flag_key\":\"collection-retrieval-strategy\",\"level\":\"info\",\"msg\":\"feature flag instantiated\",\"time\":\"2026-04-29T21:41:35+05:30\",\"tool\":\"feature_flag\",\"value\":\"LeaderOnly\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"warning\",\"msg\":\"Multiple vector spaces are present, GraphQL Explore and REST API list objects endpoint module include params has been disabled as a result.\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"open cluster service\",\"servers\":{\"Embedded_at_8079\":58211},\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"address\":\"192.168.1.6:58212\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"starting cloud rpc server ...\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"starting raft sub-system ...\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"address\":\"192.168.1.6:58211\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"tcp transport\",\"tcpMaxPool\":3,\"tcpTimeout\":10000000000,\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"loading local db\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"local DB successfully loaded\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"schema manager loaded\",\"n\":0,\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"metadata_only_voters\":false,\"msg\":\"construct a new raft node\",\"name\":\"Embedded_at_8079\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"index\":17,\"level\":\"info\",\"msg\":\"initial configuration\",\"servers\":\"[[{Suffrage:Voter ID:Embedded_at_8079 Address:192.168.1.6:54376}]]\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"last_snapshot_index\":0,\"last_store_applied_index_on_start\":20,\"level\":\"info\",\"msg\":\"raft node constructed\",\"raft_applied_index\":0,\"raft_last_index\":20,\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"hasState\":true,\"level\":\"info\",\"msg\":\"raft init\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"attempting to join\",\"remoteNodes\":{\"Embedded_at_8079\":\"192.168.1.6:58211\"},\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"follower\":{},\"leader-address\":\"\",\"leader-id\":\"\",\"level\":\"info\",\"msg\":\"entering follower state\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"attempted to join and failed\",\"remoteNode\":\"192.168.1.6:58211\",\"status\":8,\"time\":\"2026-04-29T21:41:35+05:30\"}\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "{\"action\":\"read_disk_use\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"warning\",\"msg\":\"disk usage currently at 80.57%, threshold set to 80.00%\",\"path\":\"/Users/arkajamishra/.local/share/weaviate\",\"time\":\"2026-04-29T21:41:35+05:30\"}\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"attempting to join\",\"remoteNodes\":{\"Embedded_at_8079\":\"192.168.1.6:58211\"},\"time\":\"2026-04-29T21:41:36+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"attempted to join and failed\",\"remoteNode\":\"192.168.1.6:58211\",\"status\":8,\"time\":\"2026-04-29T21:41:36+05:30\"}\n", - "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"last-leader-addr\":\"\",\"last-leader-id\":\"\",\"level\":\"warning\",\"msg\":\"heartbeat timeout reached, starting election\",\"time\":\"2026-04-29T21:41:36+05:30\"}\n", - "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"entering candidate state\",\"node\":{},\"term\":6,\"time\":\"2026-04-29T21:41:36+05:30\"}\n", - "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"pre-vote successful, starting election\",\"refused\":0,\"tally\":1,\"term\":6,\"time\":\"2026-04-29T21:41:36+05:30\",\"votesNeeded\":1}\n", - "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"election won\",\"tally\":1,\"term\":6,\"time\":\"2026-04-29T21:41:36+05:30\"}\n", - "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"leader\":{},\"level\":\"info\",\"msg\":\"entering leader state\",\"time\":\"2026-04-29T21:41:36+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"last_store_log_applied_index\":20,\"level\":\"info\",\"log_index\":20,\"log_name\":\"LogCommand\",\"log_type\":0,\"msg\":\"reloading local DB as RAFT and local DB are now caught up\",\"time\":\"2026-04-29T21:41:36+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"reload local db: update schema ...\",\"time\":\"2026-04-29T21:41:36+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"index\":\"EnterpriseKnowledgeBase\",\"level\":\"info\",\"msg\":\"reload local index\",\"time\":\"2026-04-29T21:41:36+05:30\"}\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"configured versions\",\"server_version\":\"1.30.5\",\"time\":\"2026-04-29T21:41:37+05:30\",\"version\":\"1.30.5\"}\n", - "{\"action\":\"grpc_startup\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"grpc server listening at [::]:50060\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"action\":\"restapi_management\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"Serving weaviate at http://127.0.0.1:8079\",\"time\":\"2026-04-29T21:41:37+05:30\",\"version\":\"1.30.5\"}\n", - "{\"address\":\"192.168.1.6:58211\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"current Leader\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"attempting to join\",\"remoteNodes\":{\"Embedded_at_8079\":\"192.168.1.6:58211\"},\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"action\":\"raft\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"command\":0,\"level\":\"info\",\"msg\":\"updating configuration\",\"server-addr\":\"192.168.1.6:58211\",\"server-id\":\"Embedded_at_8079\",\"servers\":\"[[{Suffrage:Voter ID:Embedded_at_8079 Address:192.168.1.6:58211}]]\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Connected: True\n" - ] - } - ], - "source": [ - "import weaviate\n", - "from weaviate.embedded import EmbeddedOptions\n", - "\n", - "client = weaviate.WeaviateClient(\n", - " embedded_options=EmbeddedOptions()\n", - ")\n", - "\n", - "client.connect()\n", - "print(\"Connected:\", client.is_ready())" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "from weaviate.classes.config import Configure, Property, DataType\n", - "\n", - "client.collections.delete(\"EnterpriseKnowledgeBase\")\n", - "\n", - "client.collections.create(\n", - " name=\"EnterpriseKnowledgeBase\",\n", - " multi_tenancy_config=Configure.multi_tenancy(enabled=True),\n", - " properties=[\n", - " Property(name=\"content\", data_type=DataType.TEXT),\n", - " Property(name=\"source\", data_type=DataType.TEXT),\n", - " Property(name=\"department\", data_type=DataType.TEXT),\n", - " ]\n", - ")\n", - "\n", - "print(\"Collection created\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## 2. Create Tenants (Isolation Layer)" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "execution": { - "iopub.execute_input": "2026-04-29T16:11:37.371727Z", - "iopub.status.busy": "2026-04-29T16:11:37.371584Z", - "iopub.status.idle": "2026-04-29T16:11:37.375866Z", - "shell.execute_reply": "2026-04-29T16:11:37.375531Z" - } - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Tenants ensured\n" - ] - } - ], - "source": [ - "from weaviate.classes.tenants import Tenant\n", - "\n", - "collection = client.collections.get(\"EnterpriseKnowledgeBase\")\n", - "existing = collection.tenants.get()\n", - "\n", - "if not existing:\n", - " collection.tenants.create([\n", - " Tenant(name=\"engineering\"),\n", - " Tenant(name=\"finance\"),\n", - " Tenant(name=\"legal\"),\n", - " ])\n", - "\n", - "print(\"Tenants ensured\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## 3. Local Embeddings (No API Key Needed)" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "execution": { - "iopub.execute_input": "2026-04-29T16:11:37.377015Z", - "iopub.status.busy": "2026-04-29T16:11:37.376950Z", - "iopub.status.idle": "2026-04-29T16:12:17.835122Z", - "shell.execute_reply": "2026-04-29T16:12:17.832671Z" - } - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_source/segment-1777476288880931000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/objects/segment-1777476288880862000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_department/segment-1777476288880863000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_content/segment-1777476288880869000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property__id/segment-1777476288880930000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_content_searchable/segment-1777476288881358000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_department_searchable/segment-1777476288881435000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/engineering/lsm/property_source_searchable/segment-1777476288881256000.wal\",\"shard\":\"engineering\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"action\":\"hnsw_prefill_cache_async\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"not waiting for vector cache prefill, running in background\",\"time\":\"2026-04-29T21:41:37+05:30\",\"wait_for_cache_prefill\":false}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"Completed loading shard enterpriseknowledgebase_engineering in 10.526042ms\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n", - "{\"action\":\"hnsw_vector_cache_prefill\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"count\":3000,\"index_id\":\"vectors_default\",\"level\":\"info\",\"limit\":1000000000000,\"msg\":\"prefilled vector cache\",\"time\":\"2026-04-29T21:41:37+05:30\",\"took\":52250}\n", - "{\"action\":\"telemetry_push\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"telemetry started\",\"payload\":\"\\u0026{MachineID:422adb5a-1d5c-4984-87b4-80eec8728093 Type:INIT Version:1.30.5 ObjectsCount:0 OS:darwin Arch:arm64 UsedModules:[none] CollectionsCount:1}\",\"time\":\"2026-04-29T21:41:37+05:30\"}\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/arkajamishra/Desktop/opensource_prs/recipes/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/.venv-run/lib/python3.13/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", - " from .autonotebook import tqdm as notebook_tqdm\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property__id/segment-1777476289989109000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_content/segment-1777476289989993000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_source/segment-1777476289989544000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_department/segment-1777476289989927000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/objects/segment-1777476289989527000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_content_searchable/segment-1777476289990723000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_source_searchable/segment-1777476289990113000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", - "{\"action\":\"lsm_recover_from_active_wal_success\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"class\":\"EnterpriseKnowledgeBase\",\"index\":\"enterpriseknowledgebase\",\"level\":\"info\",\"msg\":\"successfully recovered from write-ahead-log\",\"path\":\"/Users/arkajamishra/.local/share/weaviate/enterpriseknowledgebase/finance/lsm/property_department_searchable/segment-1777476289990276000.wal\",\"shard\":\"finance\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", - "{\"action\":\"hnsw_prefill_cache_async\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"not waiting for vector cache prefill, running in background\",\"time\":\"2026-04-29T21:41:38+05:30\",\"wait_for_cache_prefill\":false}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"Completed loading shard enterpriseknowledgebase_finance in 2.683375ms\",\"time\":\"2026-04-29T21:41:38+05:30\"}\n", - "{\"action\":\"hnsw_vector_cache_prefill\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"count\":3000,\"index_id\":\"vectors_default\",\"level\":\"info\",\"limit\":1000000000000,\"msg\":\"prefilled vector cache\",\"time\":\"2026-04-29T21:41:38+05:30\",\"took\":83417}\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "{\"action\":\"hnsw_prefill_cache_async\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"not waiting for vector cache prefill, running in background\",\"time\":\"2026-04-29T21:41:39+05:30\",\"wait_for_cache_prefill\":false}\n", - "{\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"info\",\"msg\":\"Completed loading shard enterpriseknowledgebase_legal in 4.30325ms\",\"time\":\"2026-04-29T21:41:39+05:30\"}\n", - "{\"action\":\"hnsw_vector_cache_prefill\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"count\":3000,\"index_id\":\"vectors_default\",\"level\":\"info\",\"limit\":1000000000000,\"msg\":\"prefilled vector cache\",\"time\":\"2026-04-29T21:41:39+05:30\",\"took\":282958}\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "{\"action\":\"read_disk_use\",\"build_git_commit\":\"62dcafac32\",\"build_go_version\":\"go1.24.3\",\"build_image_tag\":\"HEAD\",\"build_wv_version\":\"1.30.5\",\"level\":\"warning\",\"msg\":\"disk usage currently at 80.56%, threshold set to 80.00%\",\"path\":\"/Users/arkajamishra/.local/share/weaviate\",\"time\":\"2026-04-29T21:42:06+05:30\"}\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\r", - "Loading weights: 0%| | 0/103 [00:00 Date: Wed, 29 Apr 2026 22:31:14 +0530 Subject: [PATCH 4/4] fix: make collection setup cell executable --- .../enterprise_multitenant_rag.ipynb | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb index 286fc72a..bf30f610 100644 --- a/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb +++ b/integrations/llm-agent-frameworks/langchain/rag-with-multi-tenancy/enterprise_multitenant_rag.ipynb @@ -69,21 +69,17 @@ "source": [ "import weaviate\n", "from weaviate.embedded import EmbeddedOptions\n", + "from weaviate.classes.config import Configure, Property, DataType\n", "\n", "client = weaviate.WeaviateClient(\n", " embedded_options=EmbeddedOptions()\n", ")\n", "\n", "client.connect()\n", - "print(\"Connected:\", client.is_ready())" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "from weaviate.classes.config import Configure, Property, DataType\n", + "print(\"Connected:\", client.is_ready())\n", + "\n", "\n", + "#Create Collection\n", "client.collections.delete(\"EnterpriseKnowledgeBase\")\n", "\n", "client.collections.create(\n", @@ -299,12 +295,13 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": ".venv-review", "language": "python", "name": "python3" }, "language_info": { - "name": "python" + "name": "python", + "version": "3.13.2" } }, "nbformat": 4,