id stringlengths 6 6 | text stringlengths 20 17.2k | title stringclasses 1
value |
|---|---|---|
151581 | "This section shows you how to replace the default schema with a custom schema.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Create a new index with custom filterable fields \n",
"\n",
"This schema shows field definitions. It's the default schema, plus several new fiel... | |
151582 | "embeddings: OpenAIEmbeddings = OpenAIEmbeddings(\n",
" openai_api_key=openai_api_key, openai_api_version=openai_api_version, model=model\n",
")\n",
"embedding_function = embeddings.embed_query\n",
"\n",
"fields = [\n",
" SimpleField(\n",
" name=\"id\",\n",
" type=Sea... | |
151589 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Upstash Vector\n",
"\n",
"> [Upstash Vector](https://upstash.com/docs/vector/overall/whatisvector) is a serverless vector database designed for working with vector embeddings.\n",
">\n",
"> The vector langchain integr... | |
151685 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Activeloop Deep Lake\n",
"\n",
">[Activeloop Deep Lake](https://docs.activeloop.ai/) as a Multi-Modal Vector Store that stores embeddings and their metadata including text, Jsons, images, audio, video, and more. It saves the... | |
151697 | {
"cells": [
{
"cell_type": "markdown",
"id": "fb0243ae",
"metadata": {},
"source": [
"# Azure Cosmos DB No SQL\n",
"\n",
"This notebook shows you how to leverage this integrated [vector database](https://learn.microsoft.com/en-us/azure/cosmos-db/vector-database) to store documents in collect... | |
151747 | "source": [
"## Basic Vectorstore Operations"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"db = HanaDB(\n",
" connection=connection, embedding=embeddings, table_name=\"LANGCHAIN_DEMO_BASIC\"\n",
")\n",
"\n",
"# Delete a... | |
151748 | "advanced_filter = {\"name\": {\"$nin\": [\"adam\", \"bob\"]}}\n",
"print(f\"Filter: {advanced_filter}\")\n",
"print_filter_result(db.similarity_search(\"just testing\", k=5, filter=advanced_filter))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Text filtering with `$like`"
... | |
151751 | {
"cells": [
{
"cell_type": "markdown",
"id": "e4afbbb6",
"metadata": {},
"source": [
"# ScaNN\n",
"\n",
"ScaNN (Scalable Nearest Neighbors) is a method for efficient vector similarity search at scale.\n",
"\n",
"ScaNN includes search space pruning and quantization for Maximum Inner P... | |
151756 | {
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Google Memorystore for Redis\n",
"\n",
"> [Google Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis/memorystore-for-redis-overview) is a fully-managed service that is powered by the ... | |
151757 | "This approach offers flexibility when working with a new or existing RedisVectorStore:\n",
"\n",
"* [Optional] Create a RedisVectorStore Instance: Instantiate a RedisVectorStore object for customization. If you already have an instance, proceed to the next step.\n",
"* Add Text with Metadata: Provide raw t... | |
151762 | {
"cells": [
{
"cell_type": "raw",
"metadata": {},
"source": [
"---\n",
"sidebar_label: Kinetica\n",
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Kinetica Vectorstore API\n",
"\n",
">[Kinetica](https://www.kinetica.com/) is a database with inte... | |
151770 | {
"cells": [
{
"cell_type": "markdown",
"id": "683953b3",
"metadata": {},
"source": [
"# Momento Vector Index (MVI)\n",
"\n",
">[MVI](https://gomomento.com): the most productive, easiest to use, serverless vector index for your data. To get started with MVI, simply sign up for an account. The... | |
151775 | {
"cells": [
{
"cell_type": "markdown",
"id": "683953b3",
"metadata": {},
"source": [
"# Faiss (Async)\n",
"\n",
">[Facebook AI Similarity Search (Faiss)](https://engineering.fb.com/2017/03/29/data-infrastructure/faiss-a-library-for-efficient-similarity-search/) is a library for efficient sim... | |
151778 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {
"collapsed": false,
"jupyter": {
"outputs_hidden": false
}
},
"source": [
"# SQLite-VSS\n",
"\n",
">[SQLite-VSS](https://alexgarcia.xyz/sqlite-vss/) is an `SQLite` extension designed for vector search, emphasizing local-fi... | |
151781 | {
"cells": [
{
"cell_type": "markdown",
"id": "7e80d338-091b-421c-ac66-5950b14944b2",
"metadata": {},
"source": [
"# Yellowbrick\n",
"\n",
"[Yellowbrick](https://yellowbrick.com/yellowbrick-data-warehouse/) is an elastic, massively parallel processing (MPP) SQL database that runs in the cloud... | |
151783 | " return_source_documents=True,\n",
" chain_type_kwargs=chain_type_kwargs,\n",
")\n",
"\n",
"\n",
"def print_result_sources(query):\n",
" result = chain(query)\n",
" output_text = f\"\"\"### Question: \n",
" {query}\n",
" ### Answer: \n",
" {result['answer']}\n",
... | |
151806 | {
"cells": [
{
"cell_type": "markdown",
"id": "683953b3",
"metadata": {},
"source": [
"# MongoDB Atlas\n",
"\n",
"This notebook covers how to MongoDB Atlas vector search in LangChain, using the `langchain-mongodb` package.\n",
"\n",
">[MongoDB Atlas](https://www.mongodb.com/docs/atlas... | |
151807 | ")\n",
"\n",
"document_6 = Document(\n",
" page_content=\"Is the new iPhone worth the price? Read this review to find out.\",\n",
" metadata={\"source\": \"website\"},\n",
")\n",
"\n",
"document_7 = Document(\n",
" page_content=\"The top 10 soccer players in the world right now.... | |
151808 | "text/plain": [
"[Document(metadata={'_id': '8c31b84e-2636-48b6-8b99-9fccb47f7051', 'source': 'news'}, page_content='Robbers broke into the city bank and stole $1 million in cash.')]"
]
},
"execution_count": 65,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
... | |
151809 | {
"cells": [
{
"cell_type": "markdown",
"id": "683953b3",
"metadata": {},
"source": [
"# Faiss\n",
"\n",
">[Facebook AI Similarity Search (FAISS)](https://engineering.fb.com/2017/03/29/data-infrastructure/faiss-a-library-for-efficient-similarity-search/) is a library for efficient similarity ... | |
151810 | " page_content=\"The stock market is down 500 points today due to fears of a recession.\",\n",
" metadata={\"source\": \"news\"},\n",
")\n",
"\n",
"document_10 = Document(\n",
" page_content=\"I have a bad feeling I am going to get deleted :(\",\n",
" metadata={\"source\": \"tweet\"}... | |
151812 | {
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "683953b3",
"metadata": {},
"source": [
"# Pinecone\n",
"\n",
">[Pinecone](https://docs.pinecone.io/docs/overview) is a vector database with broad functionality.\n",
"\n",
"This notebook shows how to use functionality... | |
151813 | "\n",
"document_4 = Document(\n",
" page_content=\"Robbers broke into the city bank and stole $1 million in cash.\",\n",
" metadata={\"source\": \"news\"},\n",
")\n",
"\n",
"document_5 = Document(\n",
" page_content=\"Wow! That was an amazing movie. I can't wait to see it again.\",\... | |
151815 | "for doc, score in docs_with_score:\n",
" print(\"-\" * 80)\n",
" print(\"Score: \", score)\n",
" print(doc.page_content)\n",
" print(\"-\" * 80)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Additionally, the similarity_search_with_relevance_scores method... | |
151897 | " this mapping is compatible with model of exact and similarity of l2/cosine\n",
" \"\"\"\n",
" docsearch = EcloudESVectorStore.from_documents(\n",
" docs,\n",
" embeddings,\n",
" es_url=ES_URL,\n",
" user=USER,\n",
" password=PASSWORD,\n",
" ... | |
151901 | "execution_count": 7,
"id": "12eb86d8",
"metadata": {
"id": "12eb86d8",
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"['21cca03c-9089-42d2-b41c-3d156be2b519',\n",
" 'a6ceb967-b552-4802-bb06-c0e95fce386e',\n",
" '3a35fac4-e5f0-493b-bee0-9143b41aedae',\n",... | |
151902 | "cell_type": "code",
"execution_count": 12,
"id": "2db8b6a5",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[Document(metadata={'source': 'news'}, page_content='Robbers broke into the city bank and stole $1 million in cash.'),\n",
" Document(metadata={'source': 'news... | |
151913 | "\"\"\"\n",
"PROMPT = PromptTemplate(\n",
" template=prompt_template, input_variables=[\"context\", \"question\"]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2280140e",
"metadata": {},
"outputs": [],
"source": [
"from langchain.chains import RetrievalQ... | |
151915 | "text": [
"Inserting data...: 100%|██████████| 42/42 [00:15<00:00, 2.68it/s]\n"
]
}
],
"source": [
"from langchain_community.document_loaders import TextLoader\n",
"from langchain_community.vectorstores import MyScale\n",
"\n",
"loader = TextLoader(\"../../how_to/state_of_the_union... | |
151926 | " page_content=\"The top 10 soccer players in the world right now.\",\n",
" metadata={\"source\": \"website\"},\n",
")\n",
"\n",
"document_8 = Document(\n",
" page_content=\"LangGraph is the best framework for building stateful, agentic applications!\",\n",
" metadata={\"source\": \"... | |
151972 | " \"specifically tailored to their preferences.\\nLarge language models naturally follow patterns in input \"\n",
" \"(prompt), and provide coherent completion that follows the same patterns. For that, we want to feed \"\n",
" 'them with several examples in the input (\"few-shot prompt\"), so they can ... | |
151993 | {
"cells": [
{
"cell_type": "markdown",
"id": "2ed9a4c2",
"metadata": {},
"source": [
"# Beautiful Soup\n",
"\n",
">[Beautiful Soup](https://www.crummy.com/software/BeautifulSoup/) is a Python package for parsing \n",
"> HTML and XML documents (including having malformed markup, i.e. non-... | |
151996 | "\n",
"- `rerank-2`\n",
"- `rerank-2-lite`\n",
"- `rerank-1`\n",
"- `rerank-lite-1`"
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "b83dfedb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Document 1:\n",
... | |
152001 | "source": [
"compressed_docs = compression_retriever.invoke(query)\n",
"pretty_print_docs(compressed_docs)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can use this retriever within a QA pipeline"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metada... | |
152022 | \"articleBody\": \"Building agents with LLM (large language model) as its core controller is a cool concept. Several proof-of-concepts demos, such as AutoGPT, GPT-Engineer and BabyAGI, serve as inspiring examples. The potentiality of LLM extends beyond generating well-written copies, stories, essays and programs; it ca... | |
152024 | several cases for your reference: {{ Demonstrations }}. The chat history is recorded as {{ Chat History }}. From this chat history, you can find the path of the user-mentioned resources for your task planning. (2) Model selection: LLM distributes the tasks to expert models, where the request is framed as a multiple-cho... | |
152025 | e.g. \\\\\"command name\\\\\" 5. Use subprocesses for commands that will not terminate within a few minutes Commands: 1. Google Search: \\\\\"google\\\\\", args: \\\\\"input\\\\\": \\\\\"\\\\\" 2. Browse Website: \\\\\"browse_website\\\\\", args: \\\\\"url\\\\\": \\\\\"\\\\\", \\\\\"question\\\\\": \\\\\"\\\\\" 3. Star... | |
152076 | Support\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n.rst\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n.pdf\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n... | |
152082 | Search API\\\\nSerpAPI\\\\nStochasticAI\\\\nUnstructured\\\\nWeights & Biases\\\\nWeaviate\\\\nWolfram Alpha Wrapper\\\\nWriter\\\\n\\\\n\\\\n\\\\nAdditional Resources\\\\n\\\\nLangChainHub\\\\nGlossary\\\\nLangChain Gallery\\\\nDeployments\\\\nTracing\\\\nDiscord\\\\nProduction Support\\\\n\\\\n\\\\n\\\\n\\\\n\\\\n\\\... | |
152101 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# PyPDFium2Loader\n",
"\n",
"\n",
"This notebook provides a quick overview for getting started with PyPDFium2 [document loader](https://python.langchain.com/docs/concepts/#document-loaders). For detailed documentation of al... | |
152114 | {
"cells": [
{
"cell_type": "markdown",
"id": "d9826810",
"metadata": {},
"source": [
"# Copy Paste\n",
"\n",
"This notebook covers how to load a document object from something you just want to copy and paste. In this case, you don't even need to use a DocumentLoader, but rather can just cons... | |
152145 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# PyPDFDirectoryLoader\n",
"\n",
"This loader loads all PDF files from a specific directory.\n",
"\n",
"## Overview\n",
"### Integration details\n",
"\n",
"\n",
"| Class | Package | Local | Serializable ... | |
152205 | {
"cells": [
{
"cell_type": "markdown",
"id": "2dfc4698",
"metadata": {},
"source": [
"# URL\n",
"\n",
"This example covers how to load `HTML` documents from a list of `URLs` into the `Document` format that we can use downstream.\n",
"\n",
"## Unstructured URL Loader\n",
"\n",
... | |
152217 | {
"cells": [
{
"cell_type": "markdown",
"id": "20deed05",
"metadata": {},
"source": [
"# Unstructured\n",
"\n",
"This notebook covers how to use `Unstructured` [document loader](https://python.langchain.com/docs/concepts/#document-loaders) to load files of many types. `Unstructured` currently... | |
152220 | "import requests\n",
"from langchain_unstructured import UnstructuredLoader\n",
"from unstructured_client import UnstructuredClient\n",
"from unstructured_client.utils import BackoffStrategy, RetryConfig\n",
"\n",
"client = UnstructuredClient(\n",
" api_key_auth=os.getenv(\n",
" \"... | |
152248 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "6-0_o3DxsFGi"
},
"source": [
"# Google Memorystore for Redis\n",
"\n",
"> [Google Memorystore for Redis](https://cloud.google.com/memorystore/docs/redis/memorystore-for-redis-overview) is a fully-managed service that is powered ... | |
152258 | {
"cells": [
{
"cell_type": "markdown",
"id": "39af9ecd",
"metadata": {},
"source": [
"# Microsoft Word\n",
"\n",
">[Microsoft Word](https://www.microsoft.com/en-us/microsoft-365/word) is a word processor developed by Microsoft.\n",
"\n",
"This covers how to load `Word` documents into... | |
152334 | {
"cells": [
{
"cell_type": "markdown",
"id": "f70e6118",
"metadata": {},
"source": [
"# Images\n",
"\n",
"This covers how to load images into a document format that we can use downstream with other LangChain modules.\n",
"\n",
"It uses [Unstructured](https://unstructured.io/) to hand... | |
152337 | "to get more details about configuration parameters."
]
},
{
"cell_type": "markdown",
"id": "de97d0ed-d6b1-44e0-b392-1f3d89c762f9",
"metadata": {},
"source": [
"### Basic example"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "50ffeeee-db12-4801-b208-7e32ea3d72ad",
"m... | |
152359 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# JSONLoader\n",
"\n",
"This notebook provides a quick overview for getting started with JSON [document loader](https://python.langchain.com/docs/concepts/#document-loaders). For detailed documentation of all JSONLoader feature... | |
152362 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Google Spanner\n",
"\n",
"> [Spanner](https://cloud.google.com/spanner) is a highly scalable database that combines unlimited scalability with relational semantics, such as secondary indexes, strong consistency, schemas, and ... | |
152379 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Confluence\n",
"\n",
">[Confluence](https://www.atlassian.com/software/confluence) is a wiki collaboration platform that saves and organizes all of the project-related material. `Confluence` is a knowledge base that primarily... | |
152395 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# UnstructuredPDFLoader\n",
"\n",
"## Overview\n",
"\n",
"[Unstructured](https://unstructured-io.github.io/unstructured/) supports a common interface for working with unstructured or semi-structured file formats, such a... | |
152419 | {
"cells": [
{
"cell_type": "markdown",
"id": "39af9ecd",
"metadata": {},
"source": [
"# Microsoft PowerPoint\n",
"\n",
">[Microsoft PowerPoint](https://en.wikipedia.org/wiki/Microsoft_PowerPoint) is a presentation program by Microsoft.\n",
"\n",
"This covers how to load `Microsoft Po... | |
152479 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# CSV\n",
"\n",
">A [comma-separated values (CSV)](https://en.wikipedia.org/wiki/Comma-separated_values) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record co... | |
152481 | "[Document(page_content='Team: Nationals\\n\"Payroll (millions)\": 81.34\\n\"Wins\": 98', metadata={'source': 'Nationals', 'row': 0}), Document(page_content='Team: Reds\\n\"Payroll (millions)\": 82.20\\n\"Wins\": 97', metadata={'source': 'Reds', 'row': 1}), Document(page_content='Team: Yankees\\n\"Payroll (millions)\":... | |
152486 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Google Bigtable\n",
"\n",
"> [Bigtable](https://cloud.google.com/bigtable) is a key-value and wide-column store, ideal for fast access to structured, semi-structured, or unstructured data. Extend your database application to ... | |
152598 | "Use only the provided relationship types and properties in the schema.\n",
"Do not use any other relationship types or properties that are not provided.\n",
"Schema:\n",
"{schema}\n",
"Note: Do not include any explanations or apologies in your responses.\n",
"Do not respond to any questions that mi... | |
152608 | "Node name: 'Publisher', Node properties: [{'property': 'name', 'type': 'str'}]\n",
"\n",
"Relationship properties are the following:\n",
"\n",
"The relationships are the following:\n",
"['(:Game)-[:AVAILABLE_ON]->(:Platform)']\n",
"['(:Game)-[:HAS_GENRE]->(:Genre)']\n",
"['(:Game)-[:PUBLISH... | |
152619 | {
"cells": [
{
"cell_type": "raw",
"id": "675d11f1",
"metadata": {},
"source": [
"---\n",
"keywords: [gemini, GoogleGenerativeAI, gemini-pro]\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "7aZWXpbf0Eph",
"metadata": {
"id": "7aZWXpbf0Eph"
},
"source": [
"# Goog... | |
152649 | {
"cells": [
{
"cell_type": "markdown",
"id": "9e9b7651",
"metadata": {},
"source": [
"# Azure OpenAI\n",
"\n",
":::caution\n",
"You are currently on a page documenting the use of Azure OpenAI [text completion models](/docs/concepts/#llms). The latest and most popular Azure OpenAI models ... | |
152650 | "cell_type": "markdown",
"id": "bbfebea1",
"metadata": {},
"source": [
"We can also print the LLM and see its custom print."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "9c33fa19",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
... | |
152658 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Llama.cpp\n",
"\n",
"[llama-cpp-python](https://github.com/abetlen/llama-cpp-python) is a Python binding for [llama.cpp](https://github.com/ggerganov/llama.cpp).\n",
"\n",
"It supports inference for [many LLMs](https:... | |
152662 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# ExLlamaV2\n",
"\n",
"[ExLlamav2](https://github.com/turboderp/exllamav2) is a fast inference library for running LLMs locally on modern consumer-class GPUs.\n",
"\n",
"It supports inference for GPTQ & EXL2 quantized m... | |
152664 | {
"cells": [
{
"cell_type": "markdown",
"id": "3f0a201c",
"metadata": {},
"source": [
"# Prediction Guard"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4f810331",
"metadata": {
"id": "3RqWPav7AtKL"
},
"outputs": [],
"source": [
"%pip install --upgrad... | |
152668 | {
"cells": [
{
"cell_type": "markdown",
"id": "9597802c",
"metadata": {},
"source": [
"# Runhouse\n",
"\n",
"[Runhouse](https://github.com/run-house/runhouse) allows remote compute and data across environments and users. See the [Runhouse docs](https://www.run.house/docs).\n",
"\n",
"... | |
152679 | ]
}
],
"source": [
"from langchain_community.llms import VLLMOpenAI\n",
"\n",
"llm = VLLMOpenAI(\n",
" openai_api_key=\"EMPTY\",\n",
" openai_api_base=\"http://localhost:8000/v1\",\n",
" model_name=\"tiiuae/falcon-7b\",\n",
" model_kwargs={\"stop\": [\".\"]},\n",
")... | |
152698 | {
"cells": [
{
"cell_type": "markdown",
"id": "959300d4",
"metadata": {},
"source": [
"# Hugging Face Local Pipelines\n",
"\n",
"Hugging Face models can be run locally through the `HuggingFacePipeline` class.\n",
"\n",
"The [Hugging Face Model Hub](https://huggingface.co/models) hosts... | |
152700 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# SageMakerEndpoint\n",
"\n",
"[Amazon SageMaker](https://aws.amazon.com/sagemaker/) is a system that can build, train, and deploy machine learning (ML) models for any use case with fully managed infrastructure, tools, and work... | |
152703 | {
"cells": [
{
"cell_type": "raw",
"id": "67db2992",
"metadata": {},
"source": [
"---\n",
"sidebar_label: Ollama\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "9597802c",
"metadata": {},
"source": [
"# OllamaLLM\n",
"\n",
":::caution\n",
"You are currently... | |
152746 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Huggingface Endpoints\n",
"\n",
">The [Hugging Face Hub](https://huggingface.co/docs/hub/index) is a platform with over 120k models, 20k datasets, and 50k demo apps (Spaces), all open source and publicly available, in an onli... | |
152757 | {
"cells": [
{
"cell_type": "raw",
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"keywords: [pdf, document loader]\n",
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Build a PDF ingestion and Question/Answering s... | |
152760 | {
"cells": [
{
"cell_type": "markdown",
"id": "3ea857b1",
"metadata": {},
"source": [
"# Build a Local RAG Application\n",
"\n",
":::info Prerequisites\n",
"\n",
"This guide assumes familiarity with the following concepts:\n",
"\n",
"- [Chat Models](/docs/concepts/#chat-models... | |
152768 | {
"cells": [
{
"cell_type": "raw",
"id": "63ee3f93",
"metadata": {},
"source": [
"---\n",
"sidebar_position: 0\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "9316da0d",
"metadata": {},
"source": [
"# Build a Simple LLM Application with LCEL\n",
"\n",
"In this ... | |
152777 | " # Empty content in the context of OpenAI means\n",
" # that the model is asking for a tool to be invoked.\n",
" # So we only print non-empty content\n",
" print(content, end=\"|\")\n",
" elif kind == \"on_tool_start\":\n",
" print(\"--\")\n",
... | |
152781 | {
"cells": [
{
"cell_type": "raw",
"id": "2aca8168-62ec-4bba-93f0-73da08cd1920",
"metadata": {},
"source": [
"---\n",
"title: Summarize Text\n",
"sidebar_class_name: hidden\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "cf13f702",
"metadata": {},
"source": [
"# Su... | |
152783 | "## Map-Reduce: summarize long texts via parallelization {#map-reduce}\n",
"\n",
"Let's unpack the map reduce approach. For this, we'll first map each document to an individual summary using an LLM. Then we'll reduce or consolidate those summaries into a single global summary.\n",
"\n",
"Note that the m... | |
152787 | "system_prompt = (\n",
" \"You are an assistant for question-answering tasks. \"\n",
" \"Use the following pieces of retrieved context to answer \"\n",
" \"the question. If you don't know the answer, say that you \"\n",
" \"don't know. Use three sentences maximum and keep the \"\n",
" ... | |
152794 | {
"cells": [
{
"cell_type": "raw",
"id": "cb6f552e-775f-4d84-bc7c-dca94c06a33c",
"metadata": {},
"source": [
"---\n",
"title: Tagging\n",
"sidebar_class_name: hidden\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "a0507a4b",
"metadata": {},
"source": [
"[![Open In ... | |
152796 | {
"cells": [
{
"cell_type": "raw",
"metadata": {
"vscode": {
"languageId": "raw"
}
},
"source": [
"---\n",
"sidebar_position: 1\n",
"keywords: [conversationchain]\n",
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Build a Chatbot"
... | |
152797 | "AIMessage(content=\"I'm sorry, but I don't have access to personal information about individuals unless you've shared it with me in this conversation. How can I assist you today?\", additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 30, 'prompt_tokens': 11, 'total_tokens': 41,... | |
152798 | "source": [
"However, we can always go back to the original conversation (since we are persisting it in a database)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"===================... | |
152805 | {
"cells": [
{
"cell_type": "markdown",
"id": "5630b0ca",
"metadata": {},
"source": [
"# Build a Retrieval Augmented Generation (RAG) App\n",
"\n",
"One of the most powerful applications enabled by LLMs is sophisticated question-answering (Q&A) chatbots. These are applications that can answer... | |
152807 | "which will recursively split the document using common separators like\n",
"new lines until each chunk is the appropriate size. This is the\n",
"recommended text splitter for generic text use cases.\n",
"\n",
"We set `add_start_index=True` so that the character index at which each\n",
"split Docume... | |
152809 | "First: each of these components (`retriever`, `prompt`, `llm`, etc.) are instances of [Runnable](/docs/concepts#langchain-expression-language-lcel). This means that they implement the same methods-- such as sync and async `.invoke`, `.stream`, or `.batch`-- which makes them easier to connect together. They can be conn... | |
152812 | {
"cells": [
{
"cell_type": "markdown",
"id": "bf37a837-7a6a-447b-8779-38f26c585887",
"metadata": {},
"source": [
"# Vector stores and retrievers\n",
"\n",
"This tutorial will familiarize you with LangChain's vector store and retriever abstractions. These abstractions are designed to support ... | |
152813 | "Calling `.from_documents` here will add the documents to the vector store. [VectorStore](https://python.langchain.com/api_reference/core/vectorstores/langchain_core.vectorstores.VectorStore.html) implements methods for adding documents that can also be called after the object is instantiated. Most implementations will... | |
152814 | "id": "f1461582-e569-4326-bd95-510f72edf019",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[[Document(page_content='Cats are independent pets that often enjoy their own space.', metadata={'source': 'mammal-pets-doc'})],\n",
" [Document(page_content='Goldfish are popular p... | |
152815 | {
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Build a Question/Answering system over SQL data\n",
"\n",
":::info Prerequisites\n",
"\n",
"This guide assumes familiarity with the following concepts:\n",
"\n",
"- [Chaining runnables](/docs/how_to/sequence/)... | |
152817 | "\n",
"To initialize the agent we'll use the `SQLDatabaseToolkit` to create a bunch of tools:\n",
"\n",
"* Create and execute queries\n",
"* Check query syntax\n",
"* Retrieve table descriptions\n",
"* ... and more"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {}... | |
152818 | "{'agent': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'id': 'call_pp3BBD1hwpdwskUj63G3tgaQ', 'function': {'arguments': '{}', 'name': 'sql_db_list_tables'}, 'type': 'function'}]}, response_metadata={'token_usage': {'completion_tokens': 12, 'prompt_tokens': 699, 'total_tokens': 711}, 'model_na... | |
152828 | "HumanMessage": {"\ud83e\udd9c\ufe0f\ud83c\udfd3 LangServe": "https://python.langchain.com/docs/langserve/", "Conceptual guide": "https://python.langchain.com/docs/concepts/", "Build an Agent with AgentExecutor (Legacy)": "https://python.langchain.com/docs/how_to/agent_executor/", "How to add a semantic layer over grap... | |
152830 | "PromptTemplate": {"Conceptual guide": "https://python.langchain.com/docs/concepts/", "# Example": "https://python.langchain.com/docs/versions/migrating_chains/map_rerank_docs_chain/", "# Legacy": "https://python.langchain.com/docs/versions/migrating_chains/llm_router_chain/", "How to better prompt when doing SQL quest... | |
152833 | "Document": {"# Example": "https://python.langchain.com/docs/versions/migrating_chains/map_rerank_docs_chain/", "# Basic example (short documents)": "https://python.langchain.com/docs/versions/migrating_chains/map_reduce_chain/", "How to handle long text when doing extraction": "https://python.langchain.com/docs/how_to... | |
152836 | "create_stuff_documents_chain": {"# Example": "https://python.langchain.com/docs/versions/migrating_chains/stuff_docs_chain/", "Load docs": "https://python.langchain.com/docs/versions/migrating_chains/retrieval_qa/", "How to reorder retrieved results to mitigate the \"lost in the middle\" effect": "https://python.langc... | |
152840 | {"Load docs": "https://python.langchain.com/docs/versions/migrating_chains/retrieval_qa/", "Build an Agent with AgentExecutor (Legacy)": "https://python.langchain.com/docs/how_to/agent_executor/", "How to handle long text when doing extraction": "https://python.langchain.com/docs/how_to/extraction_long_text/", "How to ... | |
152841 | "OpenAI": "https://python.langchain.com/docs/integrations/providers/openai/", "Xata": "https://python.langchain.com/docs/integrations/vectorstores/xata/", "Confident": "https://python.langchain.com/docs/integrations/callbacks/confident/", "UpTrain": "https://python.langchain.com/docs/integrations/callbacks/uptrain/", "... | |
152843 | "CharacterTextSplitter": {"# Basic example (short documents)": "https://python.langchain.com/docs/versions/migrating_chains/map_reduce_chain/", "How to handle long text when doing extraction": "https://python.langchain.com/docs/how_to/extraction_long_text/", "How to split by character": "https://python.langchain.com/do... | |
152844 | , "acollapse_docs": {"# Basic example (short documents)": "https://python.langchain.com/docs/versions/migrating_chains/map_reduce_chain/", "How to summarize text through parallelization": "https://python.langchain.com/docs/how_to/summarize_map_reduce/", "Summarize Text": "https://python.langchain.com/docs/tutorials/sum... | |
152845 | "RunnablePassthrough": {"Load docs": "https://python.langchain.com/docs/versions/migrating_chains/retrieval_qa/", "# Legacy": "https://python.langchain.com/docs/versions/migrating_chains/llm_router_chain/", "How to add values to a chain's state": "https://python.langchain.com/docs/how_to/assign/", "How to route between... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.