id stringlengths 14 16 | source stringlengths 49 117 | text stringlengths 16 2.73k |
|---|---|---|
e300140a6ac9-0 | https://python.langchain.com/en/latest/_modules/langchain/chains/api/base.html | Source code for langchain.chains.api.base
"""Chain that makes API calls and summarizes the responses to answer a question."""
from __future__ import annotations
from typing import Any, Dict, List, Optional
from pydantic import Field, root_validator
from langchain.base_language import BaseLanguageModel
from langchain.ca... |
e300140a6ac9-1 | https://python.langchain.com/en/latest/_modules/langchain/chains/api/base.html | raise ValueError(
f"Input variables should be {expected_vars}, got {input_vars}"
)
return values
@root_validator(pre=True)
def validate_api_answer_prompt(cls, values: Dict) -> Dict:
"""Check that api answer prompt expects the right variables."""
input_vars = v... |
e300140a6ac9-2 | https://python.langchain.com/en/latest/_modules/langchain/chains/api/base.html | run_manager: Optional[AsyncCallbackManagerForChainRun] = None,
) -> Dict[str, str]:
_run_manager = run_manager or AsyncCallbackManagerForChainRun.get_noop_manager()
question = inputs[self.question_key]
api_url = await self.api_request_chain.apredict(
question=question,
... |
e300140a6ac9-3 | https://python.langchain.com/en/latest/_modules/langchain/chains/api/base.html | api_request_chain=get_request_chain,
api_answer_chain=get_answer_chain,
requests_wrapper=requests_wrapper,
api_docs=api_docs,
**kwargs,
)
@property
def _chain_type(self) -> str:
return "api_chain"
By Harrison Chase
© Copyright 2023, Harr... |
15c71f383100-0 | https://python.langchain.com/en/latest/_modules/langchain/chains/api/openapi/chain.html | Source code for langchain.chains.api.openapi.chain
"""Chain that makes API calls and summarizes the responses to answer a question."""
from __future__ import annotations
import json
from typing import Any, Dict, List, NamedTuple, Optional, cast
from pydantic import BaseModel, Field
from requests import Response
from la... |
15c71f383100-1 | https://python.langchain.com/en/latest/_modules/langchain/chains/api/openapi/chain.html | def output_keys(self) -> List[str]:
"""Expect output key.
:meta private:
"""
if not self.return_intermediate_steps:
return [self.output_key]
else:
return [self.output_key, "intermediate_steps"]
def _construct_path(self, args: Dict[str, str]) -> str:
... |
15c71f383100-2 | https://python.langchain.com/en/latest/_modules/langchain/chains/api/openapi/chain.html | query_params = self._extract_query_params(args)
return {
"url": path,
"data": body_params,
"params": query_params,
}
def _get_output(self, output: str, intermediate_steps: dict) -> dict:
"""Return the output from the API call."""
if self.return_int... |
15c71f383100-3 | https://python.langchain.com/en/latest/_modules/langchain/chains/api/openapi/chain.html | method_str = str(self.api_operation.method.value)
response_text = (
f"{api_response.status_code}: {api_response.reason}"
+ f"\nFor {method_str.upper()} {request_args['url']}\n"
+ f"Called with args: {request_args['params']}"
)
... |
15c71f383100-4 | https://python.langchain.com/en/latest/_modules/langchain/chains/api/openapi/chain.html | operation,
requests=requests,
llm=llm,
return_intermediate_steps=return_intermediate_steps,
**kwargs,
)
[docs] @classmethod
def from_api_operation(
cls,
operation: APIOperation,
llm: BaseLanguageModel,
requests: Optional[Requ... |
15c71f383100-5 | https://python.langchain.com/en/latest/_modules/langchain/chains/api/openapi/chain.html | Last updated on Jun 04, 2023. |
9f7a0feccdd1-0 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_checker/base.html | Source code for langchain.chains.llm_checker.base
"""Chain for question-answering with self-verification."""
from __future__ import annotations
import warnings
from typing import Any, Dict, List, Optional
from pydantic import Extra, root_validator
from langchain.base_language import BaseLanguageModel
from langchain.cal... |
9f7a0feccdd1-1 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_checker/base.html | list_assertions_chain,
check_assertions_chain,
revised_answer_chain,
]
question_to_checked_assertions_chain = SequentialChain(
chains=chains,
input_variables=["question"],
output_variables=["revised_statement"],
verbose=True,
)
return question_to_checked_a... |
9f7a0feccdd1-2 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_checker/base.html | "Directly instantiating an LLMCheckerChain with an llm is deprecated. "
"Please instantiate with question_to_checked_assertions_chain "
"or using the from_llm class method."
)
if (
"question_to_checked_assertions_chain" not in values
... |
9f7a0feccdd1-3 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_checker/base.html | return {self.output_key: output["revised_statement"]}
@property
def _chain_type(self) -> str:
return "llm_checker_chain"
[docs] @classmethod
def from_llm(
cls,
llm: BaseLanguageModel,
create_draft_answer_prompt: PromptTemplate = CREATE_DRAFT_ANSWER_PROMPT,
list_ass... |
f9ebcbcb4293-0 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_bash/base.html | Source code for langchain.chains.llm_bash.base
"""Chain that interprets a prompt and executes bash code to perform bash operations."""
from __future__ import annotations
import logging
import warnings
from typing import Any, Dict, List, Optional
from pydantic import Extra, Field, root_validator
from langchain.base_lang... |
f9ebcbcb4293-1 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_bash/base.html | if "llm" in values:
warnings.warn(
"Directly instantiating an LLMBashChain with an llm is deprecated. "
"Please instantiate with llm_chain or using the from_llm class method."
)
if "llm_chain" not in values and values["llm"] is not None:
... |
f9ebcbcb4293-2 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_bash/base.html | parser = self.llm_chain.prompt.output_parser
command_list = parser.parse(t) # type: ignore[union-attr]
except OutputParserException as e:
_run_manager.on_chain_error(e, verbose=self.verbose)
raise e
if self.verbose:
_run_manager.on_text("\nCode: ", verbos... |
9b5105343417-0 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_math/base.html | Source code for langchain.chains.llm_math.base
"""Chain that interprets a prompt and executes python code to do math."""
from __future__ import annotations
import math
import re
import warnings
from typing import Any, Dict, List, Optional
import numexpr
from pydantic import Extra, root_validator
from langchain.base_lan... |
9b5105343417-1 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_math/base.html | "Directly instantiating an LLMMathChain with an llm is deprecated. "
"Please instantiate with llm_chain argument or using the from_llm "
"class method."
)
if "llm_chain" not in values and values["llm"] is not None:
prompt = values.get("prompt", PRO... |
9b5105343417-2 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_math/base.html | llm_output = llm_output.strip()
text_match = re.search(r"^```text(.*?)```", llm_output, re.DOTALL)
if text_match:
expression = text_match.group(1)
output = self._evaluate_expression(expression)
run_manager.on_text("\nAnswer: ", verbose=self.verbose)
run_ma... |
9b5105343417-3 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_math/base.html | raise ValueError(f"unknown format from LLM: {llm_output}")
return {self.output_key: answer}
def _call(
self,
inputs: Dict[str, str],
run_manager: Optional[CallbackManagerForChainRun] = None,
) -> Dict[str, str]:
_run_manager = run_manager or CallbackManagerForChainRun.get... |
9b5105343417-4 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_math/base.html | return cls(llm_chain=llm_chain, **kwargs)
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 04, 2023. |
ea692b757e7d-0 | https://python.langchain.com/en/latest/_modules/langchain/chains/combine_documents/base.html | Source code for langchain.chains.combine_documents.base
"""Base interface for chains combining documents."""
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional, Tuple
from pydantic import Field
from langchain.callbacks.manager import (
AsyncCallbackManagerForChainRun,
CallbackManag... |
ea692b757e7d-1 | https://python.langchain.com/en/latest/_modules/langchain/chains/combine_documents/base.html | def output_keys(self) -> List[str]:
"""Return output key.
:meta private:
"""
return [self.output_key]
def prompt_length(self, docs: List[Document], **kwargs: Any) -> Optional[int]:
"""Return the prompt length given the documents passed in.
Returns None if the method d... |
ea692b757e7d-2 | https://python.langchain.com/en/latest/_modules/langchain/chains/combine_documents/base.html | _run_manager = run_manager or AsyncCallbackManagerForChainRun.get_noop_manager()
docs = inputs[self.input_key]
# Other keys are assumed to be needed for LLM prediction
other_keys = {k: v for k, v in inputs.items() if k != self.input_key}
output, extra_return_dict = await self.acombine_do... |
ea692b757e7d-3 | https://python.langchain.com/en/latest/_modules/langchain/chains/combine_documents/base.html | other_keys[self.combine_docs_chain.input_key] = docs
return self.combine_docs_chain(
other_keys, return_only_outputs=True, callbacks=_run_manager.get_child()
)
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 04, 2023. |
f34ac9eedf86-0 | https://python.langchain.com/en/latest/_modules/langchain/chains/conversational_retrieval/base.html | Source code for langchain.chains.conversational_retrieval.base
"""Chain for chatting with a vector database."""
from __future__ import annotations
import warnings
from abc import abstractmethod
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
from pydantic import Extra, Fiel... |
f34ac9eedf86-1 | https://python.langchain.com/en/latest/_modules/langchain/chains/conversational_retrieval/base.html | ai = "Assistant: " + dialogue_turn[1]
buffer += "\n" + "\n".join([human, ai])
else:
raise ValueError(
f"Unsupported chat history format: {type(dialogue_turn)}."
f" Full chat history: {chat_history} "
)
return buffer
class BaseConversational... |
f34ac9eedf86-2 | https://python.langchain.com/en/latest/_modules/langchain/chains/conversational_retrieval/base.html | question = inputs["question"]
get_chat_history = self.get_chat_history or _get_chat_history
chat_history_str = get_chat_history(inputs["chat_history"])
if chat_history_str:
callbacks = _run_manager.get_child()
new_question = self.question_generator.run(
qu... |
f34ac9eedf86-3 | https://python.langchain.com/en/latest/_modules/langchain/chains/conversational_retrieval/base.html | docs = await self._aget_docs(new_question, inputs)
new_inputs = inputs.copy()
new_inputs["question"] = new_question
new_inputs["chat_history"] = chat_history_str
answer = await self.combine_docs_chain.arun(
input_documents=docs, callbacks=_run_manager.get_child(), **new_input... |
f34ac9eedf86-4 | https://python.langchain.com/en/latest/_modules/langchain/chains/conversational_retrieval/base.html | def _get_docs(self, question: str, inputs: Dict[str, Any]) -> List[Document]:
docs = self.retriever.get_relevant_documents(question)
return self._reduce_tokens_below_limit(docs)
async def _aget_docs(self, question: str, inputs: Dict[str, Any]) -> List[Document]:
docs = await self.retriever.a... |
f34ac9eedf86-5 | https://python.langchain.com/en/latest/_modules/langchain/chains/conversational_retrieval/base.html | """Chain for chatting with a vector database."""
vectorstore: VectorStore = Field(alias="vectorstore")
top_k_docs_for_context: int = 4
search_kwargs: dict = Field(default_factory=dict)
@property
def _chain_type(self) -> str:
return "chat-vector-db"
@root_validator()
def raise_depreca... |
f34ac9eedf86-6 | https://python.langchain.com/en/latest/_modules/langchain/chains/conversational_retrieval/base.html | chain_type=chain_type,
**combine_docs_chain_kwargs,
)
condense_question_chain = LLMChain(llm=llm, prompt=condense_question_prompt)
return cls(
vectorstore=vectorstore,
combine_docs_chain=doc_chain,
question_generator=condense_question_chain,
... |
82088121f07d-0 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_summarization_checker/base.html | Source code for langchain.chains.llm_summarization_checker.base
"""Chain for summarization with self-verification."""
from __future__ import annotations
import warnings
from pathlib import Path
from typing import Any, Dict, List, Optional
from pydantic import Extra, root_validator
from langchain.base_language import Ba... |
82088121f07d-1 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_summarization_checker/base.html | llm=llm,
prompt=check_assertions_prompt,
output_key="checked_assertions",
verbose=verbose,
),
LLMChain(
llm=llm,
prompt=revised_summary_prompt,
output_key="revised_summary",
verbose=ve... |
82088121f07d-2 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_summarization_checker/base.html | max_checks: int = 2
"""Maximum number of times to check the assertions. Default to double-checking."""
class Config:
"""Configuration for this pydantic object."""
extra = Extra.forbid
arbitrary_types_allowed = True
@root_validator(pre=True)
def raise_deprecation(cls, values: Dict... |
82088121f07d-3 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_summarization_checker/base.html | _run_manager = run_manager or CallbackManagerForChainRun.get_noop_manager()
all_true = False
count = 0
output = None
original_input = inputs[self.input_key]
chain_input = original_input
while not all_true and count < self.max_checks:
output = self.sequential_c... |
82088121f07d-4 | https://python.langchain.com/en/latest/_modules/langchain/chains/llm_summarization_checker/base.html | © Copyright 2023, Harrison Chase.
Last updated on Jun 04, 2023. |
ac131d5ecc94-0 | https://python.langchain.com/en/latest/_modules/langchain/chains/flare/base.html | Source code for langchain.chains.flare.base
from __future__ import annotations
import re
from abc import abstractmethod
from typing import Any, Dict, List, Optional, Sequence, Tuple
import numpy as np
from pydantic import Field
from langchain.base_language import BaseLanguageModel
from langchain.callbacks.manager impor... |
ac131d5ecc94-1 | https://python.langchain.com/en/latest/_modules/langchain/chains/flare/base.html | )
def _extract_tokens_and_log_probs(
self, generations: List[Generation]
) -> Tuple[Sequence[str], Sequence[float]]:
tokens = []
log_probs = []
for gen in generations:
if gen.generation_info is None:
raise ValueError
tokens.extend(gen.gener... |
ac131d5ecc94-2 | https://python.langchain.com/en/latest/_modules/langchain/chains/flare/base.html | response_chain: _ResponseChain = Field(default_factory=_OpenAIResponseChain)
output_parser: FinishedOutputParser = Field(default_factory=FinishedOutputParser)
retriever: BaseRetriever
min_prob: float = 0.2
min_token_gap: int = 5
num_pad_tokens: int = 2
max_iter: int = 10
start_with_retrieval... |
ac131d5ecc94-3 | https://python.langchain.com/en/latest/_modules/langchain/chains/flare/base.html | }
for span in low_confidence_spans
]
callbacks = _run_manager.get_child()
question_gen_outputs = self.question_generator_chain.apply(
question_gen_inputs, callbacks=callbacks
)
questions = [
output[self.question_generator_chain.output_keys[0]]
... |
ac131d5ecc94-4 | https://python.langchain.com/en/latest/_modules/langchain/chains/flare/base.html | return {self.output_keys[0]: final_response}
continue
marginal, finished = self._do_retrieval(
low_confidence_spans,
_run_manager,
user_input,
response,
initial_response,
)
response = resp... |
7634f50faeca-0 | https://python.langchain.com/en/latest/_modules/langchain/chains/conversation/base.html | Source code for langchain.chains.conversation.base
"""Chain that carries on a conversation and calls an LLM."""
from typing import Dict, List
from pydantic import Extra, Field, root_validator
from langchain.chains.conversation.prompt import PROMPT
from langchain.chains.llm import LLMChain
from langchain.memory.buffer i... |
7634f50faeca-1 | https://python.langchain.com/en/latest/_modules/langchain/chains/conversation/base.html | f"({memory_keys}) - please provide keys that don't overlap."
)
prompt_variables = values["prompt"].input_variables
expected_keys = memory_keys + [input_key]
if set(expected_keys) != set(prompt_variables):
raise ValueError(
"Got unexpected prompt input vari... |
90c9a7d2fe1e-0 | https://python.langchain.com/en/latest/additional_resources/model_laboratory.html | .ipynb
.pdf
Model Comparison
Model Comparison#
Constructing your language model application will likely involved choosing between many different options of prompts, models, and even chains to use. When doing so, you will want to compare these different options on different inputs in an easy, flexible, and intuitive way... |
90c9a7d2fe1e-1 | https://python.langchain.com/en/latest/additional_resources/model_laboratory.html | prompt = PromptTemplate(template="What is the capital of {state}?", input_variables=["state"])
model_lab_with_prompt = ModelLaboratory.from_llms(llms, prompt=prompt)
model_lab_with_prompt.compare("New York")
Input:
New York
OpenAI
Params: {'model': 'text-davinci-002', 'temperature': 0.0, 'max_tokens': 256, 'top_p': 1, ... |
90c9a7d2fe1e-2 | https://python.langchain.com/en/latest/additional_resources/model_laboratory.html | model_lab = ModelLaboratory(chains, names=names)
model_lab.compare("What is the hometown of the reigning men's U.S. Open champion?")
Input:
What is the hometown of the reigning men's U.S. Open champion?
OpenAI
Params: {'model': 'text-davinci-002', 'temperature': 0.0, 'max_tokens': 256, 'top_p': 1, 'frequency_penalty': ... |
90c9a7d2fe1e-3 | https://python.langchain.com/en/latest/additional_resources/model_laboratory.html | © Copyright 2023, Harrison Chase.
Last updated on Jun 04, 2023. |
7e9d23fc2918-0 | https://python.langchain.com/en/latest/additional_resources/tracing.html | .md
.pdf
Tracing
Contents
Tracing Walkthrough
Changing Sessions
Tracing#
By enabling tracing in your LangChain runs, you’ll be able to more effectively visualize, step through, and debug your chains and agents.
First, you should install tracing and set up your environment properly.
You can use either a locally hosted... |
7e9d23fc2918-1 | https://python.langchain.com/en/latest/additional_resources/tracing.html | To initially record traces to a session other than "default", you can set the LANGCHAIN_SESSION environment variable to the name of the session you want to record to:
import os
os.environ["LANGCHAIN_TRACING"] = "true"
os.environ["LANGCHAIN_SESSION"] = "my_session" # Make sure this session actually exists. You can creat... |
4701c3d95d4d-0 | https://python.langchain.com/en/latest/additional_resources/youtube.html | .md
.pdf
YouTube
Contents
⛓️Official LangChain YouTube channel⛓️
Introduction to LangChain with Harrison Chase, creator of LangChain
Videos (sorted by views)
YouTube#
This is a collection of LangChain videos on YouTube.
⛓️Official LangChain YouTube channel⛓️#
Introduction to LangChain with Harrison Chase, creator of ... |
4701c3d95d4d-1 | https://python.langchain.com/en/latest/additional_resources/youtube.html | How to Use Langchain With Zapier | Write and Send Email with GPT-3 | OpenAI API Tutorial by StarMorph AI
Use Your Locally Stored Files To Get Response From GPT - OpenAI | Langchain | Python by Shweta Lodha
Langchain JS | How to Use GPT-3, GPT-4 to Reference your own Data | OpenAI Embeddings Intro by StarMorph AI
The ea... |
4701c3d95d4d-2 | https://python.langchain.com/en/latest/additional_resources/youtube.html | BabyAGI + GPT-4 Langchain Agent with Internet Access by tylerwhatsgood
Learning LLM Agents. How does it actually work? LangChain, AutoGPT & OpenAI by Arnoldas Kemeklis
Get Started with LangChain in Node.js by Developers Digest
LangChain + OpenAI tutorial: Building a Q&A system w/ own text data by Samuel Chan
Langchain ... |
4701c3d95d4d-3 | https://python.langchain.com/en/latest/additional_resources/youtube.html | ⛓️ Simple App to Question Your Docs: Leveraging Streamlit, Hugging Face Spaces, LangChain, and Claude! by Chris Alexiuk
⛓️ LANGCHAIN AI- ConstitutionalChainAI + Databutton AI ASSISTANT Web App by Avra
⛓️ LANGCHAIN AI AUTONOMOUS AGENT WEB APP - 👶 BABY AGI 🤖 with EMAIL AUTOMATION using DATABUTTON by Avra
⛓️ The Future ... |
4701c3d95d4d-4 | https://python.langchain.com/en/latest/additional_resources/youtube.html | ⛓️ Using Langchain (and Replit) through Tana, ask Google/Wikipedia/Wolfram Alpha to fill out a table by Stian Håklev
⛓️ Langchain PDF App (GUI) | Create a ChatGPT For Your PDF in Python by Alejandro AO - Software & Ai
⛓️ Auto-GPT with LangChain 🔥 | Create Your Own Personal AI Assistant by Data Science Basics
⛓️ Create... |
4701c3d95d4d-5 | https://python.langchain.com/en/latest/additional_resources/youtube.html | Last updated on Jun 04, 2023. |
204366cbeff1-0 | https://python.langchain.com/en/latest/integrations/google_cloud_storage.html | .md
.pdf
Google Cloud Storage
Contents
Installation and Setup
Document Loader
Google Cloud Storage#
Google Cloud Storage is a managed service for storing unstructured data.
Installation and Setup#
First, you need to install google-cloud-bigquery python package.
pip install google-cloud-storage
Document Loader#
There ... |
03f72bdf9822-0 | https://python.langchain.com/en/latest/integrations/diffbot.html | .md
.pdf
Diffbot
Contents
Installation and Setup
Document Loader
Diffbot#
Diffbot is a service to read web pages. Unlike traditional web scraping tools,
Diffbot doesn’t require any rules to read the content on a page.
It starts with computer vision, which classifies a page into one of 20 possible types. Content is th... |
d6625afab012-0 | https://python.langchain.com/en/latest/integrations/modern_treasury.html | .md
.pdf
Modern Treasury
Contents
Installation and Setup
Document Loader
Modern Treasury#
Modern Treasury simplifies complex payment operations. It is a unified platform to power products and processes that move money.
Connect to banks and payment systems
Track transactions and balances in real-time
Automate payment ... |
ca10336973c3-0 | https://python.langchain.com/en/latest/integrations/figma.html | .md
.pdf
Figma
Contents
Installation and Setup
Document Loader
Figma#
Figma is a collaborative web application for interface design.
Installation and Setup#
The Figma API requires an access token, node_ids, and a file key.
The file key can be pulled from the URL. https://www.figma.com/file/{filekey}/sampleFilename
N... |
a7410cc7ff8c-0 | https://python.langchain.com/en/latest/integrations/whylabs_profiling.html | .ipynb
.pdf
WhyLabs
Contents
Installation and Setup
Callbacks
WhyLabs#
WhyLabs is an observability platform designed to monitor data pipelines and ML applications for data quality regressions, data drift, and model performance degradation. Built on top of an open-source package called whylogs, the platform enables Da... |
a7410cc7ff8c-1 | https://python.langchain.com/en/latest/integrations/whylabs_profiling.html | Note: the callback supports directly passing in these variables to the callback, when no auth is directly passed in it will default to the environment. Passing in auth directly allows for writing profiles to multiple projects or organizations in WhyLabs.
Callbacks#
Here’s a single LLM integration with OpenAI, which wil... |
a7410cc7ff8c-2 | https://python.langchain.com/en/latest/integrations/whylabs_profiling.html | generations=[[Generation(text='\n\n1. 123-45-6789\n2. 987-65-4321\n3. 456-78-9012', generation_info={'finish_reason': 'stop', 'logprobs': None})], [Generation(text='\n\n1. johndoe@example.com\n2. janesmith@example.com\n3. johnsmith@example.com', generation_info={'finish_reason': 'stop', 'logprobs': None})], [Generation... |
a2fe97b253df-0 | https://python.langchain.com/en/latest/integrations/databricks.html | .ipynb
.pdf
Databricks
Contents
Installation and Setup
Connecting to Databricks
Syntax
Required Parameters
Optional Parameters
Examples
SQL Chain example
SQL Database Agent example
Databricks#
This notebook covers how to connect to the Databricks runtimes and Databricks SQL using the SQLDatabase wrapper of LangChain.... |
a2fe97b253df-1 | https://python.langchain.com/en/latest/integrations/databricks.html | cluster_id: The cluster ID in the Databricks Runtime. If running in a Databricks notebook and both ‘warehouse_id’ and ‘cluster_id’ are None, it uses the ID of the cluster the notebook is attached to.
engine_args: The arguments to be used when connecting Databricks.
**kwargs: Additional keyword arguments for the SQLData... |
a2fe97b253df-2 | https://python.langchain.com/en/latest/integrations/databricks.html | This example demonstrates the use of the SQL Database Agent for answering questions over a Databricks database.
from langchain.agents import create_sql_agent
from langchain.agents.agent_toolkits import SQLDatabaseToolkit
toolkit = SQLDatabaseToolkit(db=db, llm=llm)
agent = create_sql_agent(
llm=llm,
toolkit=too... |
a2fe97b253df-3 | https://python.langchain.com/en/latest/integrations/databricks.html | 2016-02-17 17:13:57+00:00 2016-02-17 17:17:55+00:00 0.7 5.0 10103 10023
*/
Thought:The trips table has the necessary columns for trip distance and duration. I will write a query to find the longest trip distance and its duration.
Action: query_checker_sql_db
Action Input: SELECT trip_distance, tpep_dropoff_datetime - t... |
e704424bfd44-0 | https://python.langchain.com/en/latest/integrations/atlas.html | .md
.pdf
AtlasDB
Contents
Installation and Setup
Wrappers
VectorStore
AtlasDB#
This page covers how to use Nomic’s Atlas ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific Atlas wrappers.
Installation and Setup#
Install the Python package with pip install ... |
7fb51268d396-0 | https://python.langchain.com/en/latest/integrations/pgvector.html | .md
.pdf
PGVector
Contents
Installation
Setup
Wrappers
VectorStore
Usage
PGVector#
This page covers how to use the Postgres PGVector ecosystem within LangChain
It is broken into two parts: installation and setup, and then references to specific PGVector wrappers.
Installation#
Install the Python package with pip inst... |
23f2a46f4f1f-0 | https://python.langchain.com/en/latest/integrations/git.html | .md
.pdf
Git
Contents
Installation and Setup
Document Loader
Git#
Git is a distributed version control system that tracks changes in any set of computer files, usually used for coordinating work among programmers collaboratively developing source code during software development.
Installation and Setup#
First, you ne... |
5cbbfa7b6e97-0 | https://python.langchain.com/en/latest/integrations/aws_s3.html | .md
.pdf
AWS S3 Directory
Contents
Installation and Setup
Document Loader
AWS S3 Directory#
Amazon Simple Storage Service (Amazon S3) is an object storage service.
AWS S3 Directory
AWS S3 Buckets
Installation and Setup#
pip install boto3
Document Loader#
See a usage example for S3DirectoryLoader.
See a usage example ... |
1a104edcf394-0 | https://python.langchain.com/en/latest/integrations/apify.html | .md
.pdf
Apify
Contents
Overview
Installation and Setup
Wrappers
Utility
Loader
Apify#
This page covers how to use Apify within LangChain.
Overview#
Apify is a cloud platform for web scraping and data extraction,
which provides an ecosystem of more than a thousand
ready-made apps called Actors for various scraping, c... |
fdb0d0a45d10-0 | https://python.langchain.com/en/latest/integrations/notion.html | .md
.pdf
Notion DB
Contents
Installation and Setup
Document Loader
Notion DB#
Notion is a collaboration platform with modified Markdown support that integrates kanban
boards, tasks, wikis and databases. It is an all-in-one workspace for notetaking, knowledge and data management,
and project and task management.
Insta... |
4a5f3298b8aa-0 | https://python.langchain.com/en/latest/integrations/evernote.html | .md
.pdf
EverNote
Contents
Installation and Setup
Document Loader
EverNote#
EverNote is intended for archiving and creating notes in which photos, audio and saved web content can be embedded. Notes are stored in virtual “notebooks” and can be tagged, annotated, edited, searched, and exported.
Installation and Setup#
... |
c61052e26159-0 | https://python.langchain.com/en/latest/integrations/bedrock.html | .md
.pdf
Amazon Bedrock
Contents
Installation and Setup
LLM
Text Embedding Models
Amazon Bedrock#
Amazon Bedrock is a fully managed service that makes FMs from leading AI startups and Amazon available via an API, so you can choose from a wide range of FMs to find the model that is best suited for your use case.
Insta... |
98edc3b9625c-0 | https://python.langchain.com/en/latest/integrations/microsoft_onedrive.html | .md
.pdf
Microsoft OneDrive
Contents
Installation and Setup
Document Loader
Microsoft OneDrive#
Microsoft OneDrive (formerly SkyDrive) is a file-hosting service operated by Microsoft.
Installation and Setup#
First, you need to install a python package.
pip install o365
Then follow instructions here.
Document Loader#
... |
6fa80f92f87e-0 | https://python.langchain.com/en/latest/integrations/reddit.html | .md
.pdf
Reddit
Contents
Installation and Setup
Document Loader
Reddit#
Reddit is an American social news aggregation, content rating, and discussion website.
Installation and Setup#
First, you need to install a python package.
pip install praw
Make a Reddit Application and initialize the loader with with your Reddit... |
bd814911374f-0 | https://python.langchain.com/en/latest/integrations/sklearn.html | .md
.pdf
scikit-learn
Contents
Installation and Setup
Wrappers
VectorStore
scikit-learn#
This page covers how to use the scikit-learn package within LangChain.
It is broken into two parts: installation and setup, and then references to specific scikit-learn wrappers.
Installation and Setup#
Install the Python package... |
346b3688d5f8-0 | https://python.langchain.com/en/latest/integrations/slack.html | .md
.pdf
Slack
Contents
Installation and Setup
Document Loader
Slack#
Slack is an instant messaging program.
Installation and Setup#
There isn’t any special setup for it.
Document Loader#
See a usage example.
from langchain.document_loaders import SlackDirectoryLoader
previous
scikit-learn
next
spaCy
Contents
Ins... |
b7e7cc22587b-0 | https://python.langchain.com/en/latest/integrations/vectara.html | .md
.pdf
Vectara
Contents
Installation and Setup
VectorStore
Vectara#
What is Vectara?
Vectara Overview:
Vectara is developer-first API platform for building conversational search applications
To use Vectara - first sign up and create an account. Then create a corpus and an API key for indexing and searching.
You can... |
b7e7cc22587b-1 | https://python.langchain.com/en/latest/integrations/vectara.html | © Copyright 2023, Harrison Chase.
Last updated on Jun 04, 2023. |
b1d1b363f340-0 | https://python.langchain.com/en/latest/integrations/argilla.html | .md
.pdf
Argilla
Contents
Installation and Setup
Tracking
Argilla#
Argilla is an open-source data curation platform for LLMs.
Using Argilla, everyone can build robust language models through faster data curation
using both human and machine feedback. We provide support for each step in the MLOps cycle,
from data labe... |
823dd469de5c-0 | https://python.langchain.com/en/latest/integrations/twitter.html | .md
.pdf
Twitter
Contents
Installation and Setup
Document Loader
Twitter#
Twitter is an online social media and social networking service.
Installation and Setup#
pip install tweepy
We must initialize the loader with the Twitter API token, and we need to set up the Twitter username.
Document Loader#
See a usage examp... |
96464fdebd98-0 | https://python.langchain.com/en/latest/integrations/vespa.html | .md
.pdf
Vespa
Contents
Installation and Setup
Retriever
Vespa#
Vespa is a fully featured search engine and vector database.
It supports vector search (ANN), lexical search, and search in structured data, all in the same query.
Installation and Setup#
pip install pyvespa
Retriever#
See a usage example.
from langchain... |
836555615166-0 | https://python.langchain.com/en/latest/integrations/zilliz.html | .md
.pdf
Zilliz
Contents
Installation and Setup
Vectorstore
Zilliz#
Zilliz Cloud is a fully managed service on cloud for LF AI Milvus®,
Installation and Setup#
Install the Python SDK:
pip install pymilvus
Vectorstore#
A wrapper around Zilliz indexes allows you to use it as a vectorstore,
whether for semantic search o... |
e8bb44831711-0 | https://python.langchain.com/en/latest/integrations/confluence.html | .md
.pdf
Confluence
Contents
Installation and Setup
Document Loader
Confluence#
Confluence is a wiki collaboration platform that saves and organizes all of the project-related material. Confluence is a knowledge base that primarily handles content management activities.
Installation and Setup#
pip install atlassian-p... |
ed26e040a769-0 | https://python.langchain.com/en/latest/integrations/azure_cognitive_search_.html | .md
.pdf
Azure Cognitive Search
Contents
Installation and Setup
Retriever
Azure Cognitive Search#
Azure Cognitive Search (formerly known as Azure Search) is a cloud search service that gives developers infrastructure, APIs, and tools for building a rich search experience over private, heterogeneous content in web, mo... |
67c2fbf78044-0 | https://python.langchain.com/en/latest/integrations/lancedb.html | .md
.pdf
LanceDB
Contents
Installation and Setup
Wrappers
VectorStore
LanceDB#
This page covers how to use LanceDB within LangChain.
It is broken into two parts: installation and setup, and then references to specific LanceDB wrappers.
Installation and Setup#
Install the Python SDK with pip install lancedb
Wrappers#
... |
2f3b8f902a8c-0 | https://python.langchain.com/en/latest/integrations/momento.html | .md
.pdf
Momento
Contents
Installation and Setup
Cache
Memory
Chat Message History Memory
Momento#
Momento Cache is the world’s first truly serverless caching service. It provides instant elasticity, scale-to-zero
capability, and blazing-fast performance.
With Momento Cache, you grab the SDK, you get an end point, in... |
2f3b8f902a8c-1 | https://python.langchain.com/en/latest/integrations/momento.html | © Copyright 2023, Harrison Chase.
Last updated on Jun 04, 2023. |
bc34c9ee8804-0 | https://python.langchain.com/en/latest/integrations/annoy.html | .md
.pdf
Annoy
Contents
Installation and Setup
Vectorstore
Annoy#
Annoy (Approximate Nearest Neighbors Oh Yeah) is a C++ library with Python bindings to search for points in space that are close to a given query point. It also creates large read-only file-based data structures that are mmapped into memory so that man... |
51f84a64a1d8-0 | https://python.langchain.com/en/latest/integrations/redis.html | .md
.pdf
Redis
Contents
Installation and Setup
Wrappers
Cache
Standard Cache
Semantic Cache
VectorStore
Retriever
Memory
Vector Store Retriever Memory
Chat Message History Memory
Redis#
This page covers how to use the Redis ecosystem within LangChain.
It is broken into two parts: installation and setup, and then refe... |
51f84a64a1d8-1 | https://python.langchain.com/en/latest/integrations/redis.html | For a more detailed walkthrough of the Redis vectorstore wrapper, see this notebook.
Retriever#
The Redis vector store retriever wrapper generalizes the vectorstore class to perform low-latency document retrieval. To create the retriever, simply call .as_retriever() on the base vectorstore class.
Memory#
Redis can be u... |
9146d22d41d2-0 | https://python.langchain.com/en/latest/integrations/google_search.html | .md
.pdf
Google Search
Contents
Installation and Setup
Wrappers
Utility
Tool
Google Search#
This page covers how to use the Google Search API within LangChain.
It is broken into two parts: installation and setup, and then references to the specific Google Search wrapper.
Installation and Setup#
Install requirements w... |
96e0c74a0d6f-0 | https://python.langchain.com/en/latest/integrations/qdrant.html | .md
.pdf
Qdrant
Contents
Installation and Setup
Wrappers
VectorStore
Qdrant#
This page covers how to use the Qdrant ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific Qdrant wrappers.
Installation and Setup#
Install the Python SDK with pip install qdrant-c... |
28882f189ac2-0 | https://python.langchain.com/en/latest/integrations/gutenberg.html | .md
.pdf
Gutenberg
Contents
Installation and Setup
Document Loader
Gutenberg#
Project Gutenberg is an online library of free eBooks.
Installation and Setup#
There isn’t any special setup for it.
Document Loader#
See a usage example.
from langchain.document_loaders import GutenbergLoader
previous
Graphsignal
next
Hack... |
bc75da49e35e-0 | https://python.langchain.com/en/latest/integrations/promptlayer.html | .md
.pdf
PromptLayer
Contents
Installation and Setup
Wrappers
LLM
PromptLayer#
This page covers how to use PromptLayer within LangChain.
It is broken into two parts: installation and setup, and then references to specific PromptLayer wrappers.
Installation and Setup#
If you want to work with PromptLayer:
Install the ... |
bc75da49e35e-1 | https://python.langchain.com/en/latest/integrations/promptlayer.html | you can add return_pl_id when instantializing to return a PromptLayer request id to use while tracking requests.
PromptLayer also provides native wrappers for PromptLayerChatOpenAI and PromptLayerOpenAIChat
previous
Prediction Guard
next
Psychic
Contents
Installation and Setup
Wrappers
LLM
By Harrison Chase
... |
f49d76321557-0 | https://python.langchain.com/en/latest/integrations/writer.html | .md
.pdf
Writer
Contents
Installation and Setup
Wrappers
LLM
Writer#
This page covers how to use the Writer ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific Writer wrappers.
Installation and Setup#
Get an Writer api key and set it as an environment varia... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.