id stringlengths 14 16 | text stringlengths 36 2.73k | source stringlengths 59 127 |
|---|---|---|
5caa50234d45-0 | .md
.pdf
AwaDB
Contents
Installation and Setup
VectorStore
AwaDB#
AwaDB is an AI Native database for the search and storage of embedding vectors used by LLM Applications.
Installation and Setup#
pip install awadb
VectorStore#
There exists a wrapper around AwaDB vector databases, allowing you to use it as a vectorstor... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/awadb.html |
cd136016050a-0 | .ipynb
.pdf
Aim
Aim#
Aim makes it super easy to visualize and debug LangChain executions. Aim tracks inputs and outputs of LLMs and tools, as well as actions of agents.
With Aim, you can easily debug and examine an individual execution:
Additionally, you have the option to compare multiple executions side by side:
Aim ... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/aim_tracking.html |
cd136016050a-1 | aim_callback = AimCallbackHandler(
repo=".",
experiment_name="scenario 1: OpenAI LLM",
)
callbacks = [StdOutCallbackHandler(), aim_callback]
llm = OpenAI(temperature=0, callbacks=callbacks)
The flush_tracker function is used to record LangChain assets on Aim. By default, the session is reset rather than being t... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/aim_tracking.html |
cd136016050a-2 | )
Scenario 3 The third scenario involves an agent with tools.
from langchain.agents import initialize_agent, load_tools
from langchain.agents import AgentType
# scenario 3 - Agent with Tools
tools = load_tools(["serpapi", "llm-math"], llm=llm, callbacks=callbacks)
agent = initialize_agent(
tools,
llm,
agent... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/aim_tracking.html |
cd136016050a-3 | Airbyte
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/integrations/aim_tracking.html |
737aed95bbc3-0 | .md
.pdf
Wolfram Alpha
Contents
Installation and Setup
Wrappers
Utility
Tool
Wolfram Alpha#
WolframAlpha is an answer engine developed by Wolfram Research.
It answers factual queries by computing answers from externally sourced data.
This page covers how to use the Wolfram Alpha API within LangChain.
Installation and... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/wolfram_alpha.html |
2b7f4695a195-0 | .md
.pdf
Tensorflow Hub
Contents
Installation and Setup
Text Embedding Models
Tensorflow Hub#
TensorFlow Hub is a repository of trained machine learning models ready for fine-tuning and deployable anywhere.
TensorFlow Hub lets you search and discover hundreds of trained, ready-to-deploy machine learning models in one... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/tensorflow_hub.html |
92a4569c06a1-0 | .md
.pdf
Chroma
Contents
Installation and Setup
VectorStore
Retriever
Chroma#
Chroma is a database for building AI applications with embeddings.
Installation and Setup#
pip install chromadb
VectorStore#
There exists a wrapper around Chroma vector databases, allowing you to use it as a vectorstore,
whether for semanti... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/chroma.html |
65cdaa269c0f-0 | .md
.pdf
CerebriumAI
Contents
Installation and Setup
Wrappers
LLM
CerebriumAI#
This page covers how to use the CerebriumAI ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific CerebriumAI wrappers.
Installation and Setup#
Install with pip install cerebrium
G... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/cerebriumai.html |
830ff027c24b-0 | .md
.pdf
Vectara
Contents
Installation and Setup
Usage
VectorStore
Vectara#
What is Vectara?
Vectara Overview:
Vectara is developer-first API platform for building GenAI 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 use Vecta... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara.html |
830ff027c24b-1 | To query the vectorstore, you can use the similarity_search method (or similarity_search_with_score), which takes a query string and returns a list of results:
results = vectara.similarity_score("what is LangChain?")
similarity_search_with_score also supports the following additional arguments:
k: number of results to ... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara.html |
cd0d1d858888-0 | .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... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/figma.html |
96e2bd1ad0f0-0 | .md
.pdf
BiliBili
Contents
Installation and Setup
Document Loader
BiliBili#
Bilibili is one of the most beloved long-form video sites in China.
Installation and Setup#
pip install bilibili-api-python
Document Loader#
See a usage example.
from langchain.document_loaders import BiliBiliLoader
previous
Beam
next
Blackbo... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/bilibili.html |
c338014f07f7-0 | .md
.pdf
LangChain Decorators ✨
Contents
LangChain Decorators ✨
Quick start
Installation
Examples
Defining other parameters
Passing a memory and/or callbacks:
Simplified streaming
Prompt declarations
Documenting your prompt
Chat messages prompt
Optional sections
Output parsers
More complex structures
Binding the prom... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/langchain_decorators.html |
c338014f07f7-1 | Good idea on how to start is to review the examples here:
jupyter notebook
colab notebook
Defining other parameters#
Here we are just marking a function as a prompt with llm_prompt decorator, turning it effectively into a LLMChain. Instead of running it
Standard LLMchain takes much more init parameter than just inputs_... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/langchain_decorators.html |
c338014f07f7-2 | ...
Passing a memory and/or callbacks:#
To pass any of these, just declare them in the function (or use kwargs to pass anything)
@llm_prompt()
async def write_me_short_post(topic:str, platform:str="twitter", memory:SimpleMemory = None):
"""
{history_key}
Write me a short header for my post about {topic} for... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/langchain_decorators.html |
c338014f07f7-3 | It should be for {audience} audience.
(Max 15 words)
"""
pass
# just an arbitrary function to demonstrate the streaming... wil be some websockets code in the real world
tokens=[]
def capture_stream_func(new_token:str):
tokens.append(new_token)
# if we want to capture the stream, we need to wrap the exe... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/langchain_decorators.html |
c338014f07f7-4 | (It has also a nice benefit that IDE (like VS code) will display the prompt properly (not trying to parse it as markdown, and thus not showing new lines properly))
"""
return
Chat messages prompt#
For chat models is very useful to define prompt as a set of message templates… here is how to do it:
@llm_prompt
d... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/langchain_decorators.html |
c338014f07f7-5 | (It has also a nice benefit that IDE (like VS code) will display the prompt properly (not trying to parse it as markdown, and thus not showing new lines properly))
"""
pass
the roles here are model native roles (assistant, user, system for chatGPT)
Optional sections#
you can define a whole sections of your prom... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/langchain_decorators.html |
c338014f07f7-6 | from langchain_decorators import llm_prompt
from pydantic import BaseModel, Field
class TheOutputStructureWeExpect(BaseModel):
name:str = Field (description="The name of the company")
headline:str = Field( description="The description of the company (for landing page)")
employees:list[str] = Field(descripti... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/langchain_decorators.html |
c338014f07f7-7 | personality = AssistantPersonality(assistant_name="John", assistant_role="a pirate")
print(personality.introduce_your_self(personality))
More examples:#
these and few more examples are also available in the colab notebook here
including the ReAct Agent re-implementation using purely langchain decorators
previous
LanceD... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/langchain_decorators.html |
0aae1128af5a-0 | .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... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/git.html |
0f65fa219547-0 | .md
.pdf
Arxiv
Contents
Installation and Setup
Document Loader
Retriever
Arxiv#
arXiv is an open-access archive for 2 million scholarly articles in the fields of physics,
mathematics, computer science, quantitative biology, quantitative finance, statistics, electrical engineering and
systems science, and economics.
I... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/arxiv.html |
05436d5c4a40-0 | .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... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/momento.html |
05436d5c4a40-1 | Installation and Setup
Cache
Memory
Chat Message History Memory
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/integrations/momento.html |
69dbfcd75cd9-0 | .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... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/azure_cognitive_search_.html |
a5135281c052-0 | .md
.pdf
Databerry
Contents
Installation and Setup
Retriever
Databerry#
Databerry is an open source document retrieval platform that helps to connect your personal data with Large Language Models.
Installation and Setup#
We need to sign up for Databerry, create a datastore, add some data and get your datastore api en... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/databerry.html |
d7ebf6c8613b-0 | .md
.pdf
OpenSearch
Contents
Installation and Setup
Wrappers
VectorStore
OpenSearch#
This page covers how to use the OpenSearch ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific OpenSearch wrappers.
Installation and Setup#
Install the Python package with ... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/opensearch.html |
31214c002829-0 | .md
.pdf
Wikipedia
Contents
Installation and Setup
Document Loader
Retriever
Wikipedia#
Wikipedia is a multilingual free online encyclopedia written and maintained by a community of volunteers, known as Wikipedians, through open collaboration and using a wiki-based editing system called MediaWiki. Wikipedia is the la... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/wikipedia.html |
f675f15365ee-0 | .md
.pdf
IMSDb
Contents
Installation and Setup
Document Loader
IMSDb#
IMSDb is the Internet Movie Script Database.
Installation and Setup#
There isn’t any special setup for it.
Document Loader#
See a usage example.
from langchain.document_loaders import IMSDbLoader
previous
iFixit
next
Jina
Contents
Installation ... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/imsdb.html |
2f7c1849649e-0 | .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... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/gutenberg.html |
b8e41501dda9-0 | .md
.pdf
Metal
Contents
What is Metal?
Quick start
Metal#
This page covers how to use Metal within LangChain.
What is Metal?#
Metal is a managed retrieval & memory platform built for production. Easily index your data into Metal and run semantic search and retrieval on it.
Quick start#
Get started by creating a Meta... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/metal.html |
f5bbbec33ff2-0 | .ipynb
.pdf
MLflow
MLflow#
This notebook goes over how to track your LangChain experiments into your MLflow Server
!pip install azureml-mlflow
!pip install pandas
!pip install textstat
!pip install spacy
!pip install openai
!pip install google-search-results
!python -m spacy download en_core_web_sm
import os
os.environ... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/mlflow_tracking.html |
f5bbbec33ff2-1 | test_prompts = [
{
"title": "documentary about good video games that push the boundary of game design"
},
]
synopsis_chain.apply(test_prompts)
mlflow_callback.flush_tracker(synopsis_chain)
from langchain.agents import initialize_agent, load_tools
from langchain.agents import AgentType
# SCENARIO 3 - Age... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/mlflow_tracking.html |
5ee4730a5a23-0 | .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.... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/databricks/databricks.html |
5ee4730a5a23-1 | warehouse_id: The warehouse ID in the Databricks SQL.
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.
... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/databricks/databricks.html |
5ee4730a5a23-2 | SQL Database Agent example#
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(
... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/databricks/databricks.html |
5ee4730a5a23-3 | 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... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/databricks/databricks.html |
0bda3b67aeef-0 | .ipynb
.pdf
Vectara Text Generation
Contents
Prepare Data
Set Up Vector DB
Set Up LLM Chain with Custom Prompt
Generate Text
Vectara Text Generation#
This notebook is based on text generation notebook and adapted to Vectara.
Prepare Data#
First, we prepare the data. For this example, we fetch a documentation site tha... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_text_generation.html |
0bda3b67aeef-1 | source_chunks = []
splitter = CharacterTextSplitter(separator=" ", chunk_size=1024, chunk_overlap=0)
for source in sources:
for chunk in splitter.split_text(source.page_content):
source_chunks.append(chunk)
Cloning into '.'...
Set Up Vector DB#
Now that we have the documentation content in chunks, let’s put... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_text_generation.html |
0bda3b67aeef-2 | print(chain.apply(inputs))
generate_blog_post("environment variables") | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_text_generation.html |
0bda3b67aeef-3 | [{'text': '\n\nEnvironment variables are a powerful tool for managing configuration settings in your applications. They allow you to store and access values from anywhere in your code, making it easier to keep your codebase organized and maintainable.\n\nHowever, there are times when you may want to use environment var... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_text_generation.html |
0bda3b67aeef-4 | set the `FIREBASE_API_KEY` and `FIREBASE_AUTH_DOMAIN` environment variables like this:\n\n```ts\nDeno.env.set("FIREBASE_API_KEY", "examplekey123");\nDeno.env.set("FIREBASE_AUTH_DOMAIN", "firebasedomain.com");\n\nconsole.log(Deno.env.get("FIREBASE_API_KEY")); // examplekey123\nconsole.log(Deno.env.get("FIREBASE_AUTH_DOM... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_text_generation.html |
0bda3b67aeef-5 | In this blog post, we'll discuss how to make Deno scripts executable with a hashbang (shebang).\n\nA hashbang is a line of code that is placed at the beginning of a script. It tells the system which interpreter to use when running the script. In the case of Deno, the hashbang should be `#!/usr/bin/env -S deno run --all... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_text_generation.html |
0bda3b67aeef-6 | Contents
Prepare Data
Set Up Vector DB
Set Up LLM Chain with Custom Prompt
Generate Text
By Harrison Chase
© Copyright 2023, Harrison Chase.
Last updated on Jun 16, 2023. | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_text_generation.html |
f27c0624c8a2-0 | .ipynb
.pdf
Chat Over Documents with Vectara
Contents
Pass in chat history
Return Source Documents
ConversationalRetrievalChain with search_distance
ConversationalRetrievalChain with map_reduce
ConversationalRetrievalChain with Question Answering with sources
ConversationalRetrievalChain with streaming to stdout
get_... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_chat.html |
f27c0624c8a2-1 | qa = ConversationalRetrievalChain.from_llm(llm, retriever, memory=memory)
query = "What did the president say about Ketanji Brown Jackson"
result = qa({"question": query})
result["answer"]
" The president said that Ketanji Brown Jackson is one of the nation's top legal minds and that she will continue Justice Breyer's ... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_chat.html |
f27c0624c8a2-2 | qa = ConversationalRetrievalChain.from_llm(llm, vectorstore.as_retriever(), return_source_documents=True)
chat_history = []
query = "What did the president say about Ketanji Brown Jackson"
result = qa({"question": query, "chat_history": chat_history})
result['source_documents'][0]
Document(page_content='Tonight. I call... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_chat.html |
f27c0624c8a2-3 | print(result['answer'])
The president said that Ketanji Brown Jackson is one of the nation's top legal minds and that she will continue Justice Breyer's legacy of excellence.
ConversationalRetrievalChain with map_reduce#
We can also use different types of combine document chains with the ConversationalRetrievalChain c... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_chat.html |
f27c0624c8a2-4 | retriever=vectorstore.as_retriever(),
question_generator=question_generator,
combine_docs_chain=doc_chain,
)
chat_history = []
query = "What did the president say about Ketanji Brown Jackson"
result = chain({"question": query, "chat_history": chat_history})
result['answer']
" The president said that he nominate... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_chat.html |
f27c0624c8a2-5 | chat_history = []
query = "What did the president say about Ketanji Brown Jackson"
result = qa({"question": query, "chat_history": chat_history})
The president said that Ketanji Brown Jackson is one of the nation's top legal minds and that she will continue Justice Breyer's legacy of excellence.
chat_history = [(query... | rtdocs_stable/api.python.langchain.com/en/stable/integrations/vectara/vectara_chat.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.