[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-langchain-langchain-rag":3,"mdc-feblxe-key":34,"related-org-langchain-langchain-rag":5576,"related-repo-langchain-langchain-rag":5755},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":24,"repoUrl":25,"updatedAt":26,"license":27,"forks":28,"topics":29,"repo":30,"sourceUrl":32,"mdContent":33},"langchain-rag","build RAG systems with LangChain","INVOKE THIS SKILL when building ANY retrieval-augmented generation (RAG) system. Covers document loaders, RecursiveCharacterTextSplitter, embeddings (OpenAI), and vector stores (Chroma, FAISS, Pinecone).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"langchain","LangChain","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Flangchain.png","langchain-ai",[13,17,18,21],{"name":14,"slug":15,"type":16},"LLM","llm","tag",{"name":9,"slug":8,"type":16},{"name":19,"slug":20,"type":16},"Database","database",{"name":22,"slug":23,"type":16},"Search","search",877,"https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain-skills","2026-07-18T05:16:04.202978",null,77,[],{"repoUrl":25,"stars":24,"forks":28,"topics":31,"description":27},[],"https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain-skills\u002Ftree\u002FHEAD\u002Fconfig\u002Fskills\u002Flangchain-rag","---\nname: langchain-rag\ndescription: \"INVOKE THIS SKILL when building ANY retrieval-augmented generation (RAG) system. Covers document loaders, RecursiveCharacterTextSplitter, embeddings (OpenAI), and vector stores (Chroma, FAISS, Pinecone).\"\n---\n\n\u003Coverview>\nRetrieval Augmented Generation (RAG) enhances LLM responses by fetching relevant context from external knowledge sources.\n\n**Pipeline:**\n1. **Index**: Load → Split → Embed → Store\n2. **Retrieve**: Query → Embed → Search → Return docs\n3. **Generate**: Docs + Query → LLM → Response\n\n**Key Components:**\n- **Document Loaders**: Ingest data from files, web, databases\n- **Text Splitters**: Break documents into chunks\n- **Embeddings**: Convert text to vectors\n- **Vector Stores**: Store and search embeddings\n\u003C\u002Foverview>\n\n\u003Cvectorstore-selection>\n\n| Vector Store | Use Case | Persistence |\n|--------------|----------|-------------|\n| **InMemory** | Testing | Memory only |\n| **FAISS** | Local, high performance | Disk |\n| **Chroma** | Development | Disk |\n| **Pinecone** | Production, managed | Cloud |\n\n\u003C\u002Fvectorstore-selection>\n\n---\n\n## Complete RAG Pipeline\n\n\u003Cex-basic-rag-setup>\n\u003Cpython>\nEnd-to-end RAG pipeline: load documents, split into chunks, embed, store, retrieve, and generate a response.\n\n```python\nfrom langchain_openai import ChatOpenAI, OpenAIEmbeddings\nfrom langchain_community.vectorstores import InMemoryVectorStore\nfrom langchain_text_splitters import RecursiveCharacterTextSplitter\nfrom langchain_core.documents import Document\n\n# 1. Load documents\ndocs = [\n    Document(page_content=\"LangChain is a framework for LLM apps.\", metadata={}),\n    Document(page_content=\"RAG = Retrieval Augmented Generation.\", metadata={}),\n]\n\n# 2. Split documents\nsplitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)\nsplits = splitter.split_documents(docs)\n\n# 3. Create embeddings and store\nembeddings = OpenAIEmbeddings(model=\"text-embedding-3-small\")\nvectorstore = InMemoryVectorStore.from_documents(splits, embeddings)\n\n# 4. Create retriever\nretriever = vectorstore.as_retriever(search_kwargs={\"k\": 4})\n\n# 5. Use in RAG\nmodel = ChatOpenAI(model=\"gpt-4.1\")\nquery = \"What is RAG?\"\nrelevant_docs = retriever.invoke(query)\n\ncontext = \"\\n\\n\".join([doc.page_content for doc in relevant_docs])\nresponse = model.invoke([\n    {\"role\": \"system\", \"content\": f\"Use this context:\\n\\n{context}\"},\n    {\"role\": \"user\", \"content\": query},\n])\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nEnd-to-end RAG pipeline: load documents, split into chunks, embed, store, retrieve, and generate a response.\n\n```typescript\nimport { ChatOpenAI, OpenAIEmbeddings } from \"@langchain\u002Fopenai\";\nimport { MemoryVectorStore } from \"@langchain\u002Fclassic\u002Fvectorstores\u002Fmemory\";\nimport { RecursiveCharacterTextSplitter } from \"@langchain\u002Ftextsplitters\";\nimport { Document } from \"@langchain\u002Fcore\u002Fdocuments\";\n\n\u002F\u002F 1. Load documents\nconst docs = [\n  new Document({ pageContent: \"LangChain is a framework for LLM apps.\", metadata: {} }),\n  new Document({ pageContent: \"RAG = Retrieval Augmented Generation.\", metadata: {} }),\n];\n\n\u002F\u002F 2. Split documents\nconst splitter = new RecursiveCharacterTextSplitter({ chunkSize: 500, chunkOverlap: 50 });\nconst splits = await splitter.splitDocuments(docs);\n\n\u002F\u002F 3. Create embeddings and store\nconst embeddings = new OpenAIEmbeddings({ model: \"text-embedding-3-small\" });\nconst vectorstore = await MemoryVectorStore.fromDocuments(splits, embeddings);\n\n\u002F\u002F 4. Create retriever\nconst retriever = vectorstore.asRetriever({ k: 4 });\n\n\u002F\u002F 5. Use in RAG\nconst model = new ChatOpenAI({ model: \"gpt-4.1\" });\nconst query = \"What is RAG?\";\nconst relevantDocs = await retriever.invoke(query);\n\nconst context = relevantDocs.map(doc => doc.pageContent).join(\"\\n\\n\");\nconst response = await model.invoke([\n  { role: \"system\", content: `Use this context:\\n\\n${context}` },\n  { role: \"user\", content: query },\n]);\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-basic-rag-setup>\n\n---\n\n## Document Loaders\n\n\u003Cex-loading-pdf>\n\u003Cpython>\nLoad a PDF file and extract each page as a separate document.\n\n```python\nfrom langchain_community.document_loaders import PyPDFLoader\n\nloader = PyPDFLoader(\".\u002Fdocument.pdf\")\ndocs = loader.load()\nprint(f\"Loaded {len(docs)} pages\")\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nLoad a PDF file and extract each page as a separate document.\n\n```typescript\nimport { PDFLoader } from \"@langchain\u002Fcommunity\u002Fdocument_loaders\u002Ffs\u002Fpdf\";\n\nconst loader = new PDFLoader(\".\u002Fdocument.pdf\");\nconst docs = await loader.load();\nconsole.log(`Loaded ${docs.length} pages`);\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-loading-pdf>\n\n\u003Cex-loading-web-pages>\n\u003Cpython>\nFetch and parse content from a web URL into a document.\n\n```python\nfrom langchain_community.document_loaders import WebBaseLoader\n\nloader = WebBaseLoader(\"https:\u002F\u002Fdocs.langchain.com\")\ndocs = loader.load()\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nFetch and parse content from a web URL into a document using Cheerio.\n\n```typescript\nimport { CheerioWebBaseLoader } from \"@langchain\u002Fcommunity\u002Fdocument_loaders\u002Fweb\u002Fcheerio\";\n\nconst loader = new CheerioWebBaseLoader(\"https:\u002F\u002Fdocs.langchain.com\");\nconst docs = await loader.load();\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-loading-web-pages>\n\n\u003Cex-loading-directory>\n\u003Cpython>\nLoad all text files from a directory using a glob pattern.\n\n```python\nfrom langchain_community.document_loaders import DirectoryLoader, TextLoader\n\n# Load all text files from directory\nloader = DirectoryLoader(\n    \"path\u002Fto\u002Fdocuments\",\n    glob=\"**\u002F*.txt\",  # Pattern for files to load\n    loader_cls=TextLoader\n)\ndocs = loader.load()\n```\n\u003C\u002Fpython>\n\u003C\u002Fex-loading-directory>\n\n---\n\n## Text Splitting\n\n\u003Cex-text-splitting>\n\u003Cpython>\nSplit documents into chunks using RecursiveCharacterTextSplitter with configurable size and overlap.\n\n```python\nfrom langchain_text_splitters import RecursiveCharacterTextSplitter\n\nsplitter = RecursiveCharacterTextSplitter(\n    chunk_size=1000,        # Characters per chunk\n    chunk_overlap=200,      # Overlap for context continuity\n    separators=[\"\\n\\n\", \"\\n\", \" \", \"\"],  # Split hierarchy\n)\n\nsplits = splitter.split_documents(docs)\n```\n\u003C\u002Fpython>\n\u003C\u002Fex-text-splitting>\n\n---\n\n## Vector Stores\n\n\u003Cex-chroma-vectorstore>\n\u003Cpython>\nCreate a persistent Chroma vector store and reload it from disk.\n\n```python\nfrom langchain_chroma import Chroma\nfrom langchain_openai import OpenAIEmbeddings\n\nvectorstore = Chroma.from_documents(\n    documents=splits,\n    embedding=OpenAIEmbeddings(),\n    persist_directory=\".\u002Fchroma_db\",\n    collection_name=\"my-collection\",\n)\n\n# Load existing\nvectorstore = Chroma(\n    persist_directory=\".\u002Fchroma_db\",\n    embedding_function=OpenAIEmbeddings(),\n    collection_name=\"my-collection\",\n)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nCreate a Chroma vector store connected to a running Chroma server.\n\n```typescript\nimport { Chroma } from \"@langchain\u002Fcommunity\u002Fvectorstores\u002Fchroma\";\nimport { OpenAIEmbeddings } from \"@langchain\u002Fopenai\";\n\nconst vectorstore = await Chroma.fromDocuments(\n  splits,\n  new OpenAIEmbeddings(),\n  { collectionName: \"my-collection\", url: \"http:\u002F\u002Flocalhost:8000\" }\n);\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-chroma-vectorstore>\n\n\u003Cex-faiss-vectorstore>\n\u003Cpython>\nCreate a FAISS vector store, save it to disk, and reload it.\n\n```python\nfrom langchain_community.vectorstores import FAISS\n\nvectorstore = FAISS.from_documents(splits, embeddings)\nvectorstore.save_local(\".\u002Ffaiss_index\")\n\n# Only load FAISS indexes that you created and fully control.\n# The Python FAISS loader uses pickle-backed metadata, so never load\n# downloaded, shared, or otherwise untrusted index directories.\nloaded = FAISS.load_local(\n    \".\u002Ffaiss_index\",\n    embeddings,\n    allow_dangerous_deserialization=True,\n)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nCreate a FAISS vector store, save it to disk, and reload it.\n\n```typescript\nimport { FaissStore } from \"@langchain\u002Fcommunity\u002Fvectorstores\u002Ffaiss\";\n\nconst vectorstore = await FaissStore.fromDocuments(splits, embeddings);\nawait vectorstore.save(\".\u002Ffaiss_index\");\n\nconst loaded = await FaissStore.load(\".\u002Ffaiss_index\", embeddings);\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-faiss-vectorstore>\n\n---\n\n## Retrieval\n\n\u003Cex-similarity-search>\n\u003Cpython>\nPerform similarity search and retrieve results with relevance scores.\n\n```python\n# Basic search\nresults = vectorstore.similarity_search(query, k=5)\n\n# With scores\nresults_with_score = vectorstore.similarity_search_with_score(query, k=5)\nfor doc, score in results_with_score:\n    print(f\"Score: {score}, Content: {doc.page_content}\")\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nPerform similarity search and retrieve results with relevance scores.\n\n```typescript\n\u002F\u002F Basic search\nconst results = await vectorstore.similaritySearch(query, 5);\n\n\u002F\u002F With scores\nconst resultsWithScore = await vectorstore.similaritySearchWithScore(query, 5);\nfor (const [doc, score] of resultsWithScore) {\n  console.log(`Score: ${score}, Content: ${doc.pageContent}`);\n}\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-similarity-search>\n\n\u003Cex-mmr-search>\n\u003Cpython>\nUse MMR (Maximal Marginal Relevance) to balance relevance and diversity in search results.\n\n```python\n# MMR balances relevance and diversity\nretriever = vectorstore.as_retriever(\n    search_type=\"mmr\",\n    search_kwargs={\"fetch_k\": 20, \"lambda_mult\": 0.5, \"k\": 5},\n)\n```\n\u003C\u002Fpython>\n\u003C\u002Fex-mmr-search>\n\n\u003Cex-metadata-filtering>\n\u003Cpython>\nAdd metadata to documents and filter search results by metadata properties.\n\n```python\n# Add metadata when creating documents\ndocs = [\n    Document(\n        page_content=\"Python programming guide\",\n        metadata={\"language\": \"python\", \"topic\": \"programming\"}\n    ),\n]\n\n# Search with filter\nresults = vectorstore.similarity_search(\n    \"programming\",\n    k=5,\n    filter={\"language\": \"python\"}  # Only Python docs\n)\n```\n\u003C\u002Fpython>\n\u003C\u002Fex-metadata-filtering>\n\n\u003Cex-rag-with-agent>\n\u003Cpython>\nCreate an agent that uses RAG as a tool for answering questions.\n\n```python\nfrom langchain.agents import create_agent\nfrom langchain.tools import tool\n\n@tool\ndef search_docs(query: str) -> str:\n    \"\"\"Search documentation for relevant information.\"\"\"\n    docs = retriever.invoke(query)\n    return \"\\n\\n\".join([d.page_content for d in docs])\n\nagent = create_agent(\n    model=\"gpt-4.1\",\n    tools=[search_docs],\n)\n\nresult = agent.invoke({\n    \"messages\": [{\"role\": \"user\", \"content\": \"How do I create an agent?\"}]\n})\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nCreate an agent that uses RAG as a tool for answering questions.\n\n```typescript\nimport { createAgent } from \"langchain\";\nimport { tool } from \"@langchain\u002Fcore\u002Ftools\";\nimport { z } from \"zod\";\n\nconst searchDocs = tool(\n  async (input) => {\n    const docs = await retriever.invoke(input.query);\n    return docs.map(d => d.pageContent).join(\"\\n\\n\");\n  },\n  {\n    name: \"search_docs\",\n    description: \"Search documentation for relevant information.\",\n    schema: z.object({ query: z.string() }),\n  }\n);\n\nconst agent = createAgent({\n  model: \"gpt-4.1\",\n  tools: [searchDocs],\n});\n\nconst result = await agent.invoke({\n  messages: [{ role: \"user\", content: \"How do I create an agent?\" }],\n});\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-rag-with-agent>\n\n\u003Cboundaries>\n### What You CAN Configure\n\n- Chunk size\u002Foverlap\n- Embedding model\n- Number of results (k)\n- Metadata filters\n- Search algorithms: Similarity, MMR\n\n### What You CANNOT Configure\n\n- Embedding dimensions (per model)\n- Mix embeddings from different models in same store\n\u003C\u002Fboundaries>\n\n\u003Cfix-chunk-size>\n\u003Cpython>\nChunk size 500-1500 is typically good.\n\n```python\n# WRONG: Too small (loses context) or too large (hits limits)\nsplitter = RecursiveCharacterTextSplitter(chunk_size=50)\nsplitter = RecursiveCharacterTextSplitter(chunk_size=10000)\n\n# CORRECT\nsplitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nChunk size 500-1500 is typically good.\n\n```typescript\n\u002F\u002F WRONG: Too small or too large\nconst splitter = new RecursiveCharacterTextSplitter({ chunkSize: 50 });\n\n\u002F\u002F CORRECT\nconst splitter = new RecursiveCharacterTextSplitter({ chunkSize: 1000, chunkOverlap: 200 });\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-chunk-size>\n\n\u003Cfix-chunk-overlap>\n\u003Cpython>\nUse overlap (10-20% of chunk size) to maintain context at boundaries.\n\n```python\n# WRONG: No overlap - context breaks at boundaries\nsplitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=0)\n\n# CORRECT: 10-20% overlap\nsplitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)\n```\n\u003C\u002Fpython>\n\u003C\u002Ffix-chunk-overlap>\n\n\u003Cfix-persist-vectorstore>\n\u003Cpython>\nUse persistent vector store instead of in-memory to avoid data loss.\n\n```python\n# WRONG: InMemory - lost on restart\nvectorstore = InMemoryVectorStore.from_documents(docs, embeddings)\n\n# CORRECT\nvectorstore = Chroma.from_documents(docs, embeddings, persist_directory=\".\u002Fchroma_db\")\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nUse persistent vector store instead of in-memory to avoid data loss.\n\n```typescript\n\u002F\u002F WRONG: Memory - lost on restart\nconst vectorstore = await MemoryVectorStore.fromDocuments(docs, embeddings);\n\n\u002F\u002F CORRECT\nconst vectorstore = await Chroma.fromDocuments(docs, embeddings, { collectionName: \"my-collection\" });\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-persist-vectorstore>\n\n\u003Cfix-consistent-embeddings>\n\u003Cpython>\nUse the same embedding model for indexing and querying.\n\n```python\n# WRONG: Different embeddings for index and query - incompatible!\nvectorstore = Chroma.from_documents(docs, OpenAIEmbeddings(model=\"text-embedding-3-small\"))\nretriever = vectorstore.as_retriever(embeddings=OpenAIEmbeddings(model=\"text-embedding-3-large\"))\n\n# CORRECT: Same model\nembeddings = OpenAIEmbeddings(model=\"text-embedding-3-small\")\nvectorstore = Chroma.from_documents(docs, embeddings)\nretriever = vectorstore.as_retriever()  # Uses same embeddings\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nUse the same embedding model for indexing and querying.\n\n```typescript\nconst embeddings = new OpenAIEmbeddings({ model: \"text-embedding-3-small\" });\nconst vectorstore = await Chroma.fromDocuments(docs, embeddings);\nconst retriever = vectorstore.asRetriever();  \u002F\u002F Uses same embeddings\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-consistent-embeddings>\n\n\u003Cfix-faiss-deserialization>\n\u003Cpython>\nOnly opt in to FAISS deserialization for trusted local indexes. Python FAISS indexes include pickle-backed metadata, and untrusted pickle files can execute arbitrary code during loading.\n\n```python\n# WRONG: Loading a downloaded, shared, cloud-hosted, or third-party-controlled\n# FAISS index with dangerous deserialization enabled.\nloaded_store = FAISS.load_local(\n    \".\u002Funtrusted_faiss_index\",\n    embeddings,\n    allow_dangerous_deserialization=True,\n)\n\n# CORRECT: Only opt in when the index directory was created by you and has\n# remained under your control.\nloaded_store = FAISS.load_local(\n    \".\u002Ffaiss_index\",\n    embeddings,\n    allow_dangerous_deserialization=True,\n)\n```\n\nIf you cannot guarantee the provenance of a persisted index, do not load it with `allow_dangerous_deserialization=True`. Rebuild the index from trusted source documents or use a vector store\u002Fbackend that does not require pickle deserialization for untrusted files.\n\u003C\u002Fpython>\n\u003C\u002Ffix-faiss-deserialization>\n\n\u003Cfix-dimension-mismatch>\n\u003Cpython>\nEnsure embedding dimensions match the vector store index dimensions.\n\n```python\n# WRONG: Index has 1536 dimensions but using 512-dim embeddings\npc.create_index(name=\"idx\", dimension=1536, metric=\"cosine\")\nvectorstore = PineconeVectorStore.from_documents(\n    docs, OpenAIEmbeddings(model=\"text-embedding-3-small\", dimensions=512), index=pc.Index(\"idx\")\n)  # Error: dimension mismatch!\n\n# CORRECT: Match dimensions\nembeddings = OpenAIEmbeddings()  # Default 1536\n```\n\u003C\u002Fpython>\n\u003C\u002Ffix-dimension-mismatch>\n",{"data":35,"body":36},{"name":4,"description":6},{"type":37,"children":38},"root",[39,5570],{"type":40,"tag":41,"props":42,"children":43},"element","overview",{},[44,47,57,92,100,144,264,268,275,1759,1762,1767,2043,2236,2322,2325,2331,2414,2417,2422,2797,3133,3136,3142,3493,3548,3672,4559],{"type":45,"value":46},"text","\nRetrieval Augmented Generation (RAG) enhances LLM responses by fetching relevant context from external knowledge sources.\n",{"type":40,"tag":48,"props":49,"children":50},"p",{},[51],{"type":40,"tag":52,"props":53,"children":54},"strong",{},[55],{"type":45,"value":56},"Pipeline:",{"type":40,"tag":58,"props":59,"children":60},"ol",{},[61,72,82],{"type":40,"tag":62,"props":63,"children":64},"li",{},[65,70],{"type":40,"tag":52,"props":66,"children":67},{},[68],{"type":45,"value":69},"Index",{"type":45,"value":71},": Load → Split → Embed → Store",{"type":40,"tag":62,"props":73,"children":74},{},[75,80],{"type":40,"tag":52,"props":76,"children":77},{},[78],{"type":45,"value":79},"Retrieve",{"type":45,"value":81},": Query → Embed → Search → Return docs",{"type":40,"tag":62,"props":83,"children":84},{},[85,90],{"type":40,"tag":52,"props":86,"children":87},{},[88],{"type":45,"value":89},"Generate",{"type":45,"value":91},": Docs + Query → LLM → Response",{"type":40,"tag":48,"props":93,"children":94},{},[95],{"type":40,"tag":52,"props":96,"children":97},{},[98],{"type":45,"value":99},"Key Components:",{"type":40,"tag":101,"props":102,"children":103},"ul",{},[104,114,124,134],{"type":40,"tag":62,"props":105,"children":106},{},[107,112],{"type":40,"tag":52,"props":108,"children":109},{},[110],{"type":45,"value":111},"Document Loaders",{"type":45,"value":113},": Ingest data from files, web, databases",{"type":40,"tag":62,"props":115,"children":116},{},[117,122],{"type":40,"tag":52,"props":118,"children":119},{},[120],{"type":45,"value":121},"Text Splitters",{"type":45,"value":123},": Break documents into chunks",{"type":40,"tag":62,"props":125,"children":126},{},[127,132],{"type":40,"tag":52,"props":128,"children":129},{},[130],{"type":45,"value":131},"Embeddings",{"type":45,"value":133},": Convert text to vectors",{"type":40,"tag":62,"props":135,"children":136},{},[137,142],{"type":40,"tag":52,"props":138,"children":139},{},[140],{"type":45,"value":141},"Vector Stores",{"type":45,"value":143},": Store and search embeddings\n\n",{"type":40,"tag":145,"props":146,"children":147},"vectorstore-selection",{},[148],{"type":40,"tag":149,"props":150,"children":151},"table",{},[152,176],{"type":40,"tag":153,"props":154,"children":155},"thead",{},[156],{"type":40,"tag":157,"props":158,"children":159},"tr",{},[160,166,171],{"type":40,"tag":161,"props":162,"children":163},"th",{},[164],{"type":45,"value":165},"Vector Store",{"type":40,"tag":161,"props":167,"children":168},{},[169],{"type":45,"value":170},"Use Case",{"type":40,"tag":161,"props":172,"children":173},{},[174],{"type":45,"value":175},"Persistence",{"type":40,"tag":177,"props":178,"children":179},"tbody",{},[180,202,223,243],{"type":40,"tag":157,"props":181,"children":182},{},[183,192,197],{"type":40,"tag":184,"props":185,"children":186},"td",{},[187],{"type":40,"tag":52,"props":188,"children":189},{},[190],{"type":45,"value":191},"InMemory",{"type":40,"tag":184,"props":193,"children":194},{},[195],{"type":45,"value":196},"Testing",{"type":40,"tag":184,"props":198,"children":199},{},[200],{"type":45,"value":201},"Memory only",{"type":40,"tag":157,"props":203,"children":204},{},[205,213,218],{"type":40,"tag":184,"props":206,"children":207},{},[208],{"type":40,"tag":52,"props":209,"children":210},{},[211],{"type":45,"value":212},"FAISS",{"type":40,"tag":184,"props":214,"children":215},{},[216],{"type":45,"value":217},"Local, high performance",{"type":40,"tag":184,"props":219,"children":220},{},[221],{"type":45,"value":222},"Disk",{"type":40,"tag":157,"props":224,"children":225},{},[226,234,239],{"type":40,"tag":184,"props":227,"children":228},{},[229],{"type":40,"tag":52,"props":230,"children":231},{},[232],{"type":45,"value":233},"Chroma",{"type":40,"tag":184,"props":235,"children":236},{},[237],{"type":45,"value":238},"Development",{"type":40,"tag":184,"props":240,"children":241},{},[242],{"type":45,"value":222},{"type":40,"tag":157,"props":244,"children":245},{},[246,254,259],{"type":40,"tag":184,"props":247,"children":248},{},[249],{"type":40,"tag":52,"props":250,"children":251},{},[252],{"type":45,"value":253},"Pinecone",{"type":40,"tag":184,"props":255,"children":256},{},[257],{"type":45,"value":258},"Production, managed",{"type":40,"tag":184,"props":260,"children":261},{},[262],{"type":45,"value":263},"Cloud",{"type":40,"tag":265,"props":266,"children":267},"hr",{},[],{"type":40,"tag":269,"props":270,"children":272},"h2",{"id":271},"complete-rag-pipeline",[273],{"type":45,"value":274},"Complete RAG Pipeline",{"type":40,"tag":276,"props":277,"children":278},"ex-basic-rag-setup",{},[279,582],{"type":40,"tag":280,"props":281,"children":282},"python",{},[283,285],{"type":45,"value":284},"\nEnd-to-end RAG pipeline: load documents, split into chunks, embed, store, retrieve, and generate a response.\n",{"type":40,"tag":286,"props":287,"children":291},"pre",{"className":288,"code":289,"language":280,"meta":290,"style":290},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","from langchain_openai import ChatOpenAI, OpenAIEmbeddings\nfrom langchain_community.vectorstores import InMemoryVectorStore\nfrom langchain_text_splitters import RecursiveCharacterTextSplitter\nfrom langchain_core.documents import Document\n\n# 1. Load documents\ndocs = [\n    Document(page_content=\"LangChain is a framework for LLM apps.\", metadata={}),\n    Document(page_content=\"RAG = Retrieval Augmented Generation.\", metadata={}),\n]\n\n# 2. Split documents\nsplitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)\nsplits = splitter.split_documents(docs)\n\n# 3. Create embeddings and store\nembeddings = OpenAIEmbeddings(model=\"text-embedding-3-small\")\nvectorstore = InMemoryVectorStore.from_documents(splits, embeddings)\n\n# 4. Create retriever\nretriever = vectorstore.as_retriever(search_kwargs={\"k\": 4})\n\n# 5. Use in RAG\nmodel = ChatOpenAI(model=\"gpt-4.1\")\nquery = \"What is RAG?\"\nrelevant_docs = retriever.invoke(query)\n\ncontext = \"\\n\\n\".join([doc.page_content for doc in relevant_docs])\nresponse = model.invoke([\n    {\"role\": \"system\", \"content\": f\"Use this context:\\n\\n{context}\"},\n    {\"role\": \"user\", \"content\": query},\n])\n","",[292],{"type":40,"tag":293,"props":294,"children":295},"code",{"__ignoreMap":290},[296,307,316,325,334,344,353,362,371,380,389,397,406,415,424,432,441,450,459,467,476,485,493,502,511,520,529,537,546,555,564,573],{"type":40,"tag":297,"props":298,"children":301},"span",{"class":299,"line":300},"line",1,[302],{"type":40,"tag":297,"props":303,"children":304},{},[305],{"type":45,"value":306},"from langchain_openai import ChatOpenAI, OpenAIEmbeddings\n",{"type":40,"tag":297,"props":308,"children":310},{"class":299,"line":309},2,[311],{"type":40,"tag":297,"props":312,"children":313},{},[314],{"type":45,"value":315},"from langchain_community.vectorstores import InMemoryVectorStore\n",{"type":40,"tag":297,"props":317,"children":319},{"class":299,"line":318},3,[320],{"type":40,"tag":297,"props":321,"children":322},{},[323],{"type":45,"value":324},"from langchain_text_splitters import RecursiveCharacterTextSplitter\n",{"type":40,"tag":297,"props":326,"children":328},{"class":299,"line":327},4,[329],{"type":40,"tag":297,"props":330,"children":331},{},[332],{"type":45,"value":333},"from langchain_core.documents import Document\n",{"type":40,"tag":297,"props":335,"children":337},{"class":299,"line":336},5,[338],{"type":40,"tag":297,"props":339,"children":341},{"emptyLinePlaceholder":340},true,[342],{"type":45,"value":343},"\n",{"type":40,"tag":297,"props":345,"children":347},{"class":299,"line":346},6,[348],{"type":40,"tag":297,"props":349,"children":350},{},[351],{"type":45,"value":352},"# 1. Load documents\n",{"type":40,"tag":297,"props":354,"children":356},{"class":299,"line":355},7,[357],{"type":40,"tag":297,"props":358,"children":359},{},[360],{"type":45,"value":361},"docs = [\n",{"type":40,"tag":297,"props":363,"children":365},{"class":299,"line":364},8,[366],{"type":40,"tag":297,"props":367,"children":368},{},[369],{"type":45,"value":370},"    Document(page_content=\"LangChain is a framework for LLM apps.\", metadata={}),\n",{"type":40,"tag":297,"props":372,"children":374},{"class":299,"line":373},9,[375],{"type":40,"tag":297,"props":376,"children":377},{},[378],{"type":45,"value":379},"    Document(page_content=\"RAG = Retrieval Augmented Generation.\", metadata={}),\n",{"type":40,"tag":297,"props":381,"children":383},{"class":299,"line":382},10,[384],{"type":40,"tag":297,"props":385,"children":386},{},[387],{"type":45,"value":388},"]\n",{"type":40,"tag":297,"props":390,"children":392},{"class":299,"line":391},11,[393],{"type":40,"tag":297,"props":394,"children":395},{"emptyLinePlaceholder":340},[396],{"type":45,"value":343},{"type":40,"tag":297,"props":398,"children":400},{"class":299,"line":399},12,[401],{"type":40,"tag":297,"props":402,"children":403},{},[404],{"type":45,"value":405},"# 2. Split documents\n",{"type":40,"tag":297,"props":407,"children":409},{"class":299,"line":408},13,[410],{"type":40,"tag":297,"props":411,"children":412},{},[413],{"type":45,"value":414},"splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)\n",{"type":40,"tag":297,"props":416,"children":418},{"class":299,"line":417},14,[419],{"type":40,"tag":297,"props":420,"children":421},{},[422],{"type":45,"value":423},"splits = splitter.split_documents(docs)\n",{"type":40,"tag":297,"props":425,"children":427},{"class":299,"line":426},15,[428],{"type":40,"tag":297,"props":429,"children":430},{"emptyLinePlaceholder":340},[431],{"type":45,"value":343},{"type":40,"tag":297,"props":433,"children":435},{"class":299,"line":434},16,[436],{"type":40,"tag":297,"props":437,"children":438},{},[439],{"type":45,"value":440},"# 3. Create embeddings and store\n",{"type":40,"tag":297,"props":442,"children":444},{"class":299,"line":443},17,[445],{"type":40,"tag":297,"props":446,"children":447},{},[448],{"type":45,"value":449},"embeddings = OpenAIEmbeddings(model=\"text-embedding-3-small\")\n",{"type":40,"tag":297,"props":451,"children":453},{"class":299,"line":452},18,[454],{"type":40,"tag":297,"props":455,"children":456},{},[457],{"type":45,"value":458},"vectorstore = InMemoryVectorStore.from_documents(splits, embeddings)\n",{"type":40,"tag":297,"props":460,"children":462},{"class":299,"line":461},19,[463],{"type":40,"tag":297,"props":464,"children":465},{"emptyLinePlaceholder":340},[466],{"type":45,"value":343},{"type":40,"tag":297,"props":468,"children":470},{"class":299,"line":469},20,[471],{"type":40,"tag":297,"props":472,"children":473},{},[474],{"type":45,"value":475},"# 4. Create retriever\n",{"type":40,"tag":297,"props":477,"children":479},{"class":299,"line":478},21,[480],{"type":40,"tag":297,"props":481,"children":482},{},[483],{"type":45,"value":484},"retriever = vectorstore.as_retriever(search_kwargs={\"k\": 4})\n",{"type":40,"tag":297,"props":486,"children":488},{"class":299,"line":487},22,[489],{"type":40,"tag":297,"props":490,"children":491},{"emptyLinePlaceholder":340},[492],{"type":45,"value":343},{"type":40,"tag":297,"props":494,"children":496},{"class":299,"line":495},23,[497],{"type":40,"tag":297,"props":498,"children":499},{},[500],{"type":45,"value":501},"# 5. Use in RAG\n",{"type":40,"tag":297,"props":503,"children":505},{"class":299,"line":504},24,[506],{"type":40,"tag":297,"props":507,"children":508},{},[509],{"type":45,"value":510},"model = ChatOpenAI(model=\"gpt-4.1\")\n",{"type":40,"tag":297,"props":512,"children":514},{"class":299,"line":513},25,[515],{"type":40,"tag":297,"props":516,"children":517},{},[518],{"type":45,"value":519},"query = \"What is RAG?\"\n",{"type":40,"tag":297,"props":521,"children":523},{"class":299,"line":522},26,[524],{"type":40,"tag":297,"props":525,"children":526},{},[527],{"type":45,"value":528},"relevant_docs = retriever.invoke(query)\n",{"type":40,"tag":297,"props":530,"children":532},{"class":299,"line":531},27,[533],{"type":40,"tag":297,"props":534,"children":535},{"emptyLinePlaceholder":340},[536],{"type":45,"value":343},{"type":40,"tag":297,"props":538,"children":540},{"class":299,"line":539},28,[541],{"type":40,"tag":297,"props":542,"children":543},{},[544],{"type":45,"value":545},"context = \"\\n\\n\".join([doc.page_content for doc in relevant_docs])\n",{"type":40,"tag":297,"props":547,"children":549},{"class":299,"line":548},29,[550],{"type":40,"tag":297,"props":551,"children":552},{},[553],{"type":45,"value":554},"response = model.invoke([\n",{"type":40,"tag":297,"props":556,"children":558},{"class":299,"line":557},30,[559],{"type":40,"tag":297,"props":560,"children":561},{},[562],{"type":45,"value":563},"    {\"role\": \"system\", \"content\": f\"Use this context:\\n\\n{context}\"},\n",{"type":40,"tag":297,"props":565,"children":567},{"class":299,"line":566},31,[568],{"type":40,"tag":297,"props":569,"children":570},{},[571],{"type":45,"value":572},"    {\"role\": \"user\", \"content\": query},\n",{"type":40,"tag":297,"props":574,"children":576},{"class":299,"line":575},32,[577],{"type":40,"tag":297,"props":578,"children":579},{},[580],{"type":45,"value":581},"])\n",{"type":40,"tag":583,"props":584,"children":585},"typescript",{},[586,587],{"type":45,"value":284},{"type":40,"tag":286,"props":588,"children":591},{"className":589,"code":590,"language":583,"meta":290,"style":290},"language-typescript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { ChatOpenAI, OpenAIEmbeddings } from \"@langchain\u002Fopenai\";\nimport { MemoryVectorStore } from \"@langchain\u002Fclassic\u002Fvectorstores\u002Fmemory\";\nimport { RecursiveCharacterTextSplitter } from \"@langchain\u002Ftextsplitters\";\nimport { Document } from \"@langchain\u002Fcore\u002Fdocuments\";\n\n\u002F\u002F 1. Load documents\nconst docs = [\n  new Document({ pageContent: \"LangChain is a framework for LLM apps.\", metadata: {} }),\n  new Document({ pageContent: \"RAG = Retrieval Augmented Generation.\", metadata: {} }),\n];\n\n\u002F\u002F 2. Split documents\nconst splitter = new RecursiveCharacterTextSplitter({ chunkSize: 500, chunkOverlap: 50 });\nconst splits = await splitter.splitDocuments(docs);\n\n\u002F\u002F 3. Create embeddings and store\nconst embeddings = new OpenAIEmbeddings({ model: \"text-embedding-3-small\" });\nconst vectorstore = await MemoryVectorStore.fromDocuments(splits, embeddings);\n\n\u002F\u002F 4. Create retriever\nconst retriever = vectorstore.asRetriever({ k: 4 });\n\n\u002F\u002F 5. Use in RAG\nconst model = new ChatOpenAI({ model: \"gpt-4.1\" });\nconst query = \"What is RAG?\";\nconst relevantDocs = await retriever.invoke(query);\n\nconst context = relevantDocs.map(doc => doc.pageContent).join(\"\\n\\n\");\nconst response = await model.invoke([\n  { role: \"system\", content: `Use this context:\\n\\n${context}` },\n  { role: \"user\", content: query },\n]);\n",[592],{"type":40,"tag":293,"props":593,"children":594},{"__ignoreMap":290},[595,657,698,739,780,787,796,820,899,967,979,986,994,1072,1117,1124,1132,1198,1249,1256,1264,1328,1335,1343,1408,1441,1484,1491,1584,1621,1698,1747],{"type":40,"tag":297,"props":596,"children":597},{"class":299,"line":300},[598,604,610,616,621,626,631,636,641,647,652],{"type":40,"tag":297,"props":599,"children":601},{"style":600},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[602],{"type":45,"value":603},"import",{"type":40,"tag":297,"props":605,"children":607},{"style":606},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[608],{"type":45,"value":609}," {",{"type":40,"tag":297,"props":611,"children":613},{"style":612},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[614],{"type":45,"value":615}," ChatOpenAI",{"type":40,"tag":297,"props":617,"children":618},{"style":606},[619],{"type":45,"value":620},",",{"type":40,"tag":297,"props":622,"children":623},{"style":612},[624],{"type":45,"value":625}," OpenAIEmbeddings",{"type":40,"tag":297,"props":627,"children":628},{"style":606},[629],{"type":45,"value":630}," }",{"type":40,"tag":297,"props":632,"children":633},{"style":600},[634],{"type":45,"value":635}," from",{"type":40,"tag":297,"props":637,"children":638},{"style":606},[639],{"type":45,"value":640}," \"",{"type":40,"tag":297,"props":642,"children":644},{"style":643},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[645],{"type":45,"value":646},"@langchain\u002Fopenai",{"type":40,"tag":297,"props":648,"children":649},{"style":606},[650],{"type":45,"value":651},"\"",{"type":40,"tag":297,"props":653,"children":654},{"style":606},[655],{"type":45,"value":656},";\n",{"type":40,"tag":297,"props":658,"children":659},{"class":299,"line":309},[660,664,668,673,677,681,685,690,694],{"type":40,"tag":297,"props":661,"children":662},{"style":600},[663],{"type":45,"value":603},{"type":40,"tag":297,"props":665,"children":666},{"style":606},[667],{"type":45,"value":609},{"type":40,"tag":297,"props":669,"children":670},{"style":612},[671],{"type":45,"value":672}," MemoryVectorStore",{"type":40,"tag":297,"props":674,"children":675},{"style":606},[676],{"type":45,"value":630},{"type":40,"tag":297,"props":678,"children":679},{"style":600},[680],{"type":45,"value":635},{"type":40,"tag":297,"props":682,"children":683},{"style":606},[684],{"type":45,"value":640},{"type":40,"tag":297,"props":686,"children":687},{"style":643},[688],{"type":45,"value":689},"@langchain\u002Fclassic\u002Fvectorstores\u002Fmemory",{"type":40,"tag":297,"props":691,"children":692},{"style":606},[693],{"type":45,"value":651},{"type":40,"tag":297,"props":695,"children":696},{"style":606},[697],{"type":45,"value":656},{"type":40,"tag":297,"props":699,"children":700},{"class":299,"line":318},[701,705,709,714,718,722,726,731,735],{"type":40,"tag":297,"props":702,"children":703},{"style":600},[704],{"type":45,"value":603},{"type":40,"tag":297,"props":706,"children":707},{"style":606},[708],{"type":45,"value":609},{"type":40,"tag":297,"props":710,"children":711},{"style":612},[712],{"type":45,"value":713}," RecursiveCharacterTextSplitter",{"type":40,"tag":297,"props":715,"children":716},{"style":606},[717],{"type":45,"value":630},{"type":40,"tag":297,"props":719,"children":720},{"style":600},[721],{"type":45,"value":635},{"type":40,"tag":297,"props":723,"children":724},{"style":606},[725],{"type":45,"value":640},{"type":40,"tag":297,"props":727,"children":728},{"style":643},[729],{"type":45,"value":730},"@langchain\u002Ftextsplitters",{"type":40,"tag":297,"props":732,"children":733},{"style":606},[734],{"type":45,"value":651},{"type":40,"tag":297,"props":736,"children":737},{"style":606},[738],{"type":45,"value":656},{"type":40,"tag":297,"props":740,"children":741},{"class":299,"line":327},[742,746,750,755,759,763,767,772,776],{"type":40,"tag":297,"props":743,"children":744},{"style":600},[745],{"type":45,"value":603},{"type":40,"tag":297,"props":747,"children":748},{"style":606},[749],{"type":45,"value":609},{"type":40,"tag":297,"props":751,"children":752},{"style":612},[753],{"type":45,"value":754}," Document",{"type":40,"tag":297,"props":756,"children":757},{"style":606},[758],{"type":45,"value":630},{"type":40,"tag":297,"props":760,"children":761},{"style":600},[762],{"type":45,"value":635},{"type":40,"tag":297,"props":764,"children":765},{"style":606},[766],{"type":45,"value":640},{"type":40,"tag":297,"props":768,"children":769},{"style":643},[770],{"type":45,"value":771},"@langchain\u002Fcore\u002Fdocuments",{"type":40,"tag":297,"props":773,"children":774},{"style":606},[775],{"type":45,"value":651},{"type":40,"tag":297,"props":777,"children":778},{"style":606},[779],{"type":45,"value":656},{"type":40,"tag":297,"props":781,"children":782},{"class":299,"line":336},[783],{"type":40,"tag":297,"props":784,"children":785},{"emptyLinePlaceholder":340},[786],{"type":45,"value":343},{"type":40,"tag":297,"props":788,"children":789},{"class":299,"line":346},[790],{"type":40,"tag":297,"props":791,"children":793},{"style":792},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic",[794],{"type":45,"value":795},"\u002F\u002F 1. Load documents\n",{"type":40,"tag":297,"props":797,"children":798},{"class":299,"line":355},[799,805,810,815],{"type":40,"tag":297,"props":800,"children":802},{"style":801},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[803],{"type":45,"value":804},"const",{"type":40,"tag":297,"props":806,"children":807},{"style":612},[808],{"type":45,"value":809}," docs ",{"type":40,"tag":297,"props":811,"children":812},{"style":606},[813],{"type":45,"value":814},"=",{"type":40,"tag":297,"props":816,"children":817},{"style":612},[818],{"type":45,"value":819}," [\n",{"type":40,"tag":297,"props":821,"children":822},{"class":299,"line":364},[823,828,833,838,843,849,854,858,863,867,871,876,880,885,889,894],{"type":40,"tag":297,"props":824,"children":825},{"style":606},[826],{"type":45,"value":827},"  new",{"type":40,"tag":297,"props":829,"children":831},{"style":830},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[832],{"type":45,"value":754},{"type":40,"tag":297,"props":834,"children":835},{"style":612},[836],{"type":45,"value":837},"(",{"type":40,"tag":297,"props":839,"children":840},{"style":606},[841],{"type":45,"value":842},"{",{"type":40,"tag":297,"props":844,"children":846},{"style":845},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[847],{"type":45,"value":848}," pageContent",{"type":40,"tag":297,"props":850,"children":851},{"style":606},[852],{"type":45,"value":853},":",{"type":40,"tag":297,"props":855,"children":856},{"style":606},[857],{"type":45,"value":640},{"type":40,"tag":297,"props":859,"children":860},{"style":643},[861],{"type":45,"value":862},"LangChain is a framework for LLM apps.",{"type":40,"tag":297,"props":864,"children":865},{"style":606},[866],{"type":45,"value":651},{"type":40,"tag":297,"props":868,"children":869},{"style":606},[870],{"type":45,"value":620},{"type":40,"tag":297,"props":872,"children":873},{"style":845},[874],{"type":45,"value":875}," metadata",{"type":40,"tag":297,"props":877,"children":878},{"style":606},[879],{"type":45,"value":853},{"type":40,"tag":297,"props":881,"children":882},{"style":606},[883],{"type":45,"value":884}," {}",{"type":40,"tag":297,"props":886,"children":887},{"style":606},[888],{"type":45,"value":630},{"type":40,"tag":297,"props":890,"children":891},{"style":612},[892],{"type":45,"value":893},")",{"type":40,"tag":297,"props":895,"children":896},{"style":606},[897],{"type":45,"value":898},",\n",{"type":40,"tag":297,"props":900,"children":901},{"class":299,"line":373},[902,906,910,914,918,922,926,930,935,939,943,947,951,955,959,963],{"type":40,"tag":297,"props":903,"children":904},{"style":606},[905],{"type":45,"value":827},{"type":40,"tag":297,"props":907,"children":908},{"style":830},[909],{"type":45,"value":754},{"type":40,"tag":297,"props":911,"children":912},{"style":612},[913],{"type":45,"value":837},{"type":40,"tag":297,"props":915,"children":916},{"style":606},[917],{"type":45,"value":842},{"type":40,"tag":297,"props":919,"children":920},{"style":845},[921],{"type":45,"value":848},{"type":40,"tag":297,"props":923,"children":924},{"style":606},[925],{"type":45,"value":853},{"type":40,"tag":297,"props":927,"children":928},{"style":606},[929],{"type":45,"value":640},{"type":40,"tag":297,"props":931,"children":932},{"style":643},[933],{"type":45,"value":934},"RAG = Retrieval Augmented Generation.",{"type":40,"tag":297,"props":936,"children":937},{"style":606},[938],{"type":45,"value":651},{"type":40,"tag":297,"props":940,"children":941},{"style":606},[942],{"type":45,"value":620},{"type":40,"tag":297,"props":944,"children":945},{"style":845},[946],{"type":45,"value":875},{"type":40,"tag":297,"props":948,"children":949},{"style":606},[950],{"type":45,"value":853},{"type":40,"tag":297,"props":952,"children":953},{"style":606},[954],{"type":45,"value":884},{"type":40,"tag":297,"props":956,"children":957},{"style":606},[958],{"type":45,"value":630},{"type":40,"tag":297,"props":960,"children":961},{"style":612},[962],{"type":45,"value":893},{"type":40,"tag":297,"props":964,"children":965},{"style":606},[966],{"type":45,"value":898},{"type":40,"tag":297,"props":968,"children":969},{"class":299,"line":382},[970,975],{"type":40,"tag":297,"props":971,"children":972},{"style":612},[973],{"type":45,"value":974},"]",{"type":40,"tag":297,"props":976,"children":977},{"style":606},[978],{"type":45,"value":656},{"type":40,"tag":297,"props":980,"children":981},{"class":299,"line":391},[982],{"type":40,"tag":297,"props":983,"children":984},{"emptyLinePlaceholder":340},[985],{"type":45,"value":343},{"type":40,"tag":297,"props":987,"children":988},{"class":299,"line":399},[989],{"type":40,"tag":297,"props":990,"children":991},{"style":792},[992],{"type":45,"value":993},"\u002F\u002F 2. Split documents\n",{"type":40,"tag":297,"props":995,"children":996},{"class":299,"line":408},[997,1001,1006,1010,1015,1019,1023,1027,1032,1036,1042,1046,1051,1055,1060,1064,1068],{"type":40,"tag":297,"props":998,"children":999},{"style":801},[1000],{"type":45,"value":804},{"type":40,"tag":297,"props":1002,"children":1003},{"style":612},[1004],{"type":45,"value":1005}," splitter ",{"type":40,"tag":297,"props":1007,"children":1008},{"style":606},[1009],{"type":45,"value":814},{"type":40,"tag":297,"props":1011,"children":1012},{"style":606},[1013],{"type":45,"value":1014}," new",{"type":40,"tag":297,"props":1016,"children":1017},{"style":830},[1018],{"type":45,"value":713},{"type":40,"tag":297,"props":1020,"children":1021},{"style":612},[1022],{"type":45,"value":837},{"type":40,"tag":297,"props":1024,"children":1025},{"style":606},[1026],{"type":45,"value":842},{"type":40,"tag":297,"props":1028,"children":1029},{"style":845},[1030],{"type":45,"value":1031}," chunkSize",{"type":40,"tag":297,"props":1033,"children":1034},{"style":606},[1035],{"type":45,"value":853},{"type":40,"tag":297,"props":1037,"children":1039},{"style":1038},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[1040],{"type":45,"value":1041}," 500",{"type":40,"tag":297,"props":1043,"children":1044},{"style":606},[1045],{"type":45,"value":620},{"type":40,"tag":297,"props":1047,"children":1048},{"style":845},[1049],{"type":45,"value":1050}," chunkOverlap",{"type":40,"tag":297,"props":1052,"children":1053},{"style":606},[1054],{"type":45,"value":853},{"type":40,"tag":297,"props":1056,"children":1057},{"style":1038},[1058],{"type":45,"value":1059}," 50",{"type":40,"tag":297,"props":1061,"children":1062},{"style":606},[1063],{"type":45,"value":630},{"type":40,"tag":297,"props":1065,"children":1066},{"style":612},[1067],{"type":45,"value":893},{"type":40,"tag":297,"props":1069,"children":1070},{"style":606},[1071],{"type":45,"value":656},{"type":40,"tag":297,"props":1073,"children":1074},{"class":299,"line":417},[1075,1079,1084,1088,1093,1098,1103,1108,1113],{"type":40,"tag":297,"props":1076,"children":1077},{"style":801},[1078],{"type":45,"value":804},{"type":40,"tag":297,"props":1080,"children":1081},{"style":612},[1082],{"type":45,"value":1083}," splits ",{"type":40,"tag":297,"props":1085,"children":1086},{"style":606},[1087],{"type":45,"value":814},{"type":40,"tag":297,"props":1089,"children":1090},{"style":600},[1091],{"type":45,"value":1092}," await",{"type":40,"tag":297,"props":1094,"children":1095},{"style":612},[1096],{"type":45,"value":1097}," splitter",{"type":40,"tag":297,"props":1099,"children":1100},{"style":606},[1101],{"type":45,"value":1102},".",{"type":40,"tag":297,"props":1104,"children":1105},{"style":830},[1106],{"type":45,"value":1107},"splitDocuments",{"type":40,"tag":297,"props":1109,"children":1110},{"style":612},[1111],{"type":45,"value":1112},"(docs)",{"type":40,"tag":297,"props":1114,"children":1115},{"style":606},[1116],{"type":45,"value":656},{"type":40,"tag":297,"props":1118,"children":1119},{"class":299,"line":426},[1120],{"type":40,"tag":297,"props":1121,"children":1122},{"emptyLinePlaceholder":340},[1123],{"type":45,"value":343},{"type":40,"tag":297,"props":1125,"children":1126},{"class":299,"line":434},[1127],{"type":40,"tag":297,"props":1128,"children":1129},{"style":792},[1130],{"type":45,"value":1131},"\u002F\u002F 3. Create embeddings and store\n",{"type":40,"tag":297,"props":1133,"children":1134},{"class":299,"line":443},[1135,1139,1144,1148,1152,1156,1160,1164,1169,1173,1177,1182,1186,1190,1194],{"type":40,"tag":297,"props":1136,"children":1137},{"style":801},[1138],{"type":45,"value":804},{"type":40,"tag":297,"props":1140,"children":1141},{"style":612},[1142],{"type":45,"value":1143}," embeddings ",{"type":40,"tag":297,"props":1145,"children":1146},{"style":606},[1147],{"type":45,"value":814},{"type":40,"tag":297,"props":1149,"children":1150},{"style":606},[1151],{"type":45,"value":1014},{"type":40,"tag":297,"props":1153,"children":1154},{"style":830},[1155],{"type":45,"value":625},{"type":40,"tag":297,"props":1157,"children":1158},{"style":612},[1159],{"type":45,"value":837},{"type":40,"tag":297,"props":1161,"children":1162},{"style":606},[1163],{"type":45,"value":842},{"type":40,"tag":297,"props":1165,"children":1166},{"style":845},[1167],{"type":45,"value":1168}," model",{"type":40,"tag":297,"props":1170,"children":1171},{"style":606},[1172],{"type":45,"value":853},{"type":40,"tag":297,"props":1174,"children":1175},{"style":606},[1176],{"type":45,"value":640},{"type":40,"tag":297,"props":1178,"children":1179},{"style":643},[1180],{"type":45,"value":1181},"text-embedding-3-small",{"type":40,"tag":297,"props":1183,"children":1184},{"style":606},[1185],{"type":45,"value":651},{"type":40,"tag":297,"props":1187,"children":1188},{"style":606},[1189],{"type":45,"value":630},{"type":40,"tag":297,"props":1191,"children":1192},{"style":612},[1193],{"type":45,"value":893},{"type":40,"tag":297,"props":1195,"children":1196},{"style":606},[1197],{"type":45,"value":656},{"type":40,"tag":297,"props":1199,"children":1200},{"class":299,"line":452},[1201,1205,1210,1214,1218,1222,1226,1231,1236,1240,1245],{"type":40,"tag":297,"props":1202,"children":1203},{"style":801},[1204],{"type":45,"value":804},{"type":40,"tag":297,"props":1206,"children":1207},{"style":612},[1208],{"type":45,"value":1209}," vectorstore ",{"type":40,"tag":297,"props":1211,"children":1212},{"style":606},[1213],{"type":45,"value":814},{"type":40,"tag":297,"props":1215,"children":1216},{"style":600},[1217],{"type":45,"value":1092},{"type":40,"tag":297,"props":1219,"children":1220},{"style":612},[1221],{"type":45,"value":672},{"type":40,"tag":297,"props":1223,"children":1224},{"style":606},[1225],{"type":45,"value":1102},{"type":40,"tag":297,"props":1227,"children":1228},{"style":830},[1229],{"type":45,"value":1230},"fromDocuments",{"type":40,"tag":297,"props":1232,"children":1233},{"style":612},[1234],{"type":45,"value":1235},"(splits",{"type":40,"tag":297,"props":1237,"children":1238},{"style":606},[1239],{"type":45,"value":620},{"type":40,"tag":297,"props":1241,"children":1242},{"style":612},[1243],{"type":45,"value":1244}," embeddings)",{"type":40,"tag":297,"props":1246,"children":1247},{"style":606},[1248],{"type":45,"value":656},{"type":40,"tag":297,"props":1250,"children":1251},{"class":299,"line":461},[1252],{"type":40,"tag":297,"props":1253,"children":1254},{"emptyLinePlaceholder":340},[1255],{"type":45,"value":343},{"type":40,"tag":297,"props":1257,"children":1258},{"class":299,"line":469},[1259],{"type":40,"tag":297,"props":1260,"children":1261},{"style":792},[1262],{"type":45,"value":1263},"\u002F\u002F 4. Create retriever\n",{"type":40,"tag":297,"props":1265,"children":1266},{"class":299,"line":478},[1267,1271,1276,1280,1285,1289,1294,1298,1302,1307,1311,1316,1320,1324],{"type":40,"tag":297,"props":1268,"children":1269},{"style":801},[1270],{"type":45,"value":804},{"type":40,"tag":297,"props":1272,"children":1273},{"style":612},[1274],{"type":45,"value":1275}," retriever ",{"type":40,"tag":297,"props":1277,"children":1278},{"style":606},[1279],{"type":45,"value":814},{"type":40,"tag":297,"props":1281,"children":1282},{"style":612},[1283],{"type":45,"value":1284}," vectorstore",{"type":40,"tag":297,"props":1286,"children":1287},{"style":606},[1288],{"type":45,"value":1102},{"type":40,"tag":297,"props":1290,"children":1291},{"style":830},[1292],{"type":45,"value":1293},"asRetriever",{"type":40,"tag":297,"props":1295,"children":1296},{"style":612},[1297],{"type":45,"value":837},{"type":40,"tag":297,"props":1299,"children":1300},{"style":606},[1301],{"type":45,"value":842},{"type":40,"tag":297,"props":1303,"children":1304},{"style":845},[1305],{"type":45,"value":1306}," k",{"type":40,"tag":297,"props":1308,"children":1309},{"style":606},[1310],{"type":45,"value":853},{"type":40,"tag":297,"props":1312,"children":1313},{"style":1038},[1314],{"type":45,"value":1315}," 4",{"type":40,"tag":297,"props":1317,"children":1318},{"style":606},[1319],{"type":45,"value":630},{"type":40,"tag":297,"props":1321,"children":1322},{"style":612},[1323],{"type":45,"value":893},{"type":40,"tag":297,"props":1325,"children":1326},{"style":606},[1327],{"type":45,"value":656},{"type":40,"tag":297,"props":1329,"children":1330},{"class":299,"line":487},[1331],{"type":40,"tag":297,"props":1332,"children":1333},{"emptyLinePlaceholder":340},[1334],{"type":45,"value":343},{"type":40,"tag":297,"props":1336,"children":1337},{"class":299,"line":495},[1338],{"type":40,"tag":297,"props":1339,"children":1340},{"style":792},[1341],{"type":45,"value":1342},"\u002F\u002F 5. Use in RAG\n",{"type":40,"tag":297,"props":1344,"children":1345},{"class":299,"line":504},[1346,1350,1355,1359,1363,1367,1371,1375,1379,1383,1387,1392,1396,1400,1404],{"type":40,"tag":297,"props":1347,"children":1348},{"style":801},[1349],{"type":45,"value":804},{"type":40,"tag":297,"props":1351,"children":1352},{"style":612},[1353],{"type":45,"value":1354}," model ",{"type":40,"tag":297,"props":1356,"children":1357},{"style":606},[1358],{"type":45,"value":814},{"type":40,"tag":297,"props":1360,"children":1361},{"style":606},[1362],{"type":45,"value":1014},{"type":40,"tag":297,"props":1364,"children":1365},{"style":830},[1366],{"type":45,"value":615},{"type":40,"tag":297,"props":1368,"children":1369},{"style":612},[1370],{"type":45,"value":837},{"type":40,"tag":297,"props":1372,"children":1373},{"style":606},[1374],{"type":45,"value":842},{"type":40,"tag":297,"props":1376,"children":1377},{"style":845},[1378],{"type":45,"value":1168},{"type":40,"tag":297,"props":1380,"children":1381},{"style":606},[1382],{"type":45,"value":853},{"type":40,"tag":297,"props":1384,"children":1385},{"style":606},[1386],{"type":45,"value":640},{"type":40,"tag":297,"props":1388,"children":1389},{"style":643},[1390],{"type":45,"value":1391},"gpt-4.1",{"type":40,"tag":297,"props":1393,"children":1394},{"style":606},[1395],{"type":45,"value":651},{"type":40,"tag":297,"props":1397,"children":1398},{"style":606},[1399],{"type":45,"value":630},{"type":40,"tag":297,"props":1401,"children":1402},{"style":612},[1403],{"type":45,"value":893},{"type":40,"tag":297,"props":1405,"children":1406},{"style":606},[1407],{"type":45,"value":656},{"type":40,"tag":297,"props":1409,"children":1410},{"class":299,"line":513},[1411,1415,1420,1424,1428,1433,1437],{"type":40,"tag":297,"props":1412,"children":1413},{"style":801},[1414],{"type":45,"value":804},{"type":40,"tag":297,"props":1416,"children":1417},{"style":612},[1418],{"type":45,"value":1419}," query ",{"type":40,"tag":297,"props":1421,"children":1422},{"style":606},[1423],{"type":45,"value":814},{"type":40,"tag":297,"props":1425,"children":1426},{"style":606},[1427],{"type":45,"value":640},{"type":40,"tag":297,"props":1429,"children":1430},{"style":643},[1431],{"type":45,"value":1432},"What is RAG?",{"type":40,"tag":297,"props":1434,"children":1435},{"style":606},[1436],{"type":45,"value":651},{"type":40,"tag":297,"props":1438,"children":1439},{"style":606},[1440],{"type":45,"value":656},{"type":40,"tag":297,"props":1442,"children":1443},{"class":299,"line":522},[1444,1448,1453,1457,1461,1466,1470,1475,1480],{"type":40,"tag":297,"props":1445,"children":1446},{"style":801},[1447],{"type":45,"value":804},{"type":40,"tag":297,"props":1449,"children":1450},{"style":612},[1451],{"type":45,"value":1452}," relevantDocs ",{"type":40,"tag":297,"props":1454,"children":1455},{"style":606},[1456],{"type":45,"value":814},{"type":40,"tag":297,"props":1458,"children":1459},{"style":600},[1460],{"type":45,"value":1092},{"type":40,"tag":297,"props":1462,"children":1463},{"style":612},[1464],{"type":45,"value":1465}," retriever",{"type":40,"tag":297,"props":1467,"children":1468},{"style":606},[1469],{"type":45,"value":1102},{"type":40,"tag":297,"props":1471,"children":1472},{"style":830},[1473],{"type":45,"value":1474},"invoke",{"type":40,"tag":297,"props":1476,"children":1477},{"style":612},[1478],{"type":45,"value":1479},"(query)",{"type":40,"tag":297,"props":1481,"children":1482},{"style":606},[1483],{"type":45,"value":656},{"type":40,"tag":297,"props":1485,"children":1486},{"class":299,"line":531},[1487],{"type":40,"tag":297,"props":1488,"children":1489},{"emptyLinePlaceholder":340},[1490],{"type":45,"value":343},{"type":40,"tag":297,"props":1492,"children":1493},{"class":299,"line":539},[1494,1498,1503,1507,1512,1516,1521,1525,1531,1536,1541,1545,1550,1554,1559,1563,1567,1572,1576,1580],{"type":40,"tag":297,"props":1495,"children":1496},{"style":801},[1497],{"type":45,"value":804},{"type":40,"tag":297,"props":1499,"children":1500},{"style":612},[1501],{"type":45,"value":1502}," context ",{"type":40,"tag":297,"props":1504,"children":1505},{"style":606},[1506],{"type":45,"value":814},{"type":40,"tag":297,"props":1508,"children":1509},{"style":612},[1510],{"type":45,"value":1511}," relevantDocs",{"type":40,"tag":297,"props":1513,"children":1514},{"style":606},[1515],{"type":45,"value":1102},{"type":40,"tag":297,"props":1517,"children":1518},{"style":830},[1519],{"type":45,"value":1520},"map",{"type":40,"tag":297,"props":1522,"children":1523},{"style":612},[1524],{"type":45,"value":837},{"type":40,"tag":297,"props":1526,"children":1528},{"style":1527},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[1529],{"type":45,"value":1530},"doc",{"type":40,"tag":297,"props":1532,"children":1533},{"style":801},[1534],{"type":45,"value":1535}," =>",{"type":40,"tag":297,"props":1537,"children":1538},{"style":612},[1539],{"type":45,"value":1540}," doc",{"type":40,"tag":297,"props":1542,"children":1543},{"style":606},[1544],{"type":45,"value":1102},{"type":40,"tag":297,"props":1546,"children":1547},{"style":612},[1548],{"type":45,"value":1549},"pageContent)",{"type":40,"tag":297,"props":1551,"children":1552},{"style":606},[1553],{"type":45,"value":1102},{"type":40,"tag":297,"props":1555,"children":1556},{"style":830},[1557],{"type":45,"value":1558},"join",{"type":40,"tag":297,"props":1560,"children":1561},{"style":612},[1562],{"type":45,"value":837},{"type":40,"tag":297,"props":1564,"children":1565},{"style":606},[1566],{"type":45,"value":651},{"type":40,"tag":297,"props":1568,"children":1569},{"style":612},[1570],{"type":45,"value":1571},"\\n\\n",{"type":40,"tag":297,"props":1573,"children":1574},{"style":606},[1575],{"type":45,"value":651},{"type":40,"tag":297,"props":1577,"children":1578},{"style":612},[1579],{"type":45,"value":893},{"type":40,"tag":297,"props":1581,"children":1582},{"style":606},[1583],{"type":45,"value":656},{"type":40,"tag":297,"props":1585,"children":1586},{"class":299,"line":548},[1587,1591,1596,1600,1604,1608,1612,1616],{"type":40,"tag":297,"props":1588,"children":1589},{"style":801},[1590],{"type":45,"value":804},{"type":40,"tag":297,"props":1592,"children":1593},{"style":612},[1594],{"type":45,"value":1595}," response ",{"type":40,"tag":297,"props":1597,"children":1598},{"style":606},[1599],{"type":45,"value":814},{"type":40,"tag":297,"props":1601,"children":1602},{"style":600},[1603],{"type":45,"value":1092},{"type":40,"tag":297,"props":1605,"children":1606},{"style":612},[1607],{"type":45,"value":1168},{"type":40,"tag":297,"props":1609,"children":1610},{"style":606},[1611],{"type":45,"value":1102},{"type":40,"tag":297,"props":1613,"children":1614},{"style":830},[1615],{"type":45,"value":1474},{"type":40,"tag":297,"props":1617,"children":1618},{"style":612},[1619],{"type":45,"value":1620},"([\n",{"type":40,"tag":297,"props":1622,"children":1623},{"class":299,"line":557},[1624,1629,1634,1638,1642,1647,1651,1655,1660,1664,1669,1674,1678,1683,1688,1693],{"type":40,"tag":297,"props":1625,"children":1626},{"style":606},[1627],{"type":45,"value":1628},"  {",{"type":40,"tag":297,"props":1630,"children":1631},{"style":845},[1632],{"type":45,"value":1633}," role",{"type":40,"tag":297,"props":1635,"children":1636},{"style":606},[1637],{"type":45,"value":853},{"type":40,"tag":297,"props":1639,"children":1640},{"style":606},[1641],{"type":45,"value":640},{"type":40,"tag":297,"props":1643,"children":1644},{"style":643},[1645],{"type":45,"value":1646},"system",{"type":40,"tag":297,"props":1648,"children":1649},{"style":606},[1650],{"type":45,"value":651},{"type":40,"tag":297,"props":1652,"children":1653},{"style":606},[1654],{"type":45,"value":620},{"type":40,"tag":297,"props":1656,"children":1657},{"style":845},[1658],{"type":45,"value":1659}," content",{"type":40,"tag":297,"props":1661,"children":1662},{"style":606},[1663],{"type":45,"value":853},{"type":40,"tag":297,"props":1665,"children":1666},{"style":606},[1667],{"type":45,"value":1668}," `",{"type":40,"tag":297,"props":1670,"children":1671},{"style":643},[1672],{"type":45,"value":1673},"Use this context:",{"type":40,"tag":297,"props":1675,"children":1676},{"style":612},[1677],{"type":45,"value":1571},{"type":40,"tag":297,"props":1679,"children":1680},{"style":606},[1681],{"type":45,"value":1682},"${",{"type":40,"tag":297,"props":1684,"children":1685},{"style":612},[1686],{"type":45,"value":1687},"context",{"type":40,"tag":297,"props":1689,"children":1690},{"style":606},[1691],{"type":45,"value":1692},"}`",{"type":40,"tag":297,"props":1694,"children":1695},{"style":606},[1696],{"type":45,"value":1697}," },\n",{"type":40,"tag":297,"props":1699,"children":1700},{"class":299,"line":566},[1701,1705,1709,1713,1717,1722,1726,1730,1734,1738,1742],{"type":40,"tag":297,"props":1702,"children":1703},{"style":606},[1704],{"type":45,"value":1628},{"type":40,"tag":297,"props":1706,"children":1707},{"style":845},[1708],{"type":45,"value":1633},{"type":40,"tag":297,"props":1710,"children":1711},{"style":606},[1712],{"type":45,"value":853},{"type":40,"tag":297,"props":1714,"children":1715},{"style":606},[1716],{"type":45,"value":640},{"type":40,"tag":297,"props":1718,"children":1719},{"style":643},[1720],{"type":45,"value":1721},"user",{"type":40,"tag":297,"props":1723,"children":1724},{"style":606},[1725],{"type":45,"value":651},{"type":40,"tag":297,"props":1727,"children":1728},{"style":606},[1729],{"type":45,"value":620},{"type":40,"tag":297,"props":1731,"children":1732},{"style":845},[1733],{"type":45,"value":1659},{"type":40,"tag":297,"props":1735,"children":1736},{"style":606},[1737],{"type":45,"value":853},{"type":40,"tag":297,"props":1739,"children":1740},{"style":612},[1741],{"type":45,"value":1419},{"type":40,"tag":297,"props":1743,"children":1744},{"style":606},[1745],{"type":45,"value":1746},"},\n",{"type":40,"tag":297,"props":1748,"children":1749},{"class":299,"line":575},[1750,1755],{"type":40,"tag":297,"props":1751,"children":1752},{"style":612},[1753],{"type":45,"value":1754},"])",{"type":40,"tag":297,"props":1756,"children":1757},{"style":606},[1758],{"type":45,"value":656},{"type":40,"tag":265,"props":1760,"children":1761},{},[],{"type":40,"tag":269,"props":1763,"children":1765},{"id":1764},"document-loaders",[1766],{"type":45,"value":111},{"type":40,"tag":1768,"props":1769,"children":1770},"ex-loading-pdf",{},[1771,1822],{"type":40,"tag":280,"props":1772,"children":1773},{},[1774,1776],{"type":45,"value":1775},"\nLoad a PDF file and extract each page as a separate document.\n",{"type":40,"tag":286,"props":1777,"children":1779},{"className":288,"code":1778,"language":280,"meta":290,"style":290},"from langchain_community.document_loaders import PyPDFLoader\n\nloader = PyPDFLoader(\".\u002Fdocument.pdf\")\ndocs = loader.load()\nprint(f\"Loaded {len(docs)} pages\")\n",[1780],{"type":40,"tag":293,"props":1781,"children":1782},{"__ignoreMap":290},[1783,1791,1798,1806,1814],{"type":40,"tag":297,"props":1784,"children":1785},{"class":299,"line":300},[1786],{"type":40,"tag":297,"props":1787,"children":1788},{},[1789],{"type":45,"value":1790},"from langchain_community.document_loaders import PyPDFLoader\n",{"type":40,"tag":297,"props":1792,"children":1793},{"class":299,"line":309},[1794],{"type":40,"tag":297,"props":1795,"children":1796},{"emptyLinePlaceholder":340},[1797],{"type":45,"value":343},{"type":40,"tag":297,"props":1799,"children":1800},{"class":299,"line":318},[1801],{"type":40,"tag":297,"props":1802,"children":1803},{},[1804],{"type":45,"value":1805},"loader = PyPDFLoader(\".\u002Fdocument.pdf\")\n",{"type":40,"tag":297,"props":1807,"children":1808},{"class":299,"line":327},[1809],{"type":40,"tag":297,"props":1810,"children":1811},{},[1812],{"type":45,"value":1813},"docs = loader.load()\n",{"type":40,"tag":297,"props":1815,"children":1816},{"class":299,"line":336},[1817],{"type":40,"tag":297,"props":1818,"children":1819},{},[1820],{"type":45,"value":1821},"print(f\"Loaded {len(docs)} pages\")\n",{"type":40,"tag":583,"props":1823,"children":1824},{},[1825,1826],{"type":45,"value":1775},{"type":40,"tag":286,"props":1827,"children":1829},{"className":589,"code":1828,"language":583,"meta":290,"style":290},"import { PDFLoader } from \"@langchain\u002Fcommunity\u002Fdocument_loaders\u002Ffs\u002Fpdf\";\n\nconst loader = new PDFLoader(\".\u002Fdocument.pdf\");\nconst docs = await loader.load();\nconsole.log(`Loaded ${docs.length} pages`);\n",[1830],{"type":40,"tag":293,"props":1831,"children":1832},{"__ignoreMap":290},[1833,1874,1881,1930,1972],{"type":40,"tag":297,"props":1834,"children":1835},{"class":299,"line":300},[1836,1840,1844,1849,1853,1857,1861,1866,1870],{"type":40,"tag":297,"props":1837,"children":1838},{"style":600},[1839],{"type":45,"value":603},{"type":40,"tag":297,"props":1841,"children":1842},{"style":606},[1843],{"type":45,"value":609},{"type":40,"tag":297,"props":1845,"children":1846},{"style":612},[1847],{"type":45,"value":1848}," PDFLoader",{"type":40,"tag":297,"props":1850,"children":1851},{"style":606},[1852],{"type":45,"value":630},{"type":40,"tag":297,"props":1854,"children":1855},{"style":600},[1856],{"type":45,"value":635},{"type":40,"tag":297,"props":1858,"children":1859},{"style":606},[1860],{"type":45,"value":640},{"type":40,"tag":297,"props":1862,"children":1863},{"style":643},[1864],{"type":45,"value":1865},"@langchain\u002Fcommunity\u002Fdocument_loaders\u002Ffs\u002Fpdf",{"type":40,"tag":297,"props":1867,"children":1868},{"style":606},[1869],{"type":45,"value":651},{"type":40,"tag":297,"props":1871,"children":1872},{"style":606},[1873],{"type":45,"value":656},{"type":40,"tag":297,"props":1875,"children":1876},{"class":299,"line":309},[1877],{"type":40,"tag":297,"props":1878,"children":1879},{"emptyLinePlaceholder":340},[1880],{"type":45,"value":343},{"type":40,"tag":297,"props":1882,"children":1883},{"class":299,"line":318},[1884,1888,1893,1897,1901,1905,1909,1913,1918,1922,1926],{"type":40,"tag":297,"props":1885,"children":1886},{"style":801},[1887],{"type":45,"value":804},{"type":40,"tag":297,"props":1889,"children":1890},{"style":612},[1891],{"type":45,"value":1892}," loader ",{"type":40,"tag":297,"props":1894,"children":1895},{"style":606},[1896],{"type":45,"value":814},{"type":40,"tag":297,"props":1898,"children":1899},{"style":606},[1900],{"type":45,"value":1014},{"type":40,"tag":297,"props":1902,"children":1903},{"style":830},[1904],{"type":45,"value":1848},{"type":40,"tag":297,"props":1906,"children":1907},{"style":612},[1908],{"type":45,"value":837},{"type":40,"tag":297,"props":1910,"children":1911},{"style":606},[1912],{"type":45,"value":651},{"type":40,"tag":297,"props":1914,"children":1915},{"style":643},[1916],{"type":45,"value":1917},".\u002Fdocument.pdf",{"type":40,"tag":297,"props":1919,"children":1920},{"style":606},[1921],{"type":45,"value":651},{"type":40,"tag":297,"props":1923,"children":1924},{"style":612},[1925],{"type":45,"value":893},{"type":40,"tag":297,"props":1927,"children":1928},{"style":606},[1929],{"type":45,"value":656},{"type":40,"tag":297,"props":1931,"children":1932},{"class":299,"line":327},[1933,1937,1941,1945,1949,1954,1958,1963,1968],{"type":40,"tag":297,"props":1934,"children":1935},{"style":801},[1936],{"type":45,"value":804},{"type":40,"tag":297,"props":1938,"children":1939},{"style":612},[1940],{"type":45,"value":809},{"type":40,"tag":297,"props":1942,"children":1943},{"style":606},[1944],{"type":45,"value":814},{"type":40,"tag":297,"props":1946,"children":1947},{"style":600},[1948],{"type":45,"value":1092},{"type":40,"tag":297,"props":1950,"children":1951},{"style":612},[1952],{"type":45,"value":1953}," loader",{"type":40,"tag":297,"props":1955,"children":1956},{"style":606},[1957],{"type":45,"value":1102},{"type":40,"tag":297,"props":1959,"children":1960},{"style":830},[1961],{"type":45,"value":1962},"load",{"type":40,"tag":297,"props":1964,"children":1965},{"style":612},[1966],{"type":45,"value":1967},"()",{"type":40,"tag":297,"props":1969,"children":1970},{"style":606},[1971],{"type":45,"value":656},{"type":40,"tag":297,"props":1973,"children":1974},{"class":299,"line":336},[1975,1980,1984,1989,1993,1998,2003,2007,2012,2016,2021,2026,2031,2035,2039],{"type":40,"tag":297,"props":1976,"children":1977},{"style":612},[1978],{"type":45,"value":1979},"console",{"type":40,"tag":297,"props":1981,"children":1982},{"style":606},[1983],{"type":45,"value":1102},{"type":40,"tag":297,"props":1985,"children":1986},{"style":830},[1987],{"type":45,"value":1988},"log",{"type":40,"tag":297,"props":1990,"children":1991},{"style":612},[1992],{"type":45,"value":837},{"type":40,"tag":297,"props":1994,"children":1995},{"style":606},[1996],{"type":45,"value":1997},"`",{"type":40,"tag":297,"props":1999,"children":2000},{"style":643},[2001],{"type":45,"value":2002},"Loaded ",{"type":40,"tag":297,"props":2004,"children":2005},{"style":606},[2006],{"type":45,"value":1682},{"type":40,"tag":297,"props":2008,"children":2009},{"style":612},[2010],{"type":45,"value":2011},"docs",{"type":40,"tag":297,"props":2013,"children":2014},{"style":606},[2015],{"type":45,"value":1102},{"type":40,"tag":297,"props":2017,"children":2018},{"style":612},[2019],{"type":45,"value":2020},"length",{"type":40,"tag":297,"props":2022,"children":2023},{"style":606},[2024],{"type":45,"value":2025},"}",{"type":40,"tag":297,"props":2027,"children":2028},{"style":643},[2029],{"type":45,"value":2030}," pages",{"type":40,"tag":297,"props":2032,"children":2033},{"style":606},[2034],{"type":45,"value":1997},{"type":40,"tag":297,"props":2036,"children":2037},{"style":612},[2038],{"type":45,"value":893},{"type":40,"tag":297,"props":2040,"children":2041},{"style":606},[2042],{"type":45,"value":656},{"type":40,"tag":2044,"props":2045,"children":2046},"ex-loading-web-pages",{},[2047,2089],{"type":40,"tag":280,"props":2048,"children":2049},{},[2050,2052],{"type":45,"value":2051},"\nFetch and parse content from a web URL into a document.\n",{"type":40,"tag":286,"props":2053,"children":2055},{"className":288,"code":2054,"language":280,"meta":290,"style":290},"from langchain_community.document_loaders import WebBaseLoader\n\nloader = WebBaseLoader(\"https:\u002F\u002Fdocs.langchain.com\")\ndocs = loader.load()\n",[2056],{"type":40,"tag":293,"props":2057,"children":2058},{"__ignoreMap":290},[2059,2067,2074,2082],{"type":40,"tag":297,"props":2060,"children":2061},{"class":299,"line":300},[2062],{"type":40,"tag":297,"props":2063,"children":2064},{},[2065],{"type":45,"value":2066},"from langchain_community.document_loaders import WebBaseLoader\n",{"type":40,"tag":297,"props":2068,"children":2069},{"class":299,"line":309},[2070],{"type":40,"tag":297,"props":2071,"children":2072},{"emptyLinePlaceholder":340},[2073],{"type":45,"value":343},{"type":40,"tag":297,"props":2075,"children":2076},{"class":299,"line":318},[2077],{"type":40,"tag":297,"props":2078,"children":2079},{},[2080],{"type":45,"value":2081},"loader = WebBaseLoader(\"https:\u002F\u002Fdocs.langchain.com\")\n",{"type":40,"tag":297,"props":2083,"children":2084},{"class":299,"line":327},[2085],{"type":40,"tag":297,"props":2086,"children":2087},{},[2088],{"type":45,"value":1813},{"type":40,"tag":583,"props":2090,"children":2091},{},[2092,2094],{"type":45,"value":2093},"\nFetch and parse content from a web URL into a document using Cheerio.\n",{"type":40,"tag":286,"props":2095,"children":2097},{"className":589,"code":2096,"language":583,"meta":290,"style":290},"import { CheerioWebBaseLoader } from \"@langchain\u002Fcommunity\u002Fdocument_loaders\u002Fweb\u002Fcheerio\";\n\nconst loader = new CheerioWebBaseLoader(\"https:\u002F\u002Fdocs.langchain.com\");\nconst docs = await loader.load();\n",[2098],{"type":40,"tag":293,"props":2099,"children":2100},{"__ignoreMap":290},[2101,2142,2149,2197],{"type":40,"tag":297,"props":2102,"children":2103},{"class":299,"line":300},[2104,2108,2112,2117,2121,2125,2129,2134,2138],{"type":40,"tag":297,"props":2105,"children":2106},{"style":600},[2107],{"type":45,"value":603},{"type":40,"tag":297,"props":2109,"children":2110},{"style":606},[2111],{"type":45,"value":609},{"type":40,"tag":297,"props":2113,"children":2114},{"style":612},[2115],{"type":45,"value":2116}," CheerioWebBaseLoader",{"type":40,"tag":297,"props":2118,"children":2119},{"style":606},[2120],{"type":45,"value":630},{"type":40,"tag":297,"props":2122,"children":2123},{"style":600},[2124],{"type":45,"value":635},{"type":40,"tag":297,"props":2126,"children":2127},{"style":606},[2128],{"type":45,"value":640},{"type":40,"tag":297,"props":2130,"children":2131},{"style":643},[2132],{"type":45,"value":2133},"@langchain\u002Fcommunity\u002Fdocument_loaders\u002Fweb\u002Fcheerio",{"type":40,"tag":297,"props":2135,"children":2136},{"style":606},[2137],{"type":45,"value":651},{"type":40,"tag":297,"props":2139,"children":2140},{"style":606},[2141],{"type":45,"value":656},{"type":40,"tag":297,"props":2143,"children":2144},{"class":299,"line":309},[2145],{"type":40,"tag":297,"props":2146,"children":2147},{"emptyLinePlaceholder":340},[2148],{"type":45,"value":343},{"type":40,"tag":297,"props":2150,"children":2151},{"class":299,"line":318},[2152,2156,2160,2164,2168,2172,2176,2180,2185,2189,2193],{"type":40,"tag":297,"props":2153,"children":2154},{"style":801},[2155],{"type":45,"value":804},{"type":40,"tag":297,"props":2157,"children":2158},{"style":612},[2159],{"type":45,"value":1892},{"type":40,"tag":297,"props":2161,"children":2162},{"style":606},[2163],{"type":45,"value":814},{"type":40,"tag":297,"props":2165,"children":2166},{"style":606},[2167],{"type":45,"value":1014},{"type":40,"tag":297,"props":2169,"children":2170},{"style":830},[2171],{"type":45,"value":2116},{"type":40,"tag":297,"props":2173,"children":2174},{"style":612},[2175],{"type":45,"value":837},{"type":40,"tag":297,"props":2177,"children":2178},{"style":606},[2179],{"type":45,"value":651},{"type":40,"tag":297,"props":2181,"children":2182},{"style":643},[2183],{"type":45,"value":2184},"https:\u002F\u002Fdocs.langchain.com",{"type":40,"tag":297,"props":2186,"children":2187},{"style":606},[2188],{"type":45,"value":651},{"type":40,"tag":297,"props":2190,"children":2191},{"style":612},[2192],{"type":45,"value":893},{"type":40,"tag":297,"props":2194,"children":2195},{"style":606},[2196],{"type":45,"value":656},{"type":40,"tag":297,"props":2198,"children":2199},{"class":299,"line":327},[2200,2204,2208,2212,2216,2220,2224,2228,2232],{"type":40,"tag":297,"props":2201,"children":2202},{"style":801},[2203],{"type":45,"value":804},{"type":40,"tag":297,"props":2205,"children":2206},{"style":612},[2207],{"type":45,"value":809},{"type":40,"tag":297,"props":2209,"children":2210},{"style":606},[2211],{"type":45,"value":814},{"type":40,"tag":297,"props":2213,"children":2214},{"style":600},[2215],{"type":45,"value":1092},{"type":40,"tag":297,"props":2217,"children":2218},{"style":612},[2219],{"type":45,"value":1953},{"type":40,"tag":297,"props":2221,"children":2222},{"style":606},[2223],{"type":45,"value":1102},{"type":40,"tag":297,"props":2225,"children":2226},{"style":830},[2227],{"type":45,"value":1962},{"type":40,"tag":297,"props":2229,"children":2230},{"style":612},[2231],{"type":45,"value":1967},{"type":40,"tag":297,"props":2233,"children":2234},{"style":606},[2235],{"type":45,"value":656},{"type":40,"tag":2237,"props":2238,"children":2239},"ex-loading-directory",{},[2240],{"type":40,"tag":280,"props":2241,"children":2242},{},[2243,2245],{"type":45,"value":2244},"\nLoad all text files from a directory using a glob pattern.\n",{"type":40,"tag":286,"props":2246,"children":2248},{"className":288,"code":2247,"language":280,"meta":290,"style":290},"from langchain_community.document_loaders import DirectoryLoader, TextLoader\n\n# Load all text files from directory\nloader = DirectoryLoader(\n    \"path\u002Fto\u002Fdocuments\",\n    glob=\"**\u002F*.txt\",  # Pattern for files to load\n    loader_cls=TextLoader\n)\ndocs = loader.load()\n",[2249],{"type":40,"tag":293,"props":2250,"children":2251},{"__ignoreMap":290},[2252,2260,2267,2275,2283,2291,2299,2307,2315],{"type":40,"tag":297,"props":2253,"children":2254},{"class":299,"line":300},[2255],{"type":40,"tag":297,"props":2256,"children":2257},{},[2258],{"type":45,"value":2259},"from langchain_community.document_loaders import DirectoryLoader, TextLoader\n",{"type":40,"tag":297,"props":2261,"children":2262},{"class":299,"line":309},[2263],{"type":40,"tag":297,"props":2264,"children":2265},{"emptyLinePlaceholder":340},[2266],{"type":45,"value":343},{"type":40,"tag":297,"props":2268,"children":2269},{"class":299,"line":318},[2270],{"type":40,"tag":297,"props":2271,"children":2272},{},[2273],{"type":45,"value":2274},"# Load all text files from directory\n",{"type":40,"tag":297,"props":2276,"children":2277},{"class":299,"line":327},[2278],{"type":40,"tag":297,"props":2279,"children":2280},{},[2281],{"type":45,"value":2282},"loader = DirectoryLoader(\n",{"type":40,"tag":297,"props":2284,"children":2285},{"class":299,"line":336},[2286],{"type":40,"tag":297,"props":2287,"children":2288},{},[2289],{"type":45,"value":2290},"    \"path\u002Fto\u002Fdocuments\",\n",{"type":40,"tag":297,"props":2292,"children":2293},{"class":299,"line":346},[2294],{"type":40,"tag":297,"props":2295,"children":2296},{},[2297],{"type":45,"value":2298},"    glob=\"**\u002F*.txt\",  # Pattern for files to load\n",{"type":40,"tag":297,"props":2300,"children":2301},{"class":299,"line":355},[2302],{"type":40,"tag":297,"props":2303,"children":2304},{},[2305],{"type":45,"value":2306},"    loader_cls=TextLoader\n",{"type":40,"tag":297,"props":2308,"children":2309},{"class":299,"line":364},[2310],{"type":40,"tag":297,"props":2311,"children":2312},{},[2313],{"type":45,"value":2314},")\n",{"type":40,"tag":297,"props":2316,"children":2317},{"class":299,"line":373},[2318],{"type":40,"tag":297,"props":2319,"children":2320},{},[2321],{"type":45,"value":1813},{"type":40,"tag":265,"props":2323,"children":2324},{},[],{"type":40,"tag":269,"props":2326,"children":2328},{"id":2327},"text-splitting",[2329],{"type":45,"value":2330},"Text Splitting",{"type":40,"tag":2332,"props":2333,"children":2334},"ex-text-splitting",{},[2335],{"type":40,"tag":280,"props":2336,"children":2337},{},[2338,2340],{"type":45,"value":2339},"\nSplit documents into chunks using RecursiveCharacterTextSplitter with configurable size and overlap.\n",{"type":40,"tag":286,"props":2341,"children":2343},{"className":288,"code":2342,"language":280,"meta":290,"style":290},"from langchain_text_splitters import RecursiveCharacterTextSplitter\n\nsplitter = RecursiveCharacterTextSplitter(\n    chunk_size=1000,        # Characters per chunk\n    chunk_overlap=200,      # Overlap for context continuity\n    separators=[\"\\n\\n\", \"\\n\", \" \", \"\"],  # Split hierarchy\n)\n\nsplits = splitter.split_documents(docs)\n",[2344],{"type":40,"tag":293,"props":2345,"children":2346},{"__ignoreMap":290},[2347,2354,2361,2369,2377,2385,2393,2400,2407],{"type":40,"tag":297,"props":2348,"children":2349},{"class":299,"line":300},[2350],{"type":40,"tag":297,"props":2351,"children":2352},{},[2353],{"type":45,"value":324},{"type":40,"tag":297,"props":2355,"children":2356},{"class":299,"line":309},[2357],{"type":40,"tag":297,"props":2358,"children":2359},{"emptyLinePlaceholder":340},[2360],{"type":45,"value":343},{"type":40,"tag":297,"props":2362,"children":2363},{"class":299,"line":318},[2364],{"type":40,"tag":297,"props":2365,"children":2366},{},[2367],{"type":45,"value":2368},"splitter = RecursiveCharacterTextSplitter(\n",{"type":40,"tag":297,"props":2370,"children":2371},{"class":299,"line":327},[2372],{"type":40,"tag":297,"props":2373,"children":2374},{},[2375],{"type":45,"value":2376},"    chunk_size=1000,        # Characters per chunk\n",{"type":40,"tag":297,"props":2378,"children":2379},{"class":299,"line":336},[2380],{"type":40,"tag":297,"props":2381,"children":2382},{},[2383],{"type":45,"value":2384},"    chunk_overlap=200,      # Overlap for context continuity\n",{"type":40,"tag":297,"props":2386,"children":2387},{"class":299,"line":346},[2388],{"type":40,"tag":297,"props":2389,"children":2390},{},[2391],{"type":45,"value":2392},"    separators=[\"\\n\\n\", \"\\n\", \" \", \"\"],  # Split hierarchy\n",{"type":40,"tag":297,"props":2394,"children":2395},{"class":299,"line":355},[2396],{"type":40,"tag":297,"props":2397,"children":2398},{},[2399],{"type":45,"value":2314},{"type":40,"tag":297,"props":2401,"children":2402},{"class":299,"line":364},[2403],{"type":40,"tag":297,"props":2404,"children":2405},{"emptyLinePlaceholder":340},[2406],{"type":45,"value":343},{"type":40,"tag":297,"props":2408,"children":2409},{"class":299,"line":373},[2410],{"type":40,"tag":297,"props":2411,"children":2412},{},[2413],{"type":45,"value":423},{"type":40,"tag":265,"props":2415,"children":2416},{},[],{"type":40,"tag":269,"props":2418,"children":2420},{"id":2419},"vector-stores",[2421],{"type":45,"value":141},{"type":40,"tag":2423,"props":2424,"children":2425},"ex-chroma-vectorstore",{},[2426,2560],{"type":40,"tag":280,"props":2427,"children":2428},{},[2429,2431],{"type":45,"value":2430},"\nCreate a persistent Chroma vector store and reload it from disk.\n",{"type":40,"tag":286,"props":2432,"children":2434},{"className":288,"code":2433,"language":280,"meta":290,"style":290},"from langchain_chroma import Chroma\nfrom langchain_openai import OpenAIEmbeddings\n\nvectorstore = Chroma.from_documents(\n    documents=splits,\n    embedding=OpenAIEmbeddings(),\n    persist_directory=\".\u002Fchroma_db\",\n    collection_name=\"my-collection\",\n)\n\n# Load existing\nvectorstore = Chroma(\n    persist_directory=\".\u002Fchroma_db\",\n    embedding_function=OpenAIEmbeddings(),\n    collection_name=\"my-collection\",\n)\n",[2435],{"type":40,"tag":293,"props":2436,"children":2437},{"__ignoreMap":290},[2438,2446,2454,2461,2469,2477,2485,2493,2501,2508,2515,2523,2531,2538,2546,2553],{"type":40,"tag":297,"props":2439,"children":2440},{"class":299,"line":300},[2441],{"type":40,"tag":297,"props":2442,"children":2443},{},[2444],{"type":45,"value":2445},"from langchain_chroma import Chroma\n",{"type":40,"tag":297,"props":2447,"children":2448},{"class":299,"line":309},[2449],{"type":40,"tag":297,"props":2450,"children":2451},{},[2452],{"type":45,"value":2453},"from langchain_openai import OpenAIEmbeddings\n",{"type":40,"tag":297,"props":2455,"children":2456},{"class":299,"line":318},[2457],{"type":40,"tag":297,"props":2458,"children":2459},{"emptyLinePlaceholder":340},[2460],{"type":45,"value":343},{"type":40,"tag":297,"props":2462,"children":2463},{"class":299,"line":327},[2464],{"type":40,"tag":297,"props":2465,"children":2466},{},[2467],{"type":45,"value":2468},"vectorstore = Chroma.from_documents(\n",{"type":40,"tag":297,"props":2470,"children":2471},{"class":299,"line":336},[2472],{"type":40,"tag":297,"props":2473,"children":2474},{},[2475],{"type":45,"value":2476},"    documents=splits,\n",{"type":40,"tag":297,"props":2478,"children":2479},{"class":299,"line":346},[2480],{"type":40,"tag":297,"props":2481,"children":2482},{},[2483],{"type":45,"value":2484},"    embedding=OpenAIEmbeddings(),\n",{"type":40,"tag":297,"props":2486,"children":2487},{"class":299,"line":355},[2488],{"type":40,"tag":297,"props":2489,"children":2490},{},[2491],{"type":45,"value":2492},"    persist_directory=\".\u002Fchroma_db\",\n",{"type":40,"tag":297,"props":2494,"children":2495},{"class":299,"line":364},[2496],{"type":40,"tag":297,"props":2497,"children":2498},{},[2499],{"type":45,"value":2500},"    collection_name=\"my-collection\",\n",{"type":40,"tag":297,"props":2502,"children":2503},{"class":299,"line":373},[2504],{"type":40,"tag":297,"props":2505,"children":2506},{},[2507],{"type":45,"value":2314},{"type":40,"tag":297,"props":2509,"children":2510},{"class":299,"line":382},[2511],{"type":40,"tag":297,"props":2512,"children":2513},{"emptyLinePlaceholder":340},[2514],{"type":45,"value":343},{"type":40,"tag":297,"props":2516,"children":2517},{"class":299,"line":391},[2518],{"type":40,"tag":297,"props":2519,"children":2520},{},[2521],{"type":45,"value":2522},"# Load existing\n",{"type":40,"tag":297,"props":2524,"children":2525},{"class":299,"line":399},[2526],{"type":40,"tag":297,"props":2527,"children":2528},{},[2529],{"type":45,"value":2530},"vectorstore = Chroma(\n",{"type":40,"tag":297,"props":2532,"children":2533},{"class":299,"line":408},[2534],{"type":40,"tag":297,"props":2535,"children":2536},{},[2537],{"type":45,"value":2492},{"type":40,"tag":297,"props":2539,"children":2540},{"class":299,"line":417},[2541],{"type":40,"tag":297,"props":2542,"children":2543},{},[2544],{"type":45,"value":2545},"    embedding_function=OpenAIEmbeddings(),\n",{"type":40,"tag":297,"props":2547,"children":2548},{"class":299,"line":426},[2549],{"type":40,"tag":297,"props":2550,"children":2551},{},[2552],{"type":45,"value":2500},{"type":40,"tag":297,"props":2554,"children":2555},{"class":299,"line":434},[2556],{"type":40,"tag":297,"props":2557,"children":2558},{},[2559],{"type":45,"value":2314},{"type":40,"tag":583,"props":2561,"children":2562},{},[2563,2565],{"type":45,"value":2564},"\nCreate a Chroma vector store connected to a running Chroma server.\n",{"type":40,"tag":286,"props":2566,"children":2568},{"className":589,"code":2567,"language":583,"meta":290,"style":290},"import { Chroma } from \"@langchain\u002Fcommunity\u002Fvectorstores\u002Fchroma\";\nimport { OpenAIEmbeddings } from \"@langchain\u002Fopenai\";\n\nconst vectorstore = await Chroma.fromDocuments(\n  splits,\n  new OpenAIEmbeddings(),\n  { collectionName: \"my-collection\", url: \"http:\u002F\u002Flocalhost:8000\" }\n);\n",[2569],{"type":40,"tag":293,"props":2570,"children":2571},{"__ignoreMap":290},[2572,2613,2652,2659,2695,2707,2726,2786],{"type":40,"tag":297,"props":2573,"children":2574},{"class":299,"line":300},[2575,2579,2583,2588,2592,2596,2600,2605,2609],{"type":40,"tag":297,"props":2576,"children":2577},{"style":600},[2578],{"type":45,"value":603},{"type":40,"tag":297,"props":2580,"children":2581},{"style":606},[2582],{"type":45,"value":609},{"type":40,"tag":297,"props":2584,"children":2585},{"style":612},[2586],{"type":45,"value":2587}," Chroma",{"type":40,"tag":297,"props":2589,"children":2590},{"style":606},[2591],{"type":45,"value":630},{"type":40,"tag":297,"props":2593,"children":2594},{"style":600},[2595],{"type":45,"value":635},{"type":40,"tag":297,"props":2597,"children":2598},{"style":606},[2599],{"type":45,"value":640},{"type":40,"tag":297,"props":2601,"children":2602},{"style":643},[2603],{"type":45,"value":2604},"@langchain\u002Fcommunity\u002Fvectorstores\u002Fchroma",{"type":40,"tag":297,"props":2606,"children":2607},{"style":606},[2608],{"type":45,"value":651},{"type":40,"tag":297,"props":2610,"children":2611},{"style":606},[2612],{"type":45,"value":656},{"type":40,"tag":297,"props":2614,"children":2615},{"class":299,"line":309},[2616,2620,2624,2628,2632,2636,2640,2644,2648],{"type":40,"tag":297,"props":2617,"children":2618},{"style":600},[2619],{"type":45,"value":603},{"type":40,"tag":297,"props":2621,"children":2622},{"style":606},[2623],{"type":45,"value":609},{"type":40,"tag":297,"props":2625,"children":2626},{"style":612},[2627],{"type":45,"value":625},{"type":40,"tag":297,"props":2629,"children":2630},{"style":606},[2631],{"type":45,"value":630},{"type":40,"tag":297,"props":2633,"children":2634},{"style":600},[2635],{"type":45,"value":635},{"type":40,"tag":297,"props":2637,"children":2638},{"style":606},[2639],{"type":45,"value":640},{"type":40,"tag":297,"props":2641,"children":2642},{"style":643},[2643],{"type":45,"value":646},{"type":40,"tag":297,"props":2645,"children":2646},{"style":606},[2647],{"type":45,"value":651},{"type":40,"tag":297,"props":2649,"children":2650},{"style":606},[2651],{"type":45,"value":656},{"type":40,"tag":297,"props":2653,"children":2654},{"class":299,"line":318},[2655],{"type":40,"tag":297,"props":2656,"children":2657},{"emptyLinePlaceholder":340},[2658],{"type":45,"value":343},{"type":40,"tag":297,"props":2660,"children":2661},{"class":299,"line":327},[2662,2666,2670,2674,2678,2682,2686,2690],{"type":40,"tag":297,"props":2663,"children":2664},{"style":801},[2665],{"type":45,"value":804},{"type":40,"tag":297,"props":2667,"children":2668},{"style":612},[2669],{"type":45,"value":1209},{"type":40,"tag":297,"props":2671,"children":2672},{"style":606},[2673],{"type":45,"value":814},{"type":40,"tag":297,"props":2675,"children":2676},{"style":600},[2677],{"type":45,"value":1092},{"type":40,"tag":297,"props":2679,"children":2680},{"style":612},[2681],{"type":45,"value":2587},{"type":40,"tag":297,"props":2683,"children":2684},{"style":606},[2685],{"type":45,"value":1102},{"type":40,"tag":297,"props":2687,"children":2688},{"style":830},[2689],{"type":45,"value":1230},{"type":40,"tag":297,"props":2691,"children":2692},{"style":612},[2693],{"type":45,"value":2694},"(\n",{"type":40,"tag":297,"props":2696,"children":2697},{"class":299,"line":336},[2698,2703],{"type":40,"tag":297,"props":2699,"children":2700},{"style":612},[2701],{"type":45,"value":2702},"  splits",{"type":40,"tag":297,"props":2704,"children":2705},{"style":606},[2706],{"type":45,"value":898},{"type":40,"tag":297,"props":2708,"children":2709},{"class":299,"line":346},[2710,2714,2718,2722],{"type":40,"tag":297,"props":2711,"children":2712},{"style":606},[2713],{"type":45,"value":827},{"type":40,"tag":297,"props":2715,"children":2716},{"style":830},[2717],{"type":45,"value":625},{"type":40,"tag":297,"props":2719,"children":2720},{"style":612},[2721],{"type":45,"value":1967},{"type":40,"tag":297,"props":2723,"children":2724},{"style":606},[2725],{"type":45,"value":898},{"type":40,"tag":297,"props":2727,"children":2728},{"class":299,"line":355},[2729,2733,2738,2742,2746,2751,2755,2759,2764,2768,2772,2777,2781],{"type":40,"tag":297,"props":2730,"children":2731},{"style":606},[2732],{"type":45,"value":1628},{"type":40,"tag":297,"props":2734,"children":2735},{"style":845},[2736],{"type":45,"value":2737}," collectionName",{"type":40,"tag":297,"props":2739,"children":2740},{"style":606},[2741],{"type":45,"value":853},{"type":40,"tag":297,"props":2743,"children":2744},{"style":606},[2745],{"type":45,"value":640},{"type":40,"tag":297,"props":2747,"children":2748},{"style":643},[2749],{"type":45,"value":2750},"my-collection",{"type":40,"tag":297,"props":2752,"children":2753},{"style":606},[2754],{"type":45,"value":651},{"type":40,"tag":297,"props":2756,"children":2757},{"style":606},[2758],{"type":45,"value":620},{"type":40,"tag":297,"props":2760,"children":2761},{"style":845},[2762],{"type":45,"value":2763}," url",{"type":40,"tag":297,"props":2765,"children":2766},{"style":606},[2767],{"type":45,"value":853},{"type":40,"tag":297,"props":2769,"children":2770},{"style":606},[2771],{"type":45,"value":640},{"type":40,"tag":297,"props":2773,"children":2774},{"style":643},[2775],{"type":45,"value":2776},"http:\u002F\u002Flocalhost:8000",{"type":40,"tag":297,"props":2778,"children":2779},{"style":606},[2780],{"type":45,"value":651},{"type":40,"tag":297,"props":2782,"children":2783},{"style":606},[2784],{"type":45,"value":2785}," }\n",{"type":40,"tag":297,"props":2787,"children":2788},{"class":299,"line":364},[2789,2793],{"type":40,"tag":297,"props":2790,"children":2791},{"style":612},[2792],{"type":45,"value":893},{"type":40,"tag":297,"props":2794,"children":2795},{"style":606},[2796],{"type":45,"value":656},{"type":40,"tag":2798,"props":2799,"children":2800},"ex-faiss-vectorstore",{},[2801,2914],{"type":40,"tag":280,"props":2802,"children":2803},{},[2804,2806],{"type":45,"value":2805},"\nCreate a FAISS vector store, save it to disk, and reload it.\n",{"type":40,"tag":286,"props":2807,"children":2809},{"className":288,"code":2808,"language":280,"meta":290,"style":290},"from langchain_community.vectorstores import FAISS\n\nvectorstore = FAISS.from_documents(splits, embeddings)\nvectorstore.save_local(\".\u002Ffaiss_index\")\n\n# Only load FAISS indexes that you created and fully control.\n# The Python FAISS loader uses pickle-backed metadata, so never load\n# downloaded, shared, or otherwise untrusted index directories.\nloaded = FAISS.load_local(\n    \".\u002Ffaiss_index\",\n    embeddings,\n    allow_dangerous_deserialization=True,\n)\n",[2810],{"type":40,"tag":293,"props":2811,"children":2812},{"__ignoreMap":290},[2813,2821,2828,2836,2844,2851,2859,2867,2875,2883,2891,2899,2907],{"type":40,"tag":297,"props":2814,"children":2815},{"class":299,"line":300},[2816],{"type":40,"tag":297,"props":2817,"children":2818},{},[2819],{"type":45,"value":2820},"from langchain_community.vectorstores import FAISS\n",{"type":40,"tag":297,"props":2822,"children":2823},{"class":299,"line":309},[2824],{"type":40,"tag":297,"props":2825,"children":2826},{"emptyLinePlaceholder":340},[2827],{"type":45,"value":343},{"type":40,"tag":297,"props":2829,"children":2830},{"class":299,"line":318},[2831],{"type":40,"tag":297,"props":2832,"children":2833},{},[2834],{"type":45,"value":2835},"vectorstore = FAISS.from_documents(splits, embeddings)\n",{"type":40,"tag":297,"props":2837,"children":2838},{"class":299,"line":327},[2839],{"type":40,"tag":297,"props":2840,"children":2841},{},[2842],{"type":45,"value":2843},"vectorstore.save_local(\".\u002Ffaiss_index\")\n",{"type":40,"tag":297,"props":2845,"children":2846},{"class":299,"line":336},[2847],{"type":40,"tag":297,"props":2848,"children":2849},{"emptyLinePlaceholder":340},[2850],{"type":45,"value":343},{"type":40,"tag":297,"props":2852,"children":2853},{"class":299,"line":346},[2854],{"type":40,"tag":297,"props":2855,"children":2856},{},[2857],{"type":45,"value":2858},"# Only load FAISS indexes that you created and fully control.\n",{"type":40,"tag":297,"props":2860,"children":2861},{"class":299,"line":355},[2862],{"type":40,"tag":297,"props":2863,"children":2864},{},[2865],{"type":45,"value":2866},"# The Python FAISS loader uses pickle-backed metadata, so never load\n",{"type":40,"tag":297,"props":2868,"children":2869},{"class":299,"line":364},[2870],{"type":40,"tag":297,"props":2871,"children":2872},{},[2873],{"type":45,"value":2874},"# downloaded, shared, or otherwise untrusted index directories.\n",{"type":40,"tag":297,"props":2876,"children":2877},{"class":299,"line":373},[2878],{"type":40,"tag":297,"props":2879,"children":2880},{},[2881],{"type":45,"value":2882},"loaded = FAISS.load_local(\n",{"type":40,"tag":297,"props":2884,"children":2885},{"class":299,"line":382},[2886],{"type":40,"tag":297,"props":2887,"children":2888},{},[2889],{"type":45,"value":2890},"    \".\u002Ffaiss_index\",\n",{"type":40,"tag":297,"props":2892,"children":2893},{"class":299,"line":391},[2894],{"type":40,"tag":297,"props":2895,"children":2896},{},[2897],{"type":45,"value":2898},"    embeddings,\n",{"type":40,"tag":297,"props":2900,"children":2901},{"class":299,"line":399},[2902],{"type":40,"tag":297,"props":2903,"children":2904},{},[2905],{"type":45,"value":2906},"    allow_dangerous_deserialization=True,\n",{"type":40,"tag":297,"props":2908,"children":2909},{"class":299,"line":408},[2910],{"type":40,"tag":297,"props":2911,"children":2912},{},[2913],{"type":45,"value":2314},{"type":40,"tag":583,"props":2915,"children":2916},{},[2917,2918],{"type":45,"value":2805},{"type":40,"tag":286,"props":2919,"children":2921},{"className":589,"code":2920,"language":583,"meta":290,"style":290},"import { FaissStore } from \"@langchain\u002Fcommunity\u002Fvectorstores\u002Ffaiss\";\n\nconst vectorstore = await FaissStore.fromDocuments(splits, embeddings);\nawait vectorstore.save(\".\u002Ffaiss_index\");\n\nconst loaded = await FaissStore.load(\".\u002Ffaiss_index\", embeddings);\n",[2922],{"type":40,"tag":293,"props":2923,"children":2924},{"__ignoreMap":290},[2925,2966,2973,3020,3066,3073],{"type":40,"tag":297,"props":2926,"children":2927},{"class":299,"line":300},[2928,2932,2936,2941,2945,2949,2953,2958,2962],{"type":40,"tag":297,"props":2929,"children":2930},{"style":600},[2931],{"type":45,"value":603},{"type":40,"tag":297,"props":2933,"children":2934},{"style":606},[2935],{"type":45,"value":609},{"type":40,"tag":297,"props":2937,"children":2938},{"style":612},[2939],{"type":45,"value":2940}," FaissStore",{"type":40,"tag":297,"props":2942,"children":2943},{"style":606},[2944],{"type":45,"value":630},{"type":40,"tag":297,"props":2946,"children":2947},{"style":600},[2948],{"type":45,"value":635},{"type":40,"tag":297,"props":2950,"children":2951},{"style":606},[2952],{"type":45,"value":640},{"type":40,"tag":297,"props":2954,"children":2955},{"style":643},[2956],{"type":45,"value":2957},"@langchain\u002Fcommunity\u002Fvectorstores\u002Ffaiss",{"type":40,"tag":297,"props":2959,"children":2960},{"style":606},[2961],{"type":45,"value":651},{"type":40,"tag":297,"props":2963,"children":2964},{"style":606},[2965],{"type":45,"value":656},{"type":40,"tag":297,"props":2967,"children":2968},{"class":299,"line":309},[2969],{"type":40,"tag":297,"props":2970,"children":2971},{"emptyLinePlaceholder":340},[2972],{"type":45,"value":343},{"type":40,"tag":297,"props":2974,"children":2975},{"class":299,"line":318},[2976,2980,2984,2988,2992,2996,3000,3004,3008,3012,3016],{"type":40,"tag":297,"props":2977,"children":2978},{"style":801},[2979],{"type":45,"value":804},{"type":40,"tag":297,"props":2981,"children":2982},{"style":612},[2983],{"type":45,"value":1209},{"type":40,"tag":297,"props":2985,"children":2986},{"style":606},[2987],{"type":45,"value":814},{"type":40,"tag":297,"props":2989,"children":2990},{"style":600},[2991],{"type":45,"value":1092},{"type":40,"tag":297,"props":2993,"children":2994},{"style":612},[2995],{"type":45,"value":2940},{"type":40,"tag":297,"props":2997,"children":2998},{"style":606},[2999],{"type":45,"value":1102},{"type":40,"tag":297,"props":3001,"children":3002},{"style":830},[3003],{"type":45,"value":1230},{"type":40,"tag":297,"props":3005,"children":3006},{"style":612},[3007],{"type":45,"value":1235},{"type":40,"tag":297,"props":3009,"children":3010},{"style":606},[3011],{"type":45,"value":620},{"type":40,"tag":297,"props":3013,"children":3014},{"style":612},[3015],{"type":45,"value":1244},{"type":40,"tag":297,"props":3017,"children":3018},{"style":606},[3019],{"type":45,"value":656},{"type":40,"tag":297,"props":3021,"children":3022},{"class":299,"line":327},[3023,3028,3032,3036,3041,3045,3049,3054,3058,3062],{"type":40,"tag":297,"props":3024,"children":3025},{"style":600},[3026],{"type":45,"value":3027},"await",{"type":40,"tag":297,"props":3029,"children":3030},{"style":612},[3031],{"type":45,"value":1284},{"type":40,"tag":297,"props":3033,"children":3034},{"style":606},[3035],{"type":45,"value":1102},{"type":40,"tag":297,"props":3037,"children":3038},{"style":830},[3039],{"type":45,"value":3040},"save",{"type":40,"tag":297,"props":3042,"children":3043},{"style":612},[3044],{"type":45,"value":837},{"type":40,"tag":297,"props":3046,"children":3047},{"style":606},[3048],{"type":45,"value":651},{"type":40,"tag":297,"props":3050,"children":3051},{"style":643},[3052],{"type":45,"value":3053},".\u002Ffaiss_index",{"type":40,"tag":297,"props":3055,"children":3056},{"style":606},[3057],{"type":45,"value":651},{"type":40,"tag":297,"props":3059,"children":3060},{"style":612},[3061],{"type":45,"value":893},{"type":40,"tag":297,"props":3063,"children":3064},{"style":606},[3065],{"type":45,"value":656},{"type":40,"tag":297,"props":3067,"children":3068},{"class":299,"line":336},[3069],{"type":40,"tag":297,"props":3070,"children":3071},{"emptyLinePlaceholder":340},[3072],{"type":45,"value":343},{"type":40,"tag":297,"props":3074,"children":3075},{"class":299,"line":346},[3076,3080,3085,3089,3093,3097,3101,3105,3109,3113,3117,3121,3125,3129],{"type":40,"tag":297,"props":3077,"children":3078},{"style":801},[3079],{"type":45,"value":804},{"type":40,"tag":297,"props":3081,"children":3082},{"style":612},[3083],{"type":45,"value":3084}," loaded ",{"type":40,"tag":297,"props":3086,"children":3087},{"style":606},[3088],{"type":45,"value":814},{"type":40,"tag":297,"props":3090,"children":3091},{"style":600},[3092],{"type":45,"value":1092},{"type":40,"tag":297,"props":3094,"children":3095},{"style":612},[3096],{"type":45,"value":2940},{"type":40,"tag":297,"props":3098,"children":3099},{"style":606},[3100],{"type":45,"value":1102},{"type":40,"tag":297,"props":3102,"children":3103},{"style":830},[3104],{"type":45,"value":1962},{"type":40,"tag":297,"props":3106,"children":3107},{"style":612},[3108],{"type":45,"value":837},{"type":40,"tag":297,"props":3110,"children":3111},{"style":606},[3112],{"type":45,"value":651},{"type":40,"tag":297,"props":3114,"children":3115},{"style":643},[3116],{"type":45,"value":3053},{"type":40,"tag":297,"props":3118,"children":3119},{"style":606},[3120],{"type":45,"value":651},{"type":40,"tag":297,"props":3122,"children":3123},{"style":606},[3124],{"type":45,"value":620},{"type":40,"tag":297,"props":3126,"children":3127},{"style":612},[3128],{"type":45,"value":1244},{"type":40,"tag":297,"props":3130,"children":3131},{"style":606},[3132],{"type":45,"value":656},{"type":40,"tag":265,"props":3134,"children":3135},{},[],{"type":40,"tag":269,"props":3137,"children":3139},{"id":3138},"retrieval",[3140],{"type":45,"value":3141},"Retrieval",{"type":40,"tag":3143,"props":3144,"children":3145},"ex-similarity-search",{},[3146,3213],{"type":40,"tag":280,"props":3147,"children":3148},{},[3149,3151],{"type":45,"value":3150},"\nPerform similarity search and retrieve results with relevance scores.\n",{"type":40,"tag":286,"props":3152,"children":3154},{"className":288,"code":3153,"language":280,"meta":290,"style":290},"# Basic search\nresults = vectorstore.similarity_search(query, k=5)\n\n# With scores\nresults_with_score = vectorstore.similarity_search_with_score(query, k=5)\nfor doc, score in results_with_score:\n    print(f\"Score: {score}, Content: {doc.page_content}\")\n",[3155],{"type":40,"tag":293,"props":3156,"children":3157},{"__ignoreMap":290},[3158,3166,3174,3181,3189,3197,3205],{"type":40,"tag":297,"props":3159,"children":3160},{"class":299,"line":300},[3161],{"type":40,"tag":297,"props":3162,"children":3163},{},[3164],{"type":45,"value":3165},"# Basic search\n",{"type":40,"tag":297,"props":3167,"children":3168},{"class":299,"line":309},[3169],{"type":40,"tag":297,"props":3170,"children":3171},{},[3172],{"type":45,"value":3173},"results = vectorstore.similarity_search(query, k=5)\n",{"type":40,"tag":297,"props":3175,"children":3176},{"class":299,"line":318},[3177],{"type":40,"tag":297,"props":3178,"children":3179},{"emptyLinePlaceholder":340},[3180],{"type":45,"value":343},{"type":40,"tag":297,"props":3182,"children":3183},{"class":299,"line":327},[3184],{"type":40,"tag":297,"props":3185,"children":3186},{},[3187],{"type":45,"value":3188},"# With scores\n",{"type":40,"tag":297,"props":3190,"children":3191},{"class":299,"line":336},[3192],{"type":40,"tag":297,"props":3193,"children":3194},{},[3195],{"type":45,"value":3196},"results_with_score = vectorstore.similarity_search_with_score(query, k=5)\n",{"type":40,"tag":297,"props":3198,"children":3199},{"class":299,"line":346},[3200],{"type":40,"tag":297,"props":3201,"children":3202},{},[3203],{"type":45,"value":3204},"for doc, score in results_with_score:\n",{"type":40,"tag":297,"props":3206,"children":3207},{"class":299,"line":355},[3208],{"type":40,"tag":297,"props":3209,"children":3210},{},[3211],{"type":45,"value":3212},"    print(f\"Score: {score}, Content: {doc.page_content}\")\n",{"type":40,"tag":583,"props":3214,"children":3215},{},[3216,3217],{"type":45,"value":3150},{"type":40,"tag":286,"props":3218,"children":3220},{"className":589,"code":3219,"language":583,"meta":290,"style":290},"\u002F\u002F Basic search\nconst results = await vectorstore.similaritySearch(query, 5);\n\n\u002F\u002F With scores\nconst resultsWithScore = await vectorstore.similaritySearchWithScore(query, 5);\nfor (const [doc, score] of resultsWithScore) {\n  console.log(`Score: ${score}, Content: ${doc.pageContent}`);\n}\n",[3221],{"type":40,"tag":293,"props":3222,"children":3223},{"__ignoreMap":290},[3224,3232,3287,3294,3302,3355,3409,3485],{"type":40,"tag":297,"props":3225,"children":3226},{"class":299,"line":300},[3227],{"type":40,"tag":297,"props":3228,"children":3229},{"style":792},[3230],{"type":45,"value":3231},"\u002F\u002F Basic search\n",{"type":40,"tag":297,"props":3233,"children":3234},{"class":299,"line":309},[3235,3239,3244,3248,3252,3256,3260,3265,3270,3274,3279,3283],{"type":40,"tag":297,"props":3236,"children":3237},{"style":801},[3238],{"type":45,"value":804},{"type":40,"tag":297,"props":3240,"children":3241},{"style":612},[3242],{"type":45,"value":3243}," results ",{"type":40,"tag":297,"props":3245,"children":3246},{"style":606},[3247],{"type":45,"value":814},{"type":40,"tag":297,"props":3249,"children":3250},{"style":600},[3251],{"type":45,"value":1092},{"type":40,"tag":297,"props":3253,"children":3254},{"style":612},[3255],{"type":45,"value":1284},{"type":40,"tag":297,"props":3257,"children":3258},{"style":606},[3259],{"type":45,"value":1102},{"type":40,"tag":297,"props":3261,"children":3262},{"style":830},[3263],{"type":45,"value":3264},"similaritySearch",{"type":40,"tag":297,"props":3266,"children":3267},{"style":612},[3268],{"type":45,"value":3269},"(query",{"type":40,"tag":297,"props":3271,"children":3272},{"style":606},[3273],{"type":45,"value":620},{"type":40,"tag":297,"props":3275,"children":3276},{"style":1038},[3277],{"type":45,"value":3278}," 5",{"type":40,"tag":297,"props":3280,"children":3281},{"style":612},[3282],{"type":45,"value":893},{"type":40,"tag":297,"props":3284,"children":3285},{"style":606},[3286],{"type":45,"value":656},{"type":40,"tag":297,"props":3288,"children":3289},{"class":299,"line":318},[3290],{"type":40,"tag":297,"props":3291,"children":3292},{"emptyLinePlaceholder":340},[3293],{"type":45,"value":343},{"type":40,"tag":297,"props":3295,"children":3296},{"class":299,"line":327},[3297],{"type":40,"tag":297,"props":3298,"children":3299},{"style":792},[3300],{"type":45,"value":3301},"\u002F\u002F With scores\n",{"type":40,"tag":297,"props":3303,"children":3304},{"class":299,"line":336},[3305,3309,3314,3318,3322,3326,3330,3335,3339,3343,3347,3351],{"type":40,"tag":297,"props":3306,"children":3307},{"style":801},[3308],{"type":45,"value":804},{"type":40,"tag":297,"props":3310,"children":3311},{"style":612},[3312],{"type":45,"value":3313}," resultsWithScore ",{"type":40,"tag":297,"props":3315,"children":3316},{"style":606},[3317],{"type":45,"value":814},{"type":40,"tag":297,"props":3319,"children":3320},{"style":600},[3321],{"type":45,"value":1092},{"type":40,"tag":297,"props":3323,"children":3324},{"style":612},[3325],{"type":45,"value":1284},{"type":40,"tag":297,"props":3327,"children":3328},{"style":606},[3329],{"type":45,"value":1102},{"type":40,"tag":297,"props":3331,"children":3332},{"style":830},[3333],{"type":45,"value":3334},"similaritySearchWithScore",{"type":40,"tag":297,"props":3336,"children":3337},{"style":612},[3338],{"type":45,"value":3269},{"type":40,"tag":297,"props":3340,"children":3341},{"style":606},[3342],{"type":45,"value":620},{"type":40,"tag":297,"props":3344,"children":3345},{"style":1038},[3346],{"type":45,"value":3278},{"type":40,"tag":297,"props":3348,"children":3349},{"style":612},[3350],{"type":45,"value":893},{"type":40,"tag":297,"props":3352,"children":3353},{"style":606},[3354],{"type":45,"value":656},{"type":40,"tag":297,"props":3356,"children":3357},{"class":299,"line":346},[3358,3363,3368,3372,3377,3381,3385,3390,3394,3399,3404],{"type":40,"tag":297,"props":3359,"children":3360},{"style":600},[3361],{"type":45,"value":3362},"for",{"type":40,"tag":297,"props":3364,"children":3365},{"style":612},[3366],{"type":45,"value":3367}," (",{"type":40,"tag":297,"props":3369,"children":3370},{"style":801},[3371],{"type":45,"value":804},{"type":40,"tag":297,"props":3373,"children":3374},{"style":606},[3375],{"type":45,"value":3376}," [",{"type":40,"tag":297,"props":3378,"children":3379},{"style":612},[3380],{"type":45,"value":1530},{"type":40,"tag":297,"props":3382,"children":3383},{"style":606},[3384],{"type":45,"value":620},{"type":40,"tag":297,"props":3386,"children":3387},{"style":612},[3388],{"type":45,"value":3389}," score",{"type":40,"tag":297,"props":3391,"children":3392},{"style":606},[3393],{"type":45,"value":974},{"type":40,"tag":297,"props":3395,"children":3396},{"style":606},[3397],{"type":45,"value":3398}," of",{"type":40,"tag":297,"props":3400,"children":3401},{"style":612},[3402],{"type":45,"value":3403}," resultsWithScore) ",{"type":40,"tag":297,"props":3405,"children":3406},{"style":606},[3407],{"type":45,"value":3408},"{\n",{"type":40,"tag":297,"props":3410,"children":3411},{"class":299,"line":355},[3412,3417,3421,3425,3429,3433,3438,3442,3447,3451,3456,3460,3464,3468,3473,3477,3481],{"type":40,"tag":297,"props":3413,"children":3414},{"style":612},[3415],{"type":45,"value":3416},"  console",{"type":40,"tag":297,"props":3418,"children":3419},{"style":606},[3420],{"type":45,"value":1102},{"type":40,"tag":297,"props":3422,"children":3423},{"style":830},[3424],{"type":45,"value":1988},{"type":40,"tag":297,"props":3426,"children":3427},{"style":845},[3428],{"type":45,"value":837},{"type":40,"tag":297,"props":3430,"children":3431},{"style":606},[3432],{"type":45,"value":1997},{"type":40,"tag":297,"props":3434,"children":3435},{"style":643},[3436],{"type":45,"value":3437},"Score: ",{"type":40,"tag":297,"props":3439,"children":3440},{"style":606},[3441],{"type":45,"value":1682},{"type":40,"tag":297,"props":3443,"children":3444},{"style":612},[3445],{"type":45,"value":3446},"score",{"type":40,"tag":297,"props":3448,"children":3449},{"style":606},[3450],{"type":45,"value":2025},{"type":40,"tag":297,"props":3452,"children":3453},{"style":643},[3454],{"type":45,"value":3455},", Content: ",{"type":40,"tag":297,"props":3457,"children":3458},{"style":606},[3459],{"type":45,"value":1682},{"type":40,"tag":297,"props":3461,"children":3462},{"style":612},[3463],{"type":45,"value":1530},{"type":40,"tag":297,"props":3465,"children":3466},{"style":606},[3467],{"type":45,"value":1102},{"type":40,"tag":297,"props":3469,"children":3470},{"style":612},[3471],{"type":45,"value":3472},"pageContent",{"type":40,"tag":297,"props":3474,"children":3475},{"style":606},[3476],{"type":45,"value":1692},{"type":40,"tag":297,"props":3478,"children":3479},{"style":845},[3480],{"type":45,"value":893},{"type":40,"tag":297,"props":3482,"children":3483},{"style":606},[3484],{"type":45,"value":656},{"type":40,"tag":297,"props":3486,"children":3487},{"class":299,"line":364},[3488],{"type":40,"tag":297,"props":3489,"children":3490},{"style":606},[3491],{"type":45,"value":3492},"}\n",{"type":40,"tag":3494,"props":3495,"children":3496},"ex-mmr-search",{},[3497],{"type":40,"tag":280,"props":3498,"children":3499},{},[3500,3502],{"type":45,"value":3501},"\nUse MMR (Maximal Marginal Relevance) to balance relevance and diversity in search results.\n",{"type":40,"tag":286,"props":3503,"children":3505},{"className":288,"code":3504,"language":280,"meta":290,"style":290},"# MMR balances relevance and diversity\nretriever = vectorstore.as_retriever(\n    search_type=\"mmr\",\n    search_kwargs={\"fetch_k\": 20, \"lambda_mult\": 0.5, \"k\": 5},\n)\n",[3506],{"type":40,"tag":293,"props":3507,"children":3508},{"__ignoreMap":290},[3509,3517,3525,3533,3541],{"type":40,"tag":297,"props":3510,"children":3511},{"class":299,"line":300},[3512],{"type":40,"tag":297,"props":3513,"children":3514},{},[3515],{"type":45,"value":3516},"# MMR balances relevance and diversity\n",{"type":40,"tag":297,"props":3518,"children":3519},{"class":299,"line":309},[3520],{"type":40,"tag":297,"props":3521,"children":3522},{},[3523],{"type":45,"value":3524},"retriever = vectorstore.as_retriever(\n",{"type":40,"tag":297,"props":3526,"children":3527},{"class":299,"line":318},[3528],{"type":40,"tag":297,"props":3529,"children":3530},{},[3531],{"type":45,"value":3532},"    search_type=\"mmr\",\n",{"type":40,"tag":297,"props":3534,"children":3535},{"class":299,"line":327},[3536],{"type":40,"tag":297,"props":3537,"children":3538},{},[3539],{"type":45,"value":3540},"    search_kwargs={\"fetch_k\": 20, \"lambda_mult\": 0.5, \"k\": 5},\n",{"type":40,"tag":297,"props":3542,"children":3543},{"class":299,"line":336},[3544],{"type":40,"tag":297,"props":3545,"children":3546},{},[3547],{"type":45,"value":2314},{"type":40,"tag":3549,"props":3550,"children":3551},"ex-metadata-filtering",{},[3552],{"type":40,"tag":280,"props":3553,"children":3554},{},[3555,3557],{"type":45,"value":3556},"\nAdd metadata to documents and filter search results by metadata properties.\n",{"type":40,"tag":286,"props":3558,"children":3560},{"className":288,"code":3559,"language":280,"meta":290,"style":290},"# Add metadata when creating documents\ndocs = [\n    Document(\n        page_content=\"Python programming guide\",\n        metadata={\"language\": \"python\", \"topic\": \"programming\"}\n    ),\n]\n\n# Search with filter\nresults = vectorstore.similarity_search(\n    \"programming\",\n    k=5,\n    filter={\"language\": \"python\"}  # Only Python docs\n)\n",[3561],{"type":40,"tag":293,"props":3562,"children":3563},{"__ignoreMap":290},[3564,3572,3579,3587,3595,3603,3611,3618,3625,3633,3641,3649,3657,3665],{"type":40,"tag":297,"props":3565,"children":3566},{"class":299,"line":300},[3567],{"type":40,"tag":297,"props":3568,"children":3569},{},[3570],{"type":45,"value":3571},"# Add metadata when creating documents\n",{"type":40,"tag":297,"props":3573,"children":3574},{"class":299,"line":309},[3575],{"type":40,"tag":297,"props":3576,"children":3577},{},[3578],{"type":45,"value":361},{"type":40,"tag":297,"props":3580,"children":3581},{"class":299,"line":318},[3582],{"type":40,"tag":297,"props":3583,"children":3584},{},[3585],{"type":45,"value":3586},"    Document(\n",{"type":40,"tag":297,"props":3588,"children":3589},{"class":299,"line":327},[3590],{"type":40,"tag":297,"props":3591,"children":3592},{},[3593],{"type":45,"value":3594},"        page_content=\"Python programming guide\",\n",{"type":40,"tag":297,"props":3596,"children":3597},{"class":299,"line":336},[3598],{"type":40,"tag":297,"props":3599,"children":3600},{},[3601],{"type":45,"value":3602},"        metadata={\"language\": \"python\", \"topic\": \"programming\"}\n",{"type":40,"tag":297,"props":3604,"children":3605},{"class":299,"line":346},[3606],{"type":40,"tag":297,"props":3607,"children":3608},{},[3609],{"type":45,"value":3610},"    ),\n",{"type":40,"tag":297,"props":3612,"children":3613},{"class":299,"line":355},[3614],{"type":40,"tag":297,"props":3615,"children":3616},{},[3617],{"type":45,"value":388},{"type":40,"tag":297,"props":3619,"children":3620},{"class":299,"line":364},[3621],{"type":40,"tag":297,"props":3622,"children":3623},{"emptyLinePlaceholder":340},[3624],{"type":45,"value":343},{"type":40,"tag":297,"props":3626,"children":3627},{"class":299,"line":373},[3628],{"type":40,"tag":297,"props":3629,"children":3630},{},[3631],{"type":45,"value":3632},"# Search with filter\n",{"type":40,"tag":297,"props":3634,"children":3635},{"class":299,"line":382},[3636],{"type":40,"tag":297,"props":3637,"children":3638},{},[3639],{"type":45,"value":3640},"results = vectorstore.similarity_search(\n",{"type":40,"tag":297,"props":3642,"children":3643},{"class":299,"line":391},[3644],{"type":40,"tag":297,"props":3645,"children":3646},{},[3647],{"type":45,"value":3648},"    \"programming\",\n",{"type":40,"tag":297,"props":3650,"children":3651},{"class":299,"line":399},[3652],{"type":40,"tag":297,"props":3653,"children":3654},{},[3655],{"type":45,"value":3656},"    k=5,\n",{"type":40,"tag":297,"props":3658,"children":3659},{"class":299,"line":408},[3660],{"type":40,"tag":297,"props":3661,"children":3662},{},[3663],{"type":45,"value":3664},"    filter={\"language\": \"python\"}  # Only Python docs\n",{"type":40,"tag":297,"props":3666,"children":3667},{"class":299,"line":417},[3668],{"type":40,"tag":297,"props":3669,"children":3670},{},[3671],{"type":45,"value":2314},{"type":40,"tag":3673,"props":3674,"children":3675},"ex-rag-with-agent",{},[3676,3820],{"type":40,"tag":280,"props":3677,"children":3678},{},[3679,3681],{"type":45,"value":3680},"\nCreate an agent that uses RAG as a tool for answering questions.\n",{"type":40,"tag":286,"props":3682,"children":3684},{"className":288,"code":3683,"language":280,"meta":290,"style":290},"from langchain.agents import create_agent\nfrom langchain.tools import tool\n\n@tool\ndef search_docs(query: str) -> str:\n    \"\"\"Search documentation for relevant information.\"\"\"\n    docs = retriever.invoke(query)\n    return \"\\n\\n\".join([d.page_content for d in docs])\n\nagent = create_agent(\n    model=\"gpt-4.1\",\n    tools=[search_docs],\n)\n\nresult = agent.invoke({\n    \"messages\": [{\"role\": \"user\", \"content\": \"How do I create an agent?\"}]\n})\n",[3685],{"type":40,"tag":293,"props":3686,"children":3687},{"__ignoreMap":290},[3688,3696,3704,3711,3719,3727,3735,3743,3751,3758,3766,3774,3782,3789,3796,3804,3812],{"type":40,"tag":297,"props":3689,"children":3690},{"class":299,"line":300},[3691],{"type":40,"tag":297,"props":3692,"children":3693},{},[3694],{"type":45,"value":3695},"from langchain.agents import create_agent\n",{"type":40,"tag":297,"props":3697,"children":3698},{"class":299,"line":309},[3699],{"type":40,"tag":297,"props":3700,"children":3701},{},[3702],{"type":45,"value":3703},"from langchain.tools import tool\n",{"type":40,"tag":297,"props":3705,"children":3706},{"class":299,"line":318},[3707],{"type":40,"tag":297,"props":3708,"children":3709},{"emptyLinePlaceholder":340},[3710],{"type":45,"value":343},{"type":40,"tag":297,"props":3712,"children":3713},{"class":299,"line":327},[3714],{"type":40,"tag":297,"props":3715,"children":3716},{},[3717],{"type":45,"value":3718},"@tool\n",{"type":40,"tag":297,"props":3720,"children":3721},{"class":299,"line":336},[3722],{"type":40,"tag":297,"props":3723,"children":3724},{},[3725],{"type":45,"value":3726},"def search_docs(query: str) -> str:\n",{"type":40,"tag":297,"props":3728,"children":3729},{"class":299,"line":346},[3730],{"type":40,"tag":297,"props":3731,"children":3732},{},[3733],{"type":45,"value":3734},"    \"\"\"Search documentation for relevant information.\"\"\"\n",{"type":40,"tag":297,"props":3736,"children":3737},{"class":299,"line":355},[3738],{"type":40,"tag":297,"props":3739,"children":3740},{},[3741],{"type":45,"value":3742},"    docs = retriever.invoke(query)\n",{"type":40,"tag":297,"props":3744,"children":3745},{"class":299,"line":364},[3746],{"type":40,"tag":297,"props":3747,"children":3748},{},[3749],{"type":45,"value":3750},"    return \"\\n\\n\".join([d.page_content for d in docs])\n",{"type":40,"tag":297,"props":3752,"children":3753},{"class":299,"line":373},[3754],{"type":40,"tag":297,"props":3755,"children":3756},{"emptyLinePlaceholder":340},[3757],{"type":45,"value":343},{"type":40,"tag":297,"props":3759,"children":3760},{"class":299,"line":382},[3761],{"type":40,"tag":297,"props":3762,"children":3763},{},[3764],{"type":45,"value":3765},"agent = create_agent(\n",{"type":40,"tag":297,"props":3767,"children":3768},{"class":299,"line":391},[3769],{"type":40,"tag":297,"props":3770,"children":3771},{},[3772],{"type":45,"value":3773},"    model=\"gpt-4.1\",\n",{"type":40,"tag":297,"props":3775,"children":3776},{"class":299,"line":399},[3777],{"type":40,"tag":297,"props":3778,"children":3779},{},[3780],{"type":45,"value":3781},"    tools=[search_docs],\n",{"type":40,"tag":297,"props":3783,"children":3784},{"class":299,"line":408},[3785],{"type":40,"tag":297,"props":3786,"children":3787},{},[3788],{"type":45,"value":2314},{"type":40,"tag":297,"props":3790,"children":3791},{"class":299,"line":417},[3792],{"type":40,"tag":297,"props":3793,"children":3794},{"emptyLinePlaceholder":340},[3795],{"type":45,"value":343},{"type":40,"tag":297,"props":3797,"children":3798},{"class":299,"line":426},[3799],{"type":40,"tag":297,"props":3800,"children":3801},{},[3802],{"type":45,"value":3803},"result = agent.invoke({\n",{"type":40,"tag":297,"props":3805,"children":3806},{"class":299,"line":434},[3807],{"type":40,"tag":297,"props":3808,"children":3809},{},[3810],{"type":45,"value":3811},"    \"messages\": [{\"role\": \"user\", \"content\": \"How do I create an agent?\"}]\n",{"type":40,"tag":297,"props":3813,"children":3814},{"class":299,"line":443},[3815],{"type":40,"tag":297,"props":3816,"children":3817},{},[3818],{"type":45,"value":3819},"})\n",{"type":40,"tag":583,"props":3821,"children":3822},{},[3823,3824],{"type":45,"value":3680},{"type":40,"tag":286,"props":3825,"children":3827},{"className":589,"code":3826,"language":583,"meta":290,"style":290},"import { createAgent } from \"langchain\";\nimport { tool } from \"@langchain\u002Fcore\u002Ftools\";\nimport { z } from \"zod\";\n\nconst searchDocs = tool(\n  async (input) => {\n    const docs = await retriever.invoke(input.query);\n    return docs.map(d => d.pageContent).join(\"\\n\\n\");\n  },\n  {\n    name: \"search_docs\",\n    description: \"Search documentation for relevant information.\",\n    schema: z.object({ query: z.string() }),\n  }\n);\n\nconst agent = createAgent({\n  model: \"gpt-4.1\",\n  tools: [searchDocs],\n});\n\nconst result = await agent.invoke({\n  messages: [{ role: \"user\", content: \"How do I create an agent?\" }],\n});\n",[3828],{"type":40,"tag":293,"props":3829,"children":3830},{"__ignoreMap":290},[3831,3871,3912,3953,3960,3984,4014,4073,4155,4163,4171,4200,4229,4301,4309,4320,4327,4355,4383,4404,4419,4426,4467,4544],{"type":40,"tag":297,"props":3832,"children":3833},{"class":299,"line":300},[3834,3838,3842,3847,3851,3855,3859,3863,3867],{"type":40,"tag":297,"props":3835,"children":3836},{"style":600},[3837],{"type":45,"value":603},{"type":40,"tag":297,"props":3839,"children":3840},{"style":606},[3841],{"type":45,"value":609},{"type":40,"tag":297,"props":3843,"children":3844},{"style":612},[3845],{"type":45,"value":3846}," createAgent",{"type":40,"tag":297,"props":3848,"children":3849},{"style":606},[3850],{"type":45,"value":630},{"type":40,"tag":297,"props":3852,"children":3853},{"style":600},[3854],{"type":45,"value":635},{"type":40,"tag":297,"props":3856,"children":3857},{"style":606},[3858],{"type":45,"value":640},{"type":40,"tag":297,"props":3860,"children":3861},{"style":643},[3862],{"type":45,"value":8},{"type":40,"tag":297,"props":3864,"children":3865},{"style":606},[3866],{"type":45,"value":651},{"type":40,"tag":297,"props":3868,"children":3869},{"style":606},[3870],{"type":45,"value":656},{"type":40,"tag":297,"props":3872,"children":3873},{"class":299,"line":309},[3874,3878,3882,3887,3891,3895,3899,3904,3908],{"type":40,"tag":297,"props":3875,"children":3876},{"style":600},[3877],{"type":45,"value":603},{"type":40,"tag":297,"props":3879,"children":3880},{"style":606},[3881],{"type":45,"value":609},{"type":40,"tag":297,"props":3883,"children":3884},{"style":612},[3885],{"type":45,"value":3886}," tool",{"type":40,"tag":297,"props":3888,"children":3889},{"style":606},[3890],{"type":45,"value":630},{"type":40,"tag":297,"props":3892,"children":3893},{"style":600},[3894],{"type":45,"value":635},{"type":40,"tag":297,"props":3896,"children":3897},{"style":606},[3898],{"type":45,"value":640},{"type":40,"tag":297,"props":3900,"children":3901},{"style":643},[3902],{"type":45,"value":3903},"@langchain\u002Fcore\u002Ftools",{"type":40,"tag":297,"props":3905,"children":3906},{"style":606},[3907],{"type":45,"value":651},{"type":40,"tag":297,"props":3909,"children":3910},{"style":606},[3911],{"type":45,"value":656},{"type":40,"tag":297,"props":3913,"children":3914},{"class":299,"line":318},[3915,3919,3923,3928,3932,3936,3940,3945,3949],{"type":40,"tag":297,"props":3916,"children":3917},{"style":600},[3918],{"type":45,"value":603},{"type":40,"tag":297,"props":3920,"children":3921},{"style":606},[3922],{"type":45,"value":609},{"type":40,"tag":297,"props":3924,"children":3925},{"style":612},[3926],{"type":45,"value":3927}," z",{"type":40,"tag":297,"props":3929,"children":3930},{"style":606},[3931],{"type":45,"value":630},{"type":40,"tag":297,"props":3933,"children":3934},{"style":600},[3935],{"type":45,"value":635},{"type":40,"tag":297,"props":3937,"children":3938},{"style":606},[3939],{"type":45,"value":640},{"type":40,"tag":297,"props":3941,"children":3942},{"style":643},[3943],{"type":45,"value":3944},"zod",{"type":40,"tag":297,"props":3946,"children":3947},{"style":606},[3948],{"type":45,"value":651},{"type":40,"tag":297,"props":3950,"children":3951},{"style":606},[3952],{"type":45,"value":656},{"type":40,"tag":297,"props":3954,"children":3955},{"class":299,"line":327},[3956],{"type":40,"tag":297,"props":3957,"children":3958},{"emptyLinePlaceholder":340},[3959],{"type":45,"value":343},{"type":40,"tag":297,"props":3961,"children":3962},{"class":299,"line":336},[3963,3967,3972,3976,3980],{"type":40,"tag":297,"props":3964,"children":3965},{"style":801},[3966],{"type":45,"value":804},{"type":40,"tag":297,"props":3968,"children":3969},{"style":612},[3970],{"type":45,"value":3971}," searchDocs ",{"type":40,"tag":297,"props":3973,"children":3974},{"style":606},[3975],{"type":45,"value":814},{"type":40,"tag":297,"props":3977,"children":3978},{"style":830},[3979],{"type":45,"value":3886},{"type":40,"tag":297,"props":3981,"children":3982},{"style":612},[3983],{"type":45,"value":2694},{"type":40,"tag":297,"props":3985,"children":3986},{"class":299,"line":346},[3987,3992,3996,4001,4005,4009],{"type":40,"tag":297,"props":3988,"children":3989},{"style":801},[3990],{"type":45,"value":3991},"  async",{"type":40,"tag":297,"props":3993,"children":3994},{"style":606},[3995],{"type":45,"value":3367},{"type":40,"tag":297,"props":3997,"children":3998},{"style":1527},[3999],{"type":45,"value":4000},"input",{"type":40,"tag":297,"props":4002,"children":4003},{"style":606},[4004],{"type":45,"value":893},{"type":40,"tag":297,"props":4006,"children":4007},{"style":801},[4008],{"type":45,"value":1535},{"type":40,"tag":297,"props":4010,"children":4011},{"style":606},[4012],{"type":45,"value":4013}," {\n",{"type":40,"tag":297,"props":4015,"children":4016},{"class":299,"line":355},[4017,4022,4027,4032,4036,4040,4044,4048,4052,4056,4060,4065,4069],{"type":40,"tag":297,"props":4018,"children":4019},{"style":801},[4020],{"type":45,"value":4021},"    const",{"type":40,"tag":297,"props":4023,"children":4024},{"style":612},[4025],{"type":45,"value":4026}," docs",{"type":40,"tag":297,"props":4028,"children":4029},{"style":606},[4030],{"type":45,"value":4031}," =",{"type":40,"tag":297,"props":4033,"children":4034},{"style":600},[4035],{"type":45,"value":1092},{"type":40,"tag":297,"props":4037,"children":4038},{"style":612},[4039],{"type":45,"value":1465},{"type":40,"tag":297,"props":4041,"children":4042},{"style":606},[4043],{"type":45,"value":1102},{"type":40,"tag":297,"props":4045,"children":4046},{"style":830},[4047],{"type":45,"value":1474},{"type":40,"tag":297,"props":4049,"children":4050},{"style":845},[4051],{"type":45,"value":837},{"type":40,"tag":297,"props":4053,"children":4054},{"style":612},[4055],{"type":45,"value":4000},{"type":40,"tag":297,"props":4057,"children":4058},{"style":606},[4059],{"type":45,"value":1102},{"type":40,"tag":297,"props":4061,"children":4062},{"style":612},[4063],{"type":45,"value":4064},"query",{"type":40,"tag":297,"props":4066,"children":4067},{"style":845},[4068],{"type":45,"value":893},{"type":40,"tag":297,"props":4070,"children":4071},{"style":606},[4072],{"type":45,"value":656},{"type":40,"tag":297,"props":4074,"children":4075},{"class":299,"line":364},[4076,4081,4085,4089,4093,4097,4102,4106,4111,4115,4119,4123,4127,4131,4135,4139,4143,4147,4151],{"type":40,"tag":297,"props":4077,"children":4078},{"style":600},[4079],{"type":45,"value":4080},"    return",{"type":40,"tag":297,"props":4082,"children":4083},{"style":612},[4084],{"type":45,"value":4026},{"type":40,"tag":297,"props":4086,"children":4087},{"style":606},[4088],{"type":45,"value":1102},{"type":40,"tag":297,"props":4090,"children":4091},{"style":830},[4092],{"type":45,"value":1520},{"type":40,"tag":297,"props":4094,"children":4095},{"style":845},[4096],{"type":45,"value":837},{"type":40,"tag":297,"props":4098,"children":4099},{"style":1527},[4100],{"type":45,"value":4101},"d",{"type":40,"tag":297,"props":4103,"children":4104},{"style":801},[4105],{"type":45,"value":1535},{"type":40,"tag":297,"props":4107,"children":4108},{"style":612},[4109],{"type":45,"value":4110}," d",{"type":40,"tag":297,"props":4112,"children":4113},{"style":606},[4114],{"type":45,"value":1102},{"type":40,"tag":297,"props":4116,"children":4117},{"style":612},[4118],{"type":45,"value":3472},{"type":40,"tag":297,"props":4120,"children":4121},{"style":845},[4122],{"type":45,"value":893},{"type":40,"tag":297,"props":4124,"children":4125},{"style":606},[4126],{"type":45,"value":1102},{"type":40,"tag":297,"props":4128,"children":4129},{"style":830},[4130],{"type":45,"value":1558},{"type":40,"tag":297,"props":4132,"children":4133},{"style":845},[4134],{"type":45,"value":837},{"type":40,"tag":297,"props":4136,"children":4137},{"style":606},[4138],{"type":45,"value":651},{"type":40,"tag":297,"props":4140,"children":4141},{"style":612},[4142],{"type":45,"value":1571},{"type":40,"tag":297,"props":4144,"children":4145},{"style":606},[4146],{"type":45,"value":651},{"type":40,"tag":297,"props":4148,"children":4149},{"style":845},[4150],{"type":45,"value":893},{"type":40,"tag":297,"props":4152,"children":4153},{"style":606},[4154],{"type":45,"value":656},{"type":40,"tag":297,"props":4156,"children":4157},{"class":299,"line":373},[4158],{"type":40,"tag":297,"props":4159,"children":4160},{"style":606},[4161],{"type":45,"value":4162},"  },\n",{"type":40,"tag":297,"props":4164,"children":4165},{"class":299,"line":382},[4166],{"type":40,"tag":297,"props":4167,"children":4168},{"style":606},[4169],{"type":45,"value":4170},"  {\n",{"type":40,"tag":297,"props":4172,"children":4173},{"class":299,"line":391},[4174,4179,4183,4187,4192,4196],{"type":40,"tag":297,"props":4175,"children":4176},{"style":845},[4177],{"type":45,"value":4178},"    name",{"type":40,"tag":297,"props":4180,"children":4181},{"style":606},[4182],{"type":45,"value":853},{"type":40,"tag":297,"props":4184,"children":4185},{"style":606},[4186],{"type":45,"value":640},{"type":40,"tag":297,"props":4188,"children":4189},{"style":643},[4190],{"type":45,"value":4191},"search_docs",{"type":40,"tag":297,"props":4193,"children":4194},{"style":606},[4195],{"type":45,"value":651},{"type":40,"tag":297,"props":4197,"children":4198},{"style":606},[4199],{"type":45,"value":898},{"type":40,"tag":297,"props":4201,"children":4202},{"class":299,"line":399},[4203,4208,4212,4216,4221,4225],{"type":40,"tag":297,"props":4204,"children":4205},{"style":845},[4206],{"type":45,"value":4207},"    description",{"type":40,"tag":297,"props":4209,"children":4210},{"style":606},[4211],{"type":45,"value":853},{"type":40,"tag":297,"props":4213,"children":4214},{"style":606},[4215],{"type":45,"value":640},{"type":40,"tag":297,"props":4217,"children":4218},{"style":643},[4219],{"type":45,"value":4220},"Search documentation for relevant information.",{"type":40,"tag":297,"props":4222,"children":4223},{"style":606},[4224],{"type":45,"value":651},{"type":40,"tag":297,"props":4226,"children":4227},{"style":606},[4228],{"type":45,"value":898},{"type":40,"tag":297,"props":4230,"children":4231},{"class":299,"line":408},[4232,4237,4241,4245,4249,4254,4258,4262,4267,4271,4275,4279,4284,4289,4293,4297],{"type":40,"tag":297,"props":4233,"children":4234},{"style":845},[4235],{"type":45,"value":4236},"    schema",{"type":40,"tag":297,"props":4238,"children":4239},{"style":606},[4240],{"type":45,"value":853},{"type":40,"tag":297,"props":4242,"children":4243},{"style":612},[4244],{"type":45,"value":3927},{"type":40,"tag":297,"props":4246,"children":4247},{"style":606},[4248],{"type":45,"value":1102},{"type":40,"tag":297,"props":4250,"children":4251},{"style":830},[4252],{"type":45,"value":4253},"object",{"type":40,"tag":297,"props":4255,"children":4256},{"style":612},[4257],{"type":45,"value":837},{"type":40,"tag":297,"props":4259,"children":4260},{"style":606},[4261],{"type":45,"value":842},{"type":40,"tag":297,"props":4263,"children":4264},{"style":845},[4265],{"type":45,"value":4266}," query",{"type":40,"tag":297,"props":4268,"children":4269},{"style":606},[4270],{"type":45,"value":853},{"type":40,"tag":297,"props":4272,"children":4273},{"style":612},[4274],{"type":45,"value":3927},{"type":40,"tag":297,"props":4276,"children":4277},{"style":606},[4278],{"type":45,"value":1102},{"type":40,"tag":297,"props":4280,"children":4281},{"style":830},[4282],{"type":45,"value":4283},"string",{"type":40,"tag":297,"props":4285,"children":4286},{"style":612},[4287],{"type":45,"value":4288},"() ",{"type":40,"tag":297,"props":4290,"children":4291},{"style":606},[4292],{"type":45,"value":2025},{"type":40,"tag":297,"props":4294,"children":4295},{"style":612},[4296],{"type":45,"value":893},{"type":40,"tag":297,"props":4298,"children":4299},{"style":606},[4300],{"type":45,"value":898},{"type":40,"tag":297,"props":4302,"children":4303},{"class":299,"line":417},[4304],{"type":40,"tag":297,"props":4305,"children":4306},{"style":606},[4307],{"type":45,"value":4308},"  }\n",{"type":40,"tag":297,"props":4310,"children":4311},{"class":299,"line":426},[4312,4316],{"type":40,"tag":297,"props":4313,"children":4314},{"style":612},[4315],{"type":45,"value":893},{"type":40,"tag":297,"props":4317,"children":4318},{"style":606},[4319],{"type":45,"value":656},{"type":40,"tag":297,"props":4321,"children":4322},{"class":299,"line":434},[4323],{"type":40,"tag":297,"props":4324,"children":4325},{"emptyLinePlaceholder":340},[4326],{"type":45,"value":343},{"type":40,"tag":297,"props":4328,"children":4329},{"class":299,"line":443},[4330,4334,4339,4343,4347,4351],{"type":40,"tag":297,"props":4331,"children":4332},{"style":801},[4333],{"type":45,"value":804},{"type":40,"tag":297,"props":4335,"children":4336},{"style":612},[4337],{"type":45,"value":4338}," agent ",{"type":40,"tag":297,"props":4340,"children":4341},{"style":606},[4342],{"type":45,"value":814},{"type":40,"tag":297,"props":4344,"children":4345},{"style":830},[4346],{"type":45,"value":3846},{"type":40,"tag":297,"props":4348,"children":4349},{"style":612},[4350],{"type":45,"value":837},{"type":40,"tag":297,"props":4352,"children":4353},{"style":606},[4354],{"type":45,"value":3408},{"type":40,"tag":297,"props":4356,"children":4357},{"class":299,"line":452},[4358,4363,4367,4371,4375,4379],{"type":40,"tag":297,"props":4359,"children":4360},{"style":845},[4361],{"type":45,"value":4362},"  model",{"type":40,"tag":297,"props":4364,"children":4365},{"style":606},[4366],{"type":45,"value":853},{"type":40,"tag":297,"props":4368,"children":4369},{"style":606},[4370],{"type":45,"value":640},{"type":40,"tag":297,"props":4372,"children":4373},{"style":643},[4374],{"type":45,"value":1391},{"type":40,"tag":297,"props":4376,"children":4377},{"style":606},[4378],{"type":45,"value":651},{"type":40,"tag":297,"props":4380,"children":4381},{"style":606},[4382],{"type":45,"value":898},{"type":40,"tag":297,"props":4384,"children":4385},{"class":299,"line":461},[4386,4391,4395,4400],{"type":40,"tag":297,"props":4387,"children":4388},{"style":845},[4389],{"type":45,"value":4390},"  tools",{"type":40,"tag":297,"props":4392,"children":4393},{"style":606},[4394],{"type":45,"value":853},{"type":40,"tag":297,"props":4396,"children":4397},{"style":612},[4398],{"type":45,"value":4399}," [searchDocs]",{"type":40,"tag":297,"props":4401,"children":4402},{"style":606},[4403],{"type":45,"value":898},{"type":40,"tag":297,"props":4405,"children":4406},{"class":299,"line":469},[4407,4411,4415],{"type":40,"tag":297,"props":4408,"children":4409},{"style":606},[4410],{"type":45,"value":2025},{"type":40,"tag":297,"props":4412,"children":4413},{"style":612},[4414],{"type":45,"value":893},{"type":40,"tag":297,"props":4416,"children":4417},{"style":606},[4418],{"type":45,"value":656},{"type":40,"tag":297,"props":4420,"children":4421},{"class":299,"line":478},[4422],{"type":40,"tag":297,"props":4423,"children":4424},{"emptyLinePlaceholder":340},[4425],{"type":45,"value":343},{"type":40,"tag":297,"props":4427,"children":4428},{"class":299,"line":487},[4429,4433,4438,4442,4446,4451,4455,4459,4463],{"type":40,"tag":297,"props":4430,"children":4431},{"style":801},[4432],{"type":45,"value":804},{"type":40,"tag":297,"props":4434,"children":4435},{"style":612},[4436],{"type":45,"value":4437}," result ",{"type":40,"tag":297,"props":4439,"children":4440},{"style":606},[4441],{"type":45,"value":814},{"type":40,"tag":297,"props":4443,"children":4444},{"style":600},[4445],{"type":45,"value":1092},{"type":40,"tag":297,"props":4447,"children":4448},{"style":612},[4449],{"type":45,"value":4450}," agent",{"type":40,"tag":297,"props":4452,"children":4453},{"style":606},[4454],{"type":45,"value":1102},{"type":40,"tag":297,"props":4456,"children":4457},{"style":830},[4458],{"type":45,"value":1474},{"type":40,"tag":297,"props":4460,"children":4461},{"style":612},[4462],{"type":45,"value":837},{"type":40,"tag":297,"props":4464,"children":4465},{"style":606},[4466],{"type":45,"value":3408},{"type":40,"tag":297,"props":4468,"children":4469},{"class":299,"line":495},[4470,4475,4479,4483,4487,4491,4495,4499,4503,4507,4511,4515,4519,4523,4528,4532,4536,4540],{"type":40,"tag":297,"props":4471,"children":4472},{"style":845},[4473],{"type":45,"value":4474},"  messages",{"type":40,"tag":297,"props":4476,"children":4477},{"style":606},[4478],{"type":45,"value":853},{"type":40,"tag":297,"props":4480,"children":4481},{"style":612},[4482],{"type":45,"value":3376},{"type":40,"tag":297,"props":4484,"children":4485},{"style":606},[4486],{"type":45,"value":842},{"type":40,"tag":297,"props":4488,"children":4489},{"style":845},[4490],{"type":45,"value":1633},{"type":40,"tag":297,"props":4492,"children":4493},{"style":606},[4494],{"type":45,"value":853},{"type":40,"tag":297,"props":4496,"children":4497},{"style":606},[4498],{"type":45,"value":640},{"type":40,"tag":297,"props":4500,"children":4501},{"style":643},[4502],{"type":45,"value":1721},{"type":40,"tag":297,"props":4504,"children":4505},{"style":606},[4506],{"type":45,"value":651},{"type":40,"tag":297,"props":4508,"children":4509},{"style":606},[4510],{"type":45,"value":620},{"type":40,"tag":297,"props":4512,"children":4513},{"style":845},[4514],{"type":45,"value":1659},{"type":40,"tag":297,"props":4516,"children":4517},{"style":606},[4518],{"type":45,"value":853},{"type":40,"tag":297,"props":4520,"children":4521},{"style":606},[4522],{"type":45,"value":640},{"type":40,"tag":297,"props":4524,"children":4525},{"style":643},[4526],{"type":45,"value":4527},"How do I create an agent?",{"type":40,"tag":297,"props":4529,"children":4530},{"style":606},[4531],{"type":45,"value":651},{"type":40,"tag":297,"props":4533,"children":4534},{"style":606},[4535],{"type":45,"value":630},{"type":40,"tag":297,"props":4537,"children":4538},{"style":612},[4539],{"type":45,"value":974},{"type":40,"tag":297,"props":4541,"children":4542},{"style":606},[4543],{"type":45,"value":898},{"type":40,"tag":297,"props":4545,"children":4546},{"class":299,"line":504},[4547,4551,4555],{"type":40,"tag":297,"props":4548,"children":4549},{"style":606},[4550],{"type":45,"value":2025},{"type":40,"tag":297,"props":4552,"children":4553},{"style":612},[4554],{"type":45,"value":893},{"type":40,"tag":297,"props":4556,"children":4557},{"style":606},[4558],{"type":45,"value":656},{"type":40,"tag":4560,"props":4561,"children":4562},"boundaries",{},[4563,4565,4593,4600,4613,4838,4892,5111,5351],{"type":45,"value":4564},"\n### What You CAN Configure\n",{"type":40,"tag":101,"props":4566,"children":4567},{},[4568,4573,4578,4583,4588],{"type":40,"tag":62,"props":4569,"children":4570},{},[4571],{"type":45,"value":4572},"Chunk size\u002Foverlap",{"type":40,"tag":62,"props":4574,"children":4575},{},[4576],{"type":45,"value":4577},"Embedding model",{"type":40,"tag":62,"props":4579,"children":4580},{},[4581],{"type":45,"value":4582},"Number of results (k)",{"type":40,"tag":62,"props":4584,"children":4585},{},[4586],{"type":45,"value":4587},"Metadata filters",{"type":40,"tag":62,"props":4589,"children":4590},{},[4591],{"type":45,"value":4592},"Search algorithms: Similarity, MMR",{"type":40,"tag":4594,"props":4595,"children":4597},"h3",{"id":4596},"what-you-cannot-configure",[4598],{"type":45,"value":4599},"What You CANNOT Configure",{"type":40,"tag":101,"props":4601,"children":4602},{},[4603,4608],{"type":40,"tag":62,"props":4604,"children":4605},{},[4606],{"type":45,"value":4607},"Embedding dimensions (per model)",{"type":40,"tag":62,"props":4609,"children":4610},{},[4611],{"type":45,"value":4612},"Mix embeddings from different models in same store\n\n",{"type":40,"tag":4614,"props":4615,"children":4616},"fix-chunk-size",{},[4617,4676],{"type":40,"tag":280,"props":4618,"children":4619},{},[4620,4622],{"type":45,"value":4621},"\nChunk size 500-1500 is typically good.\n",{"type":40,"tag":286,"props":4623,"children":4625},{"className":288,"code":4624,"language":280,"meta":290,"style":290},"# WRONG: Too small (loses context) or too large (hits limits)\nsplitter = RecursiveCharacterTextSplitter(chunk_size=50)\nsplitter = RecursiveCharacterTextSplitter(chunk_size=10000)\n\n# CORRECT\nsplitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)\n",[4626],{"type":40,"tag":293,"props":4627,"children":4628},{"__ignoreMap":290},[4629,4637,4645,4653,4660,4668],{"type":40,"tag":297,"props":4630,"children":4631},{"class":299,"line":300},[4632],{"type":40,"tag":297,"props":4633,"children":4634},{},[4635],{"type":45,"value":4636},"# WRONG: Too small (loses context) or too large (hits limits)\n",{"type":40,"tag":297,"props":4638,"children":4639},{"class":299,"line":309},[4640],{"type":40,"tag":297,"props":4641,"children":4642},{},[4643],{"type":45,"value":4644},"splitter = RecursiveCharacterTextSplitter(chunk_size=50)\n",{"type":40,"tag":297,"props":4646,"children":4647},{"class":299,"line":318},[4648],{"type":40,"tag":297,"props":4649,"children":4650},{},[4651],{"type":45,"value":4652},"splitter = RecursiveCharacterTextSplitter(chunk_size=10000)\n",{"type":40,"tag":297,"props":4654,"children":4655},{"class":299,"line":327},[4656],{"type":40,"tag":297,"props":4657,"children":4658},{"emptyLinePlaceholder":340},[4659],{"type":45,"value":343},{"type":40,"tag":297,"props":4661,"children":4662},{"class":299,"line":336},[4663],{"type":40,"tag":297,"props":4664,"children":4665},{},[4666],{"type":45,"value":4667},"# CORRECT\n",{"type":40,"tag":297,"props":4669,"children":4670},{"class":299,"line":346},[4671],{"type":40,"tag":297,"props":4672,"children":4673},{},[4674],{"type":45,"value":4675},"splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)\n",{"type":40,"tag":583,"props":4677,"children":4678},{},[4679,4680],{"type":45,"value":4621},{"type":40,"tag":286,"props":4681,"children":4683},{"className":589,"code":4682,"language":583,"meta":290,"style":290},"\u002F\u002F WRONG: Too small or too large\nconst splitter = new RecursiveCharacterTextSplitter({ chunkSize: 50 });\n\n\u002F\u002F CORRECT\nconst splitter = new RecursiveCharacterTextSplitter({ chunkSize: 1000, chunkOverlap: 200 });\n",[4684],{"type":40,"tag":293,"props":4685,"children":4686},{"__ignoreMap":290},[4687,4695,4750,4757,4765],{"type":40,"tag":297,"props":4688,"children":4689},{"class":299,"line":300},[4690],{"type":40,"tag":297,"props":4691,"children":4692},{"style":792},[4693],{"type":45,"value":4694},"\u002F\u002F WRONG: Too small or too large\n",{"type":40,"tag":297,"props":4696,"children":4697},{"class":299,"line":309},[4698,4702,4706,4710,4714,4718,4722,4726,4730,4734,4738,4742,4746],{"type":40,"tag":297,"props":4699,"children":4700},{"style":801},[4701],{"type":45,"value":804},{"type":40,"tag":297,"props":4703,"children":4704},{"style":612},[4705],{"type":45,"value":1005},{"type":40,"tag":297,"props":4707,"children":4708},{"style":606},[4709],{"type":45,"value":814},{"type":40,"tag":297,"props":4711,"children":4712},{"style":606},[4713],{"type":45,"value":1014},{"type":40,"tag":297,"props":4715,"children":4716},{"style":830},[4717],{"type":45,"value":713},{"type":40,"tag":297,"props":4719,"children":4720},{"style":612},[4721],{"type":45,"value":837},{"type":40,"tag":297,"props":4723,"children":4724},{"style":606},[4725],{"type":45,"value":842},{"type":40,"tag":297,"props":4727,"children":4728},{"style":845},[4729],{"type":45,"value":1031},{"type":40,"tag":297,"props":4731,"children":4732},{"style":606},[4733],{"type":45,"value":853},{"type":40,"tag":297,"props":4735,"children":4736},{"style":1038},[4737],{"type":45,"value":1059},{"type":40,"tag":297,"props":4739,"children":4740},{"style":606},[4741],{"type":45,"value":630},{"type":40,"tag":297,"props":4743,"children":4744},{"style":612},[4745],{"type":45,"value":893},{"type":40,"tag":297,"props":4747,"children":4748},{"style":606},[4749],{"type":45,"value":656},{"type":40,"tag":297,"props":4751,"children":4752},{"class":299,"line":318},[4753],{"type":40,"tag":297,"props":4754,"children":4755},{"emptyLinePlaceholder":340},[4756],{"type":45,"value":343},{"type":40,"tag":297,"props":4758,"children":4759},{"class":299,"line":327},[4760],{"type":40,"tag":297,"props":4761,"children":4762},{"style":792},[4763],{"type":45,"value":4764},"\u002F\u002F CORRECT\n",{"type":40,"tag":297,"props":4766,"children":4767},{"class":299,"line":336},[4768,4772,4776,4780,4784,4788,4792,4796,4800,4804,4809,4813,4817,4821,4826,4830,4834],{"type":40,"tag":297,"props":4769,"children":4770},{"style":801},[4771],{"type":45,"value":804},{"type":40,"tag":297,"props":4773,"children":4774},{"style":612},[4775],{"type":45,"value":1005},{"type":40,"tag":297,"props":4777,"children":4778},{"style":606},[4779],{"type":45,"value":814},{"type":40,"tag":297,"props":4781,"children":4782},{"style":606},[4783],{"type":45,"value":1014},{"type":40,"tag":297,"props":4785,"children":4786},{"style":830},[4787],{"type":45,"value":713},{"type":40,"tag":297,"props":4789,"children":4790},{"style":612},[4791],{"type":45,"value":837},{"type":40,"tag":297,"props":4793,"children":4794},{"style":606},[4795],{"type":45,"value":842},{"type":40,"tag":297,"props":4797,"children":4798},{"style":845},[4799],{"type":45,"value":1031},{"type":40,"tag":297,"props":4801,"children":4802},{"style":606},[4803],{"type":45,"value":853},{"type":40,"tag":297,"props":4805,"children":4806},{"style":1038},[4807],{"type":45,"value":4808}," 1000",{"type":40,"tag":297,"props":4810,"children":4811},{"style":606},[4812],{"type":45,"value":620},{"type":40,"tag":297,"props":4814,"children":4815},{"style":845},[4816],{"type":45,"value":1050},{"type":40,"tag":297,"props":4818,"children":4819},{"style":606},[4820],{"type":45,"value":853},{"type":40,"tag":297,"props":4822,"children":4823},{"style":1038},[4824],{"type":45,"value":4825}," 200",{"type":40,"tag":297,"props":4827,"children":4828},{"style":606},[4829],{"type":45,"value":630},{"type":40,"tag":297,"props":4831,"children":4832},{"style":612},[4833],{"type":45,"value":893},{"type":40,"tag":297,"props":4835,"children":4836},{"style":606},[4837],{"type":45,"value":656},{"type":40,"tag":4839,"props":4840,"children":4841},"fix-chunk-overlap",{},[4842],{"type":40,"tag":280,"props":4843,"children":4844},{},[4845,4847],{"type":45,"value":4846},"\nUse overlap (10-20% of chunk size) to maintain context at boundaries.\n",{"type":40,"tag":286,"props":4848,"children":4850},{"className":288,"code":4849,"language":280,"meta":290,"style":290},"# WRONG: No overlap - context breaks at boundaries\nsplitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=0)\n\n# CORRECT: 10-20% overlap\nsplitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)\n",[4851],{"type":40,"tag":293,"props":4852,"children":4853},{"__ignoreMap":290},[4854,4862,4870,4877,4885],{"type":40,"tag":297,"props":4855,"children":4856},{"class":299,"line":300},[4857],{"type":40,"tag":297,"props":4858,"children":4859},{},[4860],{"type":45,"value":4861},"# WRONG: No overlap - context breaks at boundaries\n",{"type":40,"tag":297,"props":4863,"children":4864},{"class":299,"line":309},[4865],{"type":40,"tag":297,"props":4866,"children":4867},{},[4868],{"type":45,"value":4869},"splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=0)\n",{"type":40,"tag":297,"props":4871,"children":4872},{"class":299,"line":318},[4873],{"type":40,"tag":297,"props":4874,"children":4875},{"emptyLinePlaceholder":340},[4876],{"type":45,"value":343},{"type":40,"tag":297,"props":4878,"children":4879},{"class":299,"line":327},[4880],{"type":40,"tag":297,"props":4881,"children":4882},{},[4883],{"type":45,"value":4884},"# CORRECT: 10-20% overlap\n",{"type":40,"tag":297,"props":4886,"children":4887},{"class":299,"line":336},[4888],{"type":40,"tag":297,"props":4889,"children":4890},{},[4891],{"type":45,"value":4675},{"type":40,"tag":4893,"props":4894,"children":4895},"fix-persist-vectorstore",{},[4896,4946],{"type":40,"tag":280,"props":4897,"children":4898},{},[4899,4901],{"type":45,"value":4900},"\nUse persistent vector store instead of in-memory to avoid data loss.\n",{"type":40,"tag":286,"props":4902,"children":4904},{"className":288,"code":4903,"language":280,"meta":290,"style":290},"# WRONG: InMemory - lost on restart\nvectorstore = InMemoryVectorStore.from_documents(docs, embeddings)\n\n# CORRECT\nvectorstore = Chroma.from_documents(docs, embeddings, persist_directory=\".\u002Fchroma_db\")\n",[4905],{"type":40,"tag":293,"props":4906,"children":4907},{"__ignoreMap":290},[4908,4916,4924,4931,4938],{"type":40,"tag":297,"props":4909,"children":4910},{"class":299,"line":300},[4911],{"type":40,"tag":297,"props":4912,"children":4913},{},[4914],{"type":45,"value":4915},"# WRONG: InMemory - lost on restart\n",{"type":40,"tag":297,"props":4917,"children":4918},{"class":299,"line":309},[4919],{"type":40,"tag":297,"props":4920,"children":4921},{},[4922],{"type":45,"value":4923},"vectorstore = InMemoryVectorStore.from_documents(docs, embeddings)\n",{"type":40,"tag":297,"props":4925,"children":4926},{"class":299,"line":318},[4927],{"type":40,"tag":297,"props":4928,"children":4929},{"emptyLinePlaceholder":340},[4930],{"type":45,"value":343},{"type":40,"tag":297,"props":4932,"children":4933},{"class":299,"line":327},[4934],{"type":40,"tag":297,"props":4935,"children":4936},{},[4937],{"type":45,"value":4667},{"type":40,"tag":297,"props":4939,"children":4940},{"class":299,"line":336},[4941],{"type":40,"tag":297,"props":4942,"children":4943},{},[4944],{"type":45,"value":4945},"vectorstore = Chroma.from_documents(docs, embeddings, persist_directory=\".\u002Fchroma_db\")\n",{"type":40,"tag":583,"props":4947,"children":4948},{},[4949,4950],{"type":45,"value":4900},{"type":40,"tag":286,"props":4951,"children":4953},{"className":589,"code":4952,"language":583,"meta":290,"style":290},"\u002F\u002F WRONG: Memory - lost on restart\nconst vectorstore = await MemoryVectorStore.fromDocuments(docs, embeddings);\n\n\u002F\u002F CORRECT\nconst vectorstore = await Chroma.fromDocuments(docs, embeddings, { collectionName: \"my-collection\" });\n",[4954],{"type":40,"tag":293,"props":4955,"children":4956},{"__ignoreMap":290},[4957,4965,5013,5020,5027],{"type":40,"tag":297,"props":4958,"children":4959},{"class":299,"line":300},[4960],{"type":40,"tag":297,"props":4961,"children":4962},{"style":792},[4963],{"type":45,"value":4964},"\u002F\u002F WRONG: Memory - lost on restart\n",{"type":40,"tag":297,"props":4966,"children":4967},{"class":299,"line":309},[4968,4972,4976,4980,4984,4988,4992,4996,5001,5005,5009],{"type":40,"tag":297,"props":4969,"children":4970},{"style":801},[4971],{"type":45,"value":804},{"type":40,"tag":297,"props":4973,"children":4974},{"style":612},[4975],{"type":45,"value":1209},{"type":40,"tag":297,"props":4977,"children":4978},{"style":606},[4979],{"type":45,"value":814},{"type":40,"tag":297,"props":4981,"children":4982},{"style":600},[4983],{"type":45,"value":1092},{"type":40,"tag":297,"props":4985,"children":4986},{"style":612},[4987],{"type":45,"value":672},{"type":40,"tag":297,"props":4989,"children":4990},{"style":606},[4991],{"type":45,"value":1102},{"type":40,"tag":297,"props":4993,"children":4994},{"style":830},[4995],{"type":45,"value":1230},{"type":40,"tag":297,"props":4997,"children":4998},{"style":612},[4999],{"type":45,"value":5000},"(docs",{"type":40,"tag":297,"props":5002,"children":5003},{"style":606},[5004],{"type":45,"value":620},{"type":40,"tag":297,"props":5006,"children":5007},{"style":612},[5008],{"type":45,"value":1244},{"type":40,"tag":297,"props":5010,"children":5011},{"style":606},[5012],{"type":45,"value":656},{"type":40,"tag":297,"props":5014,"children":5015},{"class":299,"line":318},[5016],{"type":40,"tag":297,"props":5017,"children":5018},{"emptyLinePlaceholder":340},[5019],{"type":45,"value":343},{"type":40,"tag":297,"props":5021,"children":5022},{"class":299,"line":327},[5023],{"type":40,"tag":297,"props":5024,"children":5025},{"style":792},[5026],{"type":45,"value":4764},{"type":40,"tag":297,"props":5028,"children":5029},{"class":299,"line":336},[5030,5034,5038,5042,5046,5050,5054,5058,5062,5066,5071,5075,5079,5083,5087,5091,5095,5099,5103,5107],{"type":40,"tag":297,"props":5031,"children":5032},{"style":801},[5033],{"type":45,"value":804},{"type":40,"tag":297,"props":5035,"children":5036},{"style":612},[5037],{"type":45,"value":1209},{"type":40,"tag":297,"props":5039,"children":5040},{"style":606},[5041],{"type":45,"value":814},{"type":40,"tag":297,"props":5043,"children":5044},{"style":600},[5045],{"type":45,"value":1092},{"type":40,"tag":297,"props":5047,"children":5048},{"style":612},[5049],{"type":45,"value":2587},{"type":40,"tag":297,"props":5051,"children":5052},{"style":606},[5053],{"type":45,"value":1102},{"type":40,"tag":297,"props":5055,"children":5056},{"style":830},[5057],{"type":45,"value":1230},{"type":40,"tag":297,"props":5059,"children":5060},{"style":612},[5061],{"type":45,"value":5000},{"type":40,"tag":297,"props":5063,"children":5064},{"style":606},[5065],{"type":45,"value":620},{"type":40,"tag":297,"props":5067,"children":5068},{"style":612},[5069],{"type":45,"value":5070}," embeddings",{"type":40,"tag":297,"props":5072,"children":5073},{"style":606},[5074],{"type":45,"value":620},{"type":40,"tag":297,"props":5076,"children":5077},{"style":606},[5078],{"type":45,"value":609},{"type":40,"tag":297,"props":5080,"children":5081},{"style":845},[5082],{"type":45,"value":2737},{"type":40,"tag":297,"props":5084,"children":5085},{"style":606},[5086],{"type":45,"value":853},{"type":40,"tag":297,"props":5088,"children":5089},{"style":606},[5090],{"type":45,"value":640},{"type":40,"tag":297,"props":5092,"children":5093},{"style":643},[5094],{"type":45,"value":2750},{"type":40,"tag":297,"props":5096,"children":5097},{"style":606},[5098],{"type":45,"value":651},{"type":40,"tag":297,"props":5100,"children":5101},{"style":606},[5102],{"type":45,"value":630},{"type":40,"tag":297,"props":5104,"children":5105},{"style":612},[5106],{"type":45,"value":893},{"type":40,"tag":297,"props":5108,"children":5109},{"style":606},[5110],{"type":45,"value":656},{"type":40,"tag":5112,"props":5113,"children":5114},"fix-consistent-embeddings",{},[5115,5189],{"type":40,"tag":280,"props":5116,"children":5117},{},[5118,5120],{"type":45,"value":5119},"\nUse the same embedding model for indexing and querying.\n",{"type":40,"tag":286,"props":5121,"children":5123},{"className":288,"code":5122,"language":280,"meta":290,"style":290},"# WRONG: Different embeddings for index and query - incompatible!\nvectorstore = Chroma.from_documents(docs, OpenAIEmbeddings(model=\"text-embedding-3-small\"))\nretriever = vectorstore.as_retriever(embeddings=OpenAIEmbeddings(model=\"text-embedding-3-large\"))\n\n# CORRECT: Same model\nembeddings = OpenAIEmbeddings(model=\"text-embedding-3-small\")\nvectorstore = Chroma.from_documents(docs, embeddings)\nretriever = vectorstore.as_retriever()  # Uses same embeddings\n",[5124],{"type":40,"tag":293,"props":5125,"children":5126},{"__ignoreMap":290},[5127,5135,5143,5151,5158,5166,5173,5181],{"type":40,"tag":297,"props":5128,"children":5129},{"class":299,"line":300},[5130],{"type":40,"tag":297,"props":5131,"children":5132},{},[5133],{"type":45,"value":5134},"# WRONG: Different embeddings for index and query - incompatible!\n",{"type":40,"tag":297,"props":5136,"children":5137},{"class":299,"line":309},[5138],{"type":40,"tag":297,"props":5139,"children":5140},{},[5141],{"type":45,"value":5142},"vectorstore = Chroma.from_documents(docs, OpenAIEmbeddings(model=\"text-embedding-3-small\"))\n",{"type":40,"tag":297,"props":5144,"children":5145},{"class":299,"line":318},[5146],{"type":40,"tag":297,"props":5147,"children":5148},{},[5149],{"type":45,"value":5150},"retriever = vectorstore.as_retriever(embeddings=OpenAIEmbeddings(model=\"text-embedding-3-large\"))\n",{"type":40,"tag":297,"props":5152,"children":5153},{"class":299,"line":327},[5154],{"type":40,"tag":297,"props":5155,"children":5156},{"emptyLinePlaceholder":340},[5157],{"type":45,"value":343},{"type":40,"tag":297,"props":5159,"children":5160},{"class":299,"line":336},[5161],{"type":40,"tag":297,"props":5162,"children":5163},{},[5164],{"type":45,"value":5165},"# CORRECT: Same model\n",{"type":40,"tag":297,"props":5167,"children":5168},{"class":299,"line":346},[5169],{"type":40,"tag":297,"props":5170,"children":5171},{},[5172],{"type":45,"value":449},{"type":40,"tag":297,"props":5174,"children":5175},{"class":299,"line":355},[5176],{"type":40,"tag":297,"props":5177,"children":5178},{},[5179],{"type":45,"value":5180},"vectorstore = Chroma.from_documents(docs, embeddings)\n",{"type":40,"tag":297,"props":5182,"children":5183},{"class":299,"line":364},[5184],{"type":40,"tag":297,"props":5185,"children":5186},{},[5187],{"type":45,"value":5188},"retriever = vectorstore.as_retriever()  # Uses same embeddings\n",{"type":40,"tag":583,"props":5190,"children":5191},{},[5192,5193],{"type":45,"value":5119},{"type":40,"tag":286,"props":5194,"children":5196},{"className":589,"code":5195,"language":583,"meta":290,"style":290},"const embeddings = new OpenAIEmbeddings({ model: \"text-embedding-3-small\" });\nconst vectorstore = await Chroma.fromDocuments(docs, embeddings);\nconst retriever = vectorstore.asRetriever();  \u002F\u002F Uses same embeddings\n",[5197],{"type":40,"tag":293,"props":5198,"children":5199},{"__ignoreMap":290},[5200,5263,5310],{"type":40,"tag":297,"props":5201,"children":5202},{"class":299,"line":300},[5203,5207,5211,5215,5219,5223,5227,5231,5235,5239,5243,5247,5251,5255,5259],{"type":40,"tag":297,"props":5204,"children":5205},{"style":801},[5206],{"type":45,"value":804},{"type":40,"tag":297,"props":5208,"children":5209},{"style":612},[5210],{"type":45,"value":1143},{"type":40,"tag":297,"props":5212,"children":5213},{"style":606},[5214],{"type":45,"value":814},{"type":40,"tag":297,"props":5216,"children":5217},{"style":606},[5218],{"type":45,"value":1014},{"type":40,"tag":297,"props":5220,"children":5221},{"style":830},[5222],{"type":45,"value":625},{"type":40,"tag":297,"props":5224,"children":5225},{"style":612},[5226],{"type":45,"value":837},{"type":40,"tag":297,"props":5228,"children":5229},{"style":606},[5230],{"type":45,"value":842},{"type":40,"tag":297,"props":5232,"children":5233},{"style":845},[5234],{"type":45,"value":1168},{"type":40,"tag":297,"props":5236,"children":5237},{"style":606},[5238],{"type":45,"value":853},{"type":40,"tag":297,"props":5240,"children":5241},{"style":606},[5242],{"type":45,"value":640},{"type":40,"tag":297,"props":5244,"children":5245},{"style":643},[5246],{"type":45,"value":1181},{"type":40,"tag":297,"props":5248,"children":5249},{"style":606},[5250],{"type":45,"value":651},{"type":40,"tag":297,"props":5252,"children":5253},{"style":606},[5254],{"type":45,"value":630},{"type":40,"tag":297,"props":5256,"children":5257},{"style":612},[5258],{"type":45,"value":893},{"type":40,"tag":297,"props":5260,"children":5261},{"style":606},[5262],{"type":45,"value":656},{"type":40,"tag":297,"props":5264,"children":5265},{"class":299,"line":309},[5266,5270,5274,5278,5282,5286,5290,5294,5298,5302,5306],{"type":40,"tag":297,"props":5267,"children":5268},{"style":801},[5269],{"type":45,"value":804},{"type":40,"tag":297,"props":5271,"children":5272},{"style":612},[5273],{"type":45,"value":1209},{"type":40,"tag":297,"props":5275,"children":5276},{"style":606},[5277],{"type":45,"value":814},{"type":40,"tag":297,"props":5279,"children":5280},{"style":600},[5281],{"type":45,"value":1092},{"type":40,"tag":297,"props":5283,"children":5284},{"style":612},[5285],{"type":45,"value":2587},{"type":40,"tag":297,"props":5287,"children":5288},{"style":606},[5289],{"type":45,"value":1102},{"type":40,"tag":297,"props":5291,"children":5292},{"style":830},[5293],{"type":45,"value":1230},{"type":40,"tag":297,"props":5295,"children":5296},{"style":612},[5297],{"type":45,"value":5000},{"type":40,"tag":297,"props":5299,"children":5300},{"style":606},[5301],{"type":45,"value":620},{"type":40,"tag":297,"props":5303,"children":5304},{"style":612},[5305],{"type":45,"value":1244},{"type":40,"tag":297,"props":5307,"children":5308},{"style":606},[5309],{"type":45,"value":656},{"type":40,"tag":297,"props":5311,"children":5312},{"class":299,"line":318},[5313,5317,5321,5325,5329,5333,5337,5341,5346],{"type":40,"tag":297,"props":5314,"children":5315},{"style":801},[5316],{"type":45,"value":804},{"type":40,"tag":297,"props":5318,"children":5319},{"style":612},[5320],{"type":45,"value":1275},{"type":40,"tag":297,"props":5322,"children":5323},{"style":606},[5324],{"type":45,"value":814},{"type":40,"tag":297,"props":5326,"children":5327},{"style":612},[5328],{"type":45,"value":1284},{"type":40,"tag":297,"props":5330,"children":5331},{"style":606},[5332],{"type":45,"value":1102},{"type":40,"tag":297,"props":5334,"children":5335},{"style":830},[5336],{"type":45,"value":1293},{"type":40,"tag":297,"props":5338,"children":5339},{"style":612},[5340],{"type":45,"value":1967},{"type":40,"tag":297,"props":5342,"children":5343},{"style":606},[5344],{"type":45,"value":5345},";",{"type":40,"tag":297,"props":5347,"children":5348},{"style":792},[5349],{"type":45,"value":5350},"  \u002F\u002F Uses same embeddings\n",{"type":40,"tag":5352,"props":5353,"children":5354},"fix-faiss-deserialization",{},[5355],{"type":40,"tag":280,"props":5356,"children":5357},{},[5358,5360,5478,5491],{"type":45,"value":5359},"\nOnly opt in to FAISS deserialization for trusted local indexes. Python FAISS indexes include pickle-backed metadata, and untrusted pickle files can execute arbitrary code during loading.\n",{"type":40,"tag":286,"props":5361,"children":5363},{"className":288,"code":5362,"language":280,"meta":290,"style":290},"# WRONG: Loading a downloaded, shared, cloud-hosted, or third-party-controlled\n# FAISS index with dangerous deserialization enabled.\nloaded_store = FAISS.load_local(\n    \".\u002Funtrusted_faiss_index\",\n    embeddings,\n    allow_dangerous_deserialization=True,\n)\n\n# CORRECT: Only opt in when the index directory was created by you and has\n# remained under your control.\nloaded_store = FAISS.load_local(\n    \".\u002Ffaiss_index\",\n    embeddings,\n    allow_dangerous_deserialization=True,\n)\n",[5364],{"type":40,"tag":293,"props":5365,"children":5366},{"__ignoreMap":290},[5367,5375,5383,5391,5399,5406,5413,5420,5427,5435,5443,5450,5457,5464,5471],{"type":40,"tag":297,"props":5368,"children":5369},{"class":299,"line":300},[5370],{"type":40,"tag":297,"props":5371,"children":5372},{},[5373],{"type":45,"value":5374},"# WRONG: Loading a downloaded, shared, cloud-hosted, or third-party-controlled\n",{"type":40,"tag":297,"props":5376,"children":5377},{"class":299,"line":309},[5378],{"type":40,"tag":297,"props":5379,"children":5380},{},[5381],{"type":45,"value":5382},"# FAISS index with dangerous deserialization enabled.\n",{"type":40,"tag":297,"props":5384,"children":5385},{"class":299,"line":318},[5386],{"type":40,"tag":297,"props":5387,"children":5388},{},[5389],{"type":45,"value":5390},"loaded_store = FAISS.load_local(\n",{"type":40,"tag":297,"props":5392,"children":5393},{"class":299,"line":327},[5394],{"type":40,"tag":297,"props":5395,"children":5396},{},[5397],{"type":45,"value":5398},"    \".\u002Funtrusted_faiss_index\",\n",{"type":40,"tag":297,"props":5400,"children":5401},{"class":299,"line":336},[5402],{"type":40,"tag":297,"props":5403,"children":5404},{},[5405],{"type":45,"value":2898},{"type":40,"tag":297,"props":5407,"children":5408},{"class":299,"line":346},[5409],{"type":40,"tag":297,"props":5410,"children":5411},{},[5412],{"type":45,"value":2906},{"type":40,"tag":297,"props":5414,"children":5415},{"class":299,"line":355},[5416],{"type":40,"tag":297,"props":5417,"children":5418},{},[5419],{"type":45,"value":2314},{"type":40,"tag":297,"props":5421,"children":5422},{"class":299,"line":364},[5423],{"type":40,"tag":297,"props":5424,"children":5425},{"emptyLinePlaceholder":340},[5426],{"type":45,"value":343},{"type":40,"tag":297,"props":5428,"children":5429},{"class":299,"line":373},[5430],{"type":40,"tag":297,"props":5431,"children":5432},{},[5433],{"type":45,"value":5434},"# CORRECT: Only opt in when the index directory was created by you and has\n",{"type":40,"tag":297,"props":5436,"children":5437},{"class":299,"line":382},[5438],{"type":40,"tag":297,"props":5439,"children":5440},{},[5441],{"type":45,"value":5442},"# remained under your control.\n",{"type":40,"tag":297,"props":5444,"children":5445},{"class":299,"line":391},[5446],{"type":40,"tag":297,"props":5447,"children":5448},{},[5449],{"type":45,"value":5390},{"type":40,"tag":297,"props":5451,"children":5452},{"class":299,"line":399},[5453],{"type":40,"tag":297,"props":5454,"children":5455},{},[5456],{"type":45,"value":2890},{"type":40,"tag":297,"props":5458,"children":5459},{"class":299,"line":408},[5460],{"type":40,"tag":297,"props":5461,"children":5462},{},[5463],{"type":45,"value":2898},{"type":40,"tag":297,"props":5465,"children":5466},{"class":299,"line":417},[5467],{"type":40,"tag":297,"props":5468,"children":5469},{},[5470],{"type":45,"value":2906},{"type":40,"tag":297,"props":5472,"children":5473},{"class":299,"line":426},[5474],{"type":40,"tag":297,"props":5475,"children":5476},{},[5477],{"type":45,"value":2314},{"type":40,"tag":48,"props":5479,"children":5480},{},[5481,5483,5489],{"type":45,"value":5482},"If you cannot guarantee the provenance of a persisted index, do not load it with ",{"type":40,"tag":293,"props":5484,"children":5486},{"className":5485},[],[5487],{"type":45,"value":5488},"allow_dangerous_deserialization=True",{"type":45,"value":5490},". Rebuild the index from trusted source documents or use a vector store\u002Fbackend that does not require pickle deserialization for untrusted files.\n\n",{"type":40,"tag":5492,"props":5493,"children":5494},"fix-dimension-mismatch",{},[5495],{"type":40,"tag":280,"props":5496,"children":5497},{},[5498,5500],{"type":45,"value":5499},"\nEnsure embedding dimensions match the vector store index dimensions.\n",{"type":40,"tag":286,"props":5501,"children":5503},{"className":288,"code":5502,"language":280,"meta":290,"style":290},"# WRONG: Index has 1536 dimensions but using 512-dim embeddings\npc.create_index(name=\"idx\", dimension=1536, metric=\"cosine\")\nvectorstore = PineconeVectorStore.from_documents(\n    docs, OpenAIEmbeddings(model=\"text-embedding-3-small\", dimensions=512), index=pc.Index(\"idx\")\n)  # Error: dimension mismatch!\n\n# CORRECT: Match dimensions\nembeddings = OpenAIEmbeddings()  # Default 1536\n",[5504],{"type":40,"tag":293,"props":5505,"children":5506},{"__ignoreMap":290},[5507,5515,5523,5531,5539,5547,5554,5562],{"type":40,"tag":297,"props":5508,"children":5509},{"class":299,"line":300},[5510],{"type":40,"tag":297,"props":5511,"children":5512},{},[5513],{"type":45,"value":5514},"# WRONG: Index has 1536 dimensions but using 512-dim embeddings\n",{"type":40,"tag":297,"props":5516,"children":5517},{"class":299,"line":309},[5518],{"type":40,"tag":297,"props":5519,"children":5520},{},[5521],{"type":45,"value":5522},"pc.create_index(name=\"idx\", dimension=1536, metric=\"cosine\")\n",{"type":40,"tag":297,"props":5524,"children":5525},{"class":299,"line":318},[5526],{"type":40,"tag":297,"props":5527,"children":5528},{},[5529],{"type":45,"value":5530},"vectorstore = PineconeVectorStore.from_documents(\n",{"type":40,"tag":297,"props":5532,"children":5533},{"class":299,"line":327},[5534],{"type":40,"tag":297,"props":5535,"children":5536},{},[5537],{"type":45,"value":5538},"    docs, OpenAIEmbeddings(model=\"text-embedding-3-small\", dimensions=512), index=pc.Index(\"idx\")\n",{"type":40,"tag":297,"props":5540,"children":5541},{"class":299,"line":336},[5542],{"type":40,"tag":297,"props":5543,"children":5544},{},[5545],{"type":45,"value":5546},")  # Error: dimension mismatch!\n",{"type":40,"tag":297,"props":5548,"children":5549},{"class":299,"line":346},[5550],{"type":40,"tag":297,"props":5551,"children":5552},{"emptyLinePlaceholder":340},[5553],{"type":45,"value":343},{"type":40,"tag":297,"props":5555,"children":5556},{"class":299,"line":355},[5557],{"type":40,"tag":297,"props":5558,"children":5559},{},[5560],{"type":45,"value":5561},"# CORRECT: Match dimensions\n",{"type":40,"tag":297,"props":5563,"children":5564},{"class":299,"line":364},[5565],{"type":40,"tag":297,"props":5566,"children":5567},{},[5568],{"type":45,"value":5569},"embeddings = OpenAIEmbeddings()  # Default 1536\n",{"type":40,"tag":5571,"props":5572,"children":5573},"style",{},[5574],{"type":45,"value":5575},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":5577,"total":5754},[5578,5599,5608,5625,5638,5655,5672,5687,5701,5711,5722,5741],{"slug":5579,"name":5579,"fn":5580,"description":5581,"org":5582,"tags":5583,"stars":5596,"repoUrl":5597,"updatedAt":5598},"analyze-market","perform market analysis and size estimation","Perform a market analysis for a product category or segment. Trigger on: market analysis, market size, TAM SAM SOM, market opportunity, industry analysis.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5584,5587,5590,5593],{"name":5585,"slug":5586,"type":16},"Marketing","marketing",{"name":5588,"slug":5589,"type":16},"Research","research",{"name":5591,"slug":5592,"type":16},"Sales","sales",{"name":5594,"slug":5595,"type":16},"Strategy","strategy",26592,"https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Fdeepagents","2026-04-18T04:46:54.557115",{"slug":5600,"name":5600,"fn":5601,"description":5602,"org":5603,"tags":5604,"stars":5596,"repoUrl":5597,"updatedAt":5607},"arxiv-search","search arXiv for academic research papers","Searches arXiv for preprints and academic papers, retrieves abstracts, and filters by topic. Use when the user asks to find research papers, search arXiv, look up preprints, find academic articles in physics, math, CS, biology, statistics, or related fields.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5605,5606],{"name":5588,"slug":5589,"type":16},{"name":22,"slug":23,"type":16},"2026-05-13T06:11:01.203061",{"slug":5609,"name":5609,"fn":5610,"description":5611,"org":5612,"tags":5613,"stars":5596,"repoUrl":5597,"updatedAt":5624},"blog-post","write SEO-optimized blog posts","Write long-form blog posts with SEO optimization and clear structure.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5614,5617,5618,5621],{"name":5615,"slug":5616,"type":16},"Content Creation","content-creation",{"name":5585,"slug":5586,"type":16},{"name":5619,"slug":5620,"type":16},"SEO","seo",{"name":5622,"slug":5623,"type":16},"Writing","writing","2026-04-15T05:00:54.149813",{"slug":5626,"name":5626,"fn":5627,"description":5628,"org":5629,"tags":5630,"stars":5596,"repoUrl":5597,"updatedAt":5637},"competitor-analysis","analyze competitors and market positioning","Analyze competitors in a given market segment. Trigger on: competitive landscape, competitor analysis, market comparison, competitive positioning.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5631,5634,5635,5636],{"name":5632,"slug":5633,"type":16},"Competitive Intelligence","competitive-intelligence",{"name":5585,"slug":5586,"type":16},{"name":5588,"slug":5589,"type":16},{"name":5594,"slug":5595,"type":16},"2026-04-18T04:46:55.79306",{"slug":5639,"name":5639,"fn":5640,"description":5641,"org":5642,"tags":5643,"stars":5596,"repoUrl":5597,"updatedAt":5654},"deepagents-thread-inspector","inspect local Deep Agents conversation threads","Inspect and explain conversations in the local Deep Agents Code SQLite session store. Use as a fallback when LangSmith trace tooling is unavailable, for offline or untraced sessions, or when asked to identify or summarize a local dcode thread, inspect checkpoint metadata, list recent local threads, or parse ~\u002F.deepagents\u002F.state\u002Fsessions.db and a thread UUID or prefix.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5644,5647,5650,5651],{"name":5645,"slug":5646,"type":16},"Agents","agents",{"name":5648,"slug":5649,"type":16},"Debugging","debugging",{"name":9,"slug":8,"type":16},{"name":5652,"slug":5653,"type":16},"SQLite","sqlite","2026-07-24T06:08:57.102689",{"slug":5656,"name":5656,"fn":5657,"description":5658,"org":5659,"tags":5660,"stars":5596,"repoUrl":5597,"updatedAt":5671},"langgraph-docs","build stateful agents with LangGraph","Fetches and references LangGraph Python documentation to build stateful agents, create multi-agent workflows, and implement human-in-the-loop patterns. Use when the user asks about LangGraph, graph agents, state machines, agent orchestration, LangGraph API, or needs LangGraph implementation guidance.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5661,5662,5665,5668],{"name":5645,"slug":5646,"type":16},{"name":5663,"slug":5664,"type":16},"Documentation","documentation",{"name":5666,"slug":5667,"type":16},"LangGraph","langgraph",{"name":5669,"slug":5670,"type":16},"Multi-Agent","multi-agent","2026-05-13T06:11:03.650877",{"slug":5673,"name":5673,"fn":5674,"description":5675,"org":5676,"tags":5677,"stars":5596,"repoUrl":5597,"updatedAt":5686},"remember","capture knowledge into persistent memory","Review the current conversation and capture valuable knowledge — best practices, coding conventions, architecture decisions, workflows, and user feedback — into persistent memory (AGENTS.md) or reusable skills. Use when the user says: (1) remember this, (2) save what we learned, (3) update memory, (4) capture learnings.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5678,5679,5680,5683],{"name":5645,"slug":5646,"type":16},{"name":5663,"slug":5664,"type":16},{"name":5681,"slug":5682,"type":16},"Knowledge Management","knowledge-management",{"name":5684,"slug":5685,"type":16},"Memory","memory","2026-05-13T06:10:58.510037",{"slug":5688,"name":5688,"fn":5689,"description":5690,"org":5691,"tags":5692,"stars":5596,"repoUrl":5597,"updatedAt":5700},"skill-creator","create agent skills and tool integrations","Guide for creating effective skills that extend agent capabilities with specialized knowledge, workflows, or tool integrations. Use this skill when the user asks to: (1) create a new skill, (2) make a skill, (3) build a skill, (4) set up a skill, (5) initialize a skill, (6) scaffold a skill, (7) update or modify an existing skill, (8) validate a skill, (9) learn about skill structure, (10) understand how skills work, or (11) get guidance on skill design patterns. Trigger on phrases like \"create a skill\", \"new skill\", \"make a skill\", \"skill for X\", \"how do I create a skill\", or \"help me build a skill\".",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5693,5694,5697],{"name":5645,"slug":5646,"type":16},{"name":5695,"slug":5696,"type":16},"Engineering","engineering",{"name":5698,"slug":5699,"type":16},"Plugin Development","plugin-development","2026-05-13T06:10:59.88449",{"slug":5702,"name":5702,"fn":5703,"description":5704,"org":5705,"tags":5706,"stars":5596,"repoUrl":5597,"updatedAt":5710},"social-media","create optimized social media posts","Create social media posts optimized for engagement across platforms.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5707,5708,5709],{"name":5615,"slug":5616,"type":16},{"name":5585,"slug":5586,"type":16},{"name":5622,"slug":5623,"type":16},"2026-04-15T05:00:55.37452",{"slug":5712,"name":5712,"fn":5713,"description":5714,"org":5715,"tags":5716,"stars":5596,"repoUrl":5597,"updatedAt":5721},"web-research","conduct and synthesize web research","Searches multiple web sources, synthesizes findings, and produces cited research reports using delegated subagents. Use when the user asks to research a topic online, search the web, look something up, find current information, compare options, or produce a research report.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5717,5718,5719,5720],{"name":5645,"slug":5646,"type":16},{"name":5669,"slug":5670,"type":16},{"name":5588,"slug":5589,"type":16},{"name":22,"slug":23,"type":16},"2026-05-13T06:11:04.930044",{"slug":5723,"name":5723,"fn":5724,"description":5725,"org":5726,"tags":5727,"stars":5738,"repoUrl":5739,"updatedAt":5740},"mermaid-diagrams","embed Mermaid diagrams in documentation","Embed Mermaid diagrams in generated wiki pages. Use whenever documenting a runtime or request flow, a call sequence, a state machine or lifecycle, a data model or entity relationships, or non-trivial control flow, since these are clearer as a diagram than as prose. Also use when an update run touches a page that already contains a mermaid fence, or a page that contains a text fence a previous run degraded.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5728,5731,5732,5735],{"name":5729,"slug":5730,"type":16},"Diagrams","diagrams",{"name":5663,"slug":5664,"type":16},{"name":5733,"slug":5734,"type":16},"Markdown","markdown",{"name":5736,"slug":5737,"type":16},"Technical Writing","technical-writing",12181,"https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Fopenwiki","2026-07-24T06:09:01.089597",{"slug":5742,"name":5742,"fn":5743,"description":5744,"org":5745,"tags":5746,"stars":5738,"repoUrl":5739,"updatedAt":5753},"write-connector","implement OpenWiki source connectors","Add a new built-in OpenWiki source connector. Use when a user asks to create or implement an OpenWiki connector.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5747,5750],{"name":5748,"slug":5749,"type":16},"API Development","api-development",{"name":5751,"slug":5752,"type":16},"Integrations","integrations","2026-07-18T05:48:23.961804",41,{"items":5756,"total":487},[5757,5770,5783,5799,5810,5821,5835],{"slug":5758,"name":5758,"fn":5759,"description":5760,"org":5761,"tags":5762,"stars":24,"repoUrl":25,"updatedAt":5769},"deep-agents-core","build applications with LangChain Deep Agents","INVOKE THIS SKILL when building ANY Deep Agents application. Covers create_deep_agent(), harness architecture, SKILL.md format, and configuration options.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5763,5764,5767,5768],{"name":5645,"slug":5646,"type":16},{"name":5765,"slug":5766,"type":16},"Architecture","architecture",{"name":9,"slug":8,"type":16},{"name":14,"slug":15,"type":16},"2026-04-06T18:26:24.822592",{"slug":5771,"name":5771,"fn":5772,"description":5773,"org":5774,"tags":5775,"stars":24,"repoUrl":25,"updatedAt":5782},"deep-agents-memory","implement memory and persistence for Deep Agents","INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access. Covers StateBackend (ephemeral), StoreBackend (persistent), FilesystemMiddleware, and CompositeBackend for routing.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5776,5777,5778,5779],{"name":5645,"slug":5646,"type":16},{"name":9,"slug":8,"type":16},{"name":5684,"slug":5685,"type":16},{"name":5780,"slug":5781,"type":16},"Storage","storage","2026-04-06T18:26:26.065654",{"slug":5784,"name":5784,"fn":5785,"description":5786,"org":5787,"tags":5788,"stars":24,"repoUrl":25,"updatedAt":5798},"deep-agents-orchestration","orchestrate subagents and tasks in Deep Agents","INVOKE THIS SKILL when using subagents, task planning, or human approval in Deep Agents. Covers SubAgentMiddleware, TodoList for planning, and HITL interrupts.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5789,5790,5793,5794,5795],{"name":5645,"slug":5646,"type":16},{"name":5791,"slug":5792,"type":16},"Approvals","approvals",{"name":9,"slug":8,"type":16},{"name":5669,"slug":5670,"type":16},{"name":5796,"slug":5797,"type":16},"Workflow Automation","workflow-automation","2026-04-06T18:26:32.280463",{"slug":5800,"name":5800,"fn":5801,"description":5802,"org":5803,"tags":5804,"stars":24,"repoUrl":25,"updatedAt":5809},"deepagents-python-quickstart","scaffold local Deep Agents","Scaffold a minimal local Deep Agent in Python by following the official quickstart, using provider-native web search instead of Tavily. Use when the user wants to quickly build or try a Deep Agent locally.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5805,5806,5807],{"name":5645,"slug":5646,"type":16},{"name":9,"slug":8,"type":16},{"name":5808,"slug":280,"type":16},"Python","2026-07-24T06:09:00.291108",{"slug":5811,"name":5811,"fn":5812,"description":5813,"org":5814,"tags":5815,"stars":24,"repoUrl":25,"updatedAt":5820},"deepagents-typescript-quickstart","build Deep Agents in TypeScript","Scaffold a minimal local Deep Agent in TypeScript by following the official quickstart, using provider-native web search instead of Tavily. Use when the user wants to quickly build or try a Deep Agent locally.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5816,5817,5818],{"name":5645,"slug":5646,"type":16},{"name":9,"slug":8,"type":16},{"name":5819,"slug":583,"type":16},"TypeScript","2026-07-24T06:09:00.673714",{"slug":5822,"name":5822,"fn":5823,"description":5824,"org":5825,"tags":5826,"stars":24,"repoUrl":25,"updatedAt":5834},"ecosystem-primer","select frameworks for LangChain and LangGraph agents","INVOKE FIRST for any LangChain \u002F LangGraph \u002F Deep Agents agent building project before consulting other skills or writing any agent code. Required starting point for up to date info on framework selection (LangChain vs LangGraph vs Deep Agents vs hybrid composition), agent patterns, install, environment setup, and which skill to load next.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5827,5828,5831,5832,5833],{"name":5645,"slug":5646,"type":16},{"name":5829,"slug":5830,"type":16},"AI Infrastructure","ai-infrastructure",{"name":5765,"slug":5766,"type":16},{"name":9,"slug":8,"type":16},{"name":5666,"slug":5667,"type":16},"2026-07-24T05:42:48.348966",{"slug":5836,"name":5836,"fn":5837,"description":5838,"org":5839,"tags":5840,"stars":24,"repoUrl":25,"updatedAt":5851},"eval-engineering","create and audit Harbor agent evals","Iteratively inspect an agent repository and optional user-provided traces, interview the user, and create, run, and audit Harbor evals one at a time. Use for agent evals, Harbor tasks, benchmark cases, verifier design, or controlled agent environments.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[5841,5842,5845,5848,5849],{"name":5645,"slug":5646,"type":16},{"name":5843,"slug":5844,"type":16},"Code Analysis","code-analysis",{"name":5846,"slug":5847,"type":16},"Evals","evals",{"name":9,"slug":8,"type":16},{"name":196,"slug":5850,"type":16},"testing","2026-07-31T05:53:29.552458"]