id stringlengths 14 15 | text stringlengths 17 2.72k | source stringlengths 47 115 |
|---|---|---|
d124c125df69-0 | 🗃️ Document transformers
8 items | https://python.langchain.com/docs/integrations/ |
ddfe37b68cf0-0 | 📄️ AzureML Chat Online Endpoint
AzureML is a platform used to build, train, and deploy machine learning models. Users can explore the types of models to deploy in the Model Catalog, which provides Azure Foundation Models and OpenAI Models. Azure Foundation Models include various open-source models and popular Hugging ... | https://python.langchain.com/docs/integrations/chat/ |
2a8f5d640c79-0 | 📄️ Label Studio
Label Studio is an open-source data labeling platform that provides LangChain with flexibility when it comes to labeling data for fine-tuning large language models (LLMs). It also enables the preparation of custom training data and the collection and evaluation of responses through human feedback. | https://python.langchain.com/docs/integrations/callbacks/ |
c33a413482b6-0 | Chat loaders
Like document loaders, chat loaders are utilities designed to help load conversations from popular communication platforms such as Facebook, Slack, Discord, etc. These are loaded into memory as LangChain chat message objects. Such utilities facilitate tasks such as fine-tuning a language model to match you... | https://python.langchain.com/docs/integrations/chat_loaders/ |
c33a413482b6-1 | loader = FolderFacebookMessengerChatLoader(
path="./facebook_messenger_chats",
)
chat_sessions = loader.load()
In this snippet, we point the loader to a directory of Facebook chat dumps which are then loaded as multiple "sessions" of messages, one session per conversation file.
Once you've loaded the messages, you sho... | https://python.langchain.com/docs/integrations/chat_loaders/ |
c33a413482b6-2 | # Wait while the file is processed
status = openai.File.retrieve(training_file.id).status
start_time = time.time()
while status != "processed":
print(f"Status=[{status}]... {time.time() - start_time:.2f}s", end="\r", flush=True)
time.sleep(5)
status = openai.File.retrieve(training_file.id).status
print(f"File {training... | https://python.langchain.com/docs/integrations/chat_loaders/ |
c33a413482b6-3 | # The usual - Potions, Transfiguration, Defense Against the Dark Arts. What about you?
And that's it! You've successfully fine-tuned a model and used it in LangChain.
Supported Chat Loaders
LangChain currently supports the following chat loaders. Feel free to contribute more!
📄️ Discord
This notebook shows how to cre... | https://python.langchain.com/docs/integrations/chat_loaders/ |
19f700974791-0 | 📄️ OpenAI Functions Metadata Tagger
It can often be useful to tag ingested documents with structured metadata, such as the title, tone, or length of a document, to allow for more targeted similarity search later. However, for large numbers of documents, performing this labelling process manually can be tedious. | https://python.langchain.com/docs/integrations/document_transformers/ |
a2c4b7f1cf80-0 | 📄️ Amazon Textract
Amazon Textract is a machine learning (ML) service that automatically extracts text, handwriting, and data from scanned documents. It goes beyond simple optical character recognition (OCR) to identify, understand, and extract data from forms and tables. Today, many companies manually extract data fr... | https://python.langchain.com/docs/integrations/document_loaders/ |
647c0d8883c5-0 | 📄️ Cassandra Chat Message History
Apache Cassandra® is a NoSQL, row-oriented, highly scalable and highly available database, well suited for storing large amounts of data. | https://python.langchain.com/docs/integrations/memory/ |
94bc17007655-0 | 📄️ NLP Cloud
The NLP Cloud serves high performance pre-trained or custom models for NER, sentiment-analysis, classification, summarization, paraphrasing, grammar and spelling correction, keywords and keyphrases extraction, chatbot, product description and ad generation, intent classification, text generation, image ge... | https://python.langchain.com/docs/integrations/llms/ |
85480a2dd581-0 | Retrievers
📄️ Amazon Kendra
Amazon Kendra is an intelligent search service provided by Amazon Web Services (AWS). It utilizes advanced natural language processing (NLP) and machine learning algorithms to enable powerful search capabilities across various data sources within an organization. Kendra is designed to help ... | https://python.langchain.com/docs/integrations/retrievers/ |
85480a2dd581-1 | 📄️ Google Cloud Enterprise Search
Enterprise Search is a part of the Generative AI App Builder suite of tools offered by Google Cloud.
📄️ Google Drive Retriever
This notebook covers how to retrieve documents from Google Drive.
📄️ kNN
In statistics, the k-nearest neighbors algorithm (k-NN) is a non-parametric supervi... | https://python.langchain.com/docs/integrations/retrievers/ |
85480a2dd581-2 | 📄️ Zep
Retriever Example for Zep - A long-term memory store for LLM applications. | https://python.langchain.com/docs/integrations/retrievers/ |
ca8d70a0ee57-0 | Text embedding models
📄️ AwaEmbedding
This notebook explains how to use AwaEmbedding, which is included in awadb, to embedding texts in langchain.
📄️ Aleph Alpha
There are two possible ways to use Aleph Alpha's semantic embeddings. If you have texts with a dissimilar structure (e.g. a Document and a Query) you would ... | https://python.langchain.com/docs/integrations/text_embedding/ |
ca8d70a0ee57-1 | 📄️ Fake Embeddings
LangChain also provides a fake embedding class. You can use this to test your pipelines.
📄️ Google Cloud Platform Vertex AI PaLM
Note: This is seperate from the Google PaLM integration, it exposes Vertex AI PaLM API on Google Cloud.
📄️ GPT4All
GPT4All is a free-to-use, locally running, privacy-awa... | https://python.langchain.com/docs/integrations/text_embedding/ |
ca8d70a0ee57-2 | 📄️ Sentence Transformers Embeddings
SentenceTransformers embeddings are called using the HuggingFaceEmbeddings integration. We have also added an alias for SentenceTransformerEmbeddings for users who are more familiar with directly using that package.
📄️ Spacy Embedding
Loading the Spacy embedding class to generate a... | https://python.langchain.com/docs/integrations/text_embedding/ |
cf7c7309ab45-0 | Agents & Toolkits
Agents and Toolkits are placed in the same directory because they are always used together.
📄️ AINetwork
AI Network is a layer 1 blockchain designed to accommodate large-scale AI models, utilizing a decentralized GPU network powered by the $AIN token, enriching AI-driven NFTs (AINFTs).
📄️ Airbyte Qu... | https://python.langchain.com/docs/integrations/toolkits/ |
cf7c7309ab45-1 | 📄️ PlayWright Browser
This toolkit is used to interact with the browser. While other tools (like the Requests tools) are fine for static sites, PlayWright Browser toolkits let your agent navigate the web and interact with dynamically rendered sites.
📄️ PowerBI Dataset
This notebook showcases an agent interacting with... | https://python.langchain.com/docs/integrations/toolkits/ |
51a87f7229e0-0 | Tools
📄️ Alpha Vantage
Alpha Vantage Alpha Vantage provides realtime and historical financial market data through a set of powerful and developer-friendly data APIs and spreadsheets.
📄️ Apify
This notebook shows how to use the Apify integration for LangChain.
📄️ ArXiv
This notebook goes over how to use the arxiv too... | https://python.langchain.com/docs/integrations/tools/ |
51a87f7229e0-1 | 📄️ Golden Query
Golden provides a set of natural language APIs for querying and enrichment using the Golden Knowledge Graph e.g. queries such as: Products from OpenAI, Generative ai companies with series a funding, and rappers who invest can be used to retrieve structured data about relevant entities.
📄️ Google Drive... | https://python.langchain.com/docs/integrations/tools/ |
51a87f7229e0-2 | 📄️ OpenWeatherMap
This notebook goes over how to use the OpenWeatherMap component to fetch weather information.
📄️ PubMed
PubMed® comprises more than 35 million citations for biomedical literature from MEDLINE, life science journals, and online books. Citations may include links to full text content from PubMed Centr... | https://python.langchain.com/docs/integrations/tools/ |
b21d7830c59f-0 | Vector stores
📄️ Activeloop Deep Lake
Activeloop Deep Lake as a Multi-Modal Vector Store that stores embeddings and their metadata including text, Jsons, images, audio, video, and more. It saves the data locally, in your cloud, or on Activeloop storage. It performs hybrid search including embeddings and their attribut... | https://python.langchain.com/docs/integrations/vectorstores/ |
b21d7830c59f-1 | 📄️ ClickHouse
ClickHouse is the fastest and most resource efficient open-source database for real-time apps and analytics with full SQL support and a wide range of functions to assist users in writing analytical queries. Lately added data structures and distance search functions (like L2Distance) as well as approximat... | https://python.langchain.com/docs/integrations/vectorstores/ |
b21d7830c59f-2 | 📄️ Hologres
Hologres is a unified real-time data warehousing service developed by Alibaba Cloud. You can use Hologres to write, update, process, and analyze large amounts of data in real time.
📄️ LanceDB
LanceDB is an open-source database for vector-search built with persistent storage, which greatly simplifies retre... | https://python.langchain.com/docs/integrations/vectorstores/ |
b21d7830c59f-3 | Pinecone is a vector database with broad functionality.
📄️ Qdrant
Qdrant (read: quadrant ) is a vector similarity search engine. It provides a production-ready service with a convenient API to store, search, and manage points - vectors with an additional payload. Qdrant is tailored to extended filtering support. It ma... | https://python.langchain.com/docs/integrations/vectorstores/ |
b21d7830c59f-4 | 📄️ Tencent Cloud VectorDB
Tencent Cloud VectorDB is a fully managed, self-developed, enterprise-level distributed database service designed for storing, retrieving, and analyzing multi-dimensional vector data. The database supports multiple index types and similarity calculation methods. A single index can support a v... | https://python.langchain.com/docs/integrations/vectorstores/ |
77437ea20dd2-0 | Grouped by provider
📄️ Activeloop Deep Lake
This page covers how to use the Deep Lake ecosystem within LangChain.
📄️ AI21 Labs
This page covers how to use the AI21 ecosystem within LangChain.
📄️ Aim
Aim makes it super easy to visualize and debug LangChain executions. Aim tracks inputs and outputs of LLMs and tools, ... | https://python.langchain.com/docs/integrations/providers/ |
77437ea20dd2-1 | 📄️ 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 many processes may share the same data.
📄️ Anyscale
This pag... | https://python.langchain.com/docs/integrations/providers/ |
77437ea20dd2-2 | 📄️ Azure OpenAI
Microsoft Azure, often referred to as Azure is a cloud computing platform run by Microsoft, which offers access, management, and development of applications and services through global data centers. It provides a range of capabilities, including software as a service (SaaS), platform as a service (PaaS... | https://python.langchain.com/docs/integrations/providers/ |
77437ea20dd2-3 | 📄️ Clarifai
Clarifai is one of first deep learning platforms having been founded in 2013. Clarifai provides an AI platform with the full AI lifecycle for data exploration, data labeling, model training, evaluation and inference around images, video, text and audio data. In the LangChain ecosystem, as far as we're awar... | https://python.langchain.com/docs/integrations/providers/ |
77437ea20dd2-4 | 📄️ DataForSEO
This page provides instructions on how to use the DataForSEO search APIs within LangChain.
📄️ DeepInfra
This page covers how to use the DeepInfra ecosystem within LangChain.
📄️ DeepSparse
This page covers how to use the DeepSparse inference runtime within LangChain.
📄️ Diffbot
Diffbot is a service to ... | https://python.langchain.com/docs/integrations/providers/ |
77437ea20dd2-5 | 📄️ GitBook
GitBook is a modern documentation platform where teams can document everything from products to internal knowledge bases and APIs.
📄️ Golden
Golden provides a set of natural language APIs for querying and enrichment using the Golden Knowledge Graph e.g. queries such as: Products from OpenAI, Generative ai ... | https://python.langchain.com/docs/integrations/providers/ |
77437ea20dd2-6 | 📄️ Helicone
This page covers how to use the Helicone ecosystem within LangChain.
📄️ Hologres
Hologres is a unified real-time data warehousing service developed by Alibaba Cloud. You can use Hologres to write, update, process, and analyze large amounts of data in real time.
📄️ Hugging Face
This page covers how to use... | https://python.langchain.com/docs/integrations/providers/ |
77437ea20dd2-7 | 📄️ Minimax
Minimax is a Chinese startup that provides natural language processing models
📄️ MLflow AI Gateway
The MLflow AI Gateway service is a powerful tool designed to streamline the usage and management of various large
📄️ MLflow
MLflow is a versatile, expandable, open-source platform for managing workflows and ... | https://python.langchain.com/docs/integrations/providers/ |
77437ea20dd2-8 | 📄️ Postgres Embedding
pgembedding is an open-source package for
📄️ PGVector
This page covers how to use the Postgres PGVector ecosystem within LangChain
📄️ Pinecone
This page covers how to use the Pinecone ecosystem within LangChain.
📄️ PipelineAI
This page covers how to use the PipelineAI ecosystem within LangChai... | https://python.langchain.com/docs/integrations/providers/ |
77437ea20dd2-9 | 📄️ RWKV-4
This page covers how to use the RWKV-4 wrapper within LangChain.
📄️ SageMaker Endpoint
Amazon SageMaker is a system that can build, train, and deploy machine learning (ML) models with fully managed infrastructure, tools, and workflows.
📄️ SageMaker Tracking
This notebook shows how LangChain Callback can be... | https://python.langchain.com/docs/integrations/providers/ |
77437ea20dd2-10 | This page covers how to use the StochasticAI ecosystem within LangChain.
📄️ Stripe
Stripe is an Irish-American financial services and software as a service (SaaS) company. It offers payment-processing software and application programming interfaces for e-commerce websites and mobile applications.
📄️ Supabase (Postgre... | https://python.langchain.com/docs/integrations/providers/ |
77437ea20dd2-11 | 📄️ WandB Tracing
There are two recommended ways to trace your LangChains:
📄️ Weights & Biases
This notebook goes over how to track your LangChain experiments into one centralized Weights and Biases dashboard. To learn more about prompt engineering and the callback please refer to this Report which explains both along... | https://python.langchain.com/docs/integrations/providers/ |
99ca47c635e2-0 | Anthropic
This notebook covers how to get started with Anthropic chat models.
from langchain.chat_models import ChatAnthropic
from langchain.prompts.chat import (
ChatPromptTemplate,
SystemMessagePromptTemplate,
AIMessagePromptTemplate,
HumanMessagePromptTemplate,
)
from langchain.schema import AIMessage, HumanMessage,... | https://python.langchain.com/docs/integrations/chat/anthropic |
0386480638c1-0 | This notebook demonstrates the use of langchain.chat_models.ChatAnyscale for Anyscale Endpoints.
This way, the three requests will only take as long as the longest individual request.
meta-llama/Llama-2-70b-chat-hf
Greetings! I'm just an AI, I don't have a personal identity like humans do, but I'm here to help you wit... | https://python.langchain.com/docs/integrations/chat/anyscale |
0386480638c1-1 | ---
meta-llama/Llama-2-7b-chat-hf
Ah, a fellow tech enthusiast! *adjusts glasses* I'm glad to share some technical details about myself. 🤓
Indeed, I'm a transformer model, specifically a BERT-like language model trained on a large corpus of text data. My architecture is based on the transformer framework, which is a... | https://python.langchain.com/docs/integrations/chat/anyscale |
0386480638c1-2 | Here are some technical details about my capabilities:
1. Parameters: I have approximately 340 million parameters, which are the numbers that I use to learn and represent language. This is a relatively large number of parameters compared to some other languages models, but it allows me to learn and understand complex ... | https://python.langchain.com/docs/integrations/chat/anyscale |
0fadfc171372-0 | Anthropic Functions
This notebook shows how to use an experimental wrapper around Anthropic that gives it the same API as OpenAI Functions.
from langchain_experimental.llms.anthropic_functions import AnthropicFunctions
/Users/harrisonchase/.pyenv/versions/3.9.1/envs/langchain/lib/python3.9/site-packages/deeplake/util/c... | https://python.langchain.com/docs/integrations/chat/anthropic_functions |
0fadfc171372-1 | """
chain = create_extraction_chain(schema, model)
[{'name': 'Alex', 'height': '5', 'hair_color': 'blonde'},
{'name': 'Claudia', 'height': '6', 'hair_color': 'brunette'}]
Using for tagging
You can now use this for tagging
from langchain.chains import create_tagging_chain
schema = {
"properties": {
"sentiment": {"type"... | https://python.langchain.com/docs/integrations/chat/anthropic_functions |
d0892c63c05e-0 | Azure
This notebook goes over how to connect to an Azure hosted OpenAI endpoint
from langchain.chat_models import AzureChatOpenAI
from langchain.schema import HumanMessage
BASE_URL = "https://${TODO}.openai.azure.com"
API_KEY = "..."
DEPLOYMENT_NAME = "chat"
model = AzureChatOpenAI(
openai_api_base=BASE_URL,
openai_api... | https://python.langchain.com/docs/integrations/chat/azure_chat_openai |
d0892c63c05e-1 | )
]
)
print(f"Total Cost (USD): ${format(cb.total_cost, '.6f')}") # without specifying the model version, flat-rate 0.002 USD per 1k input and output tokens is used
Total Cost (USD): $0.000054
We can provide the model version to AzureChatOpenAI constructor. It will get appended to the model name returned by Azure OpenA... | https://python.langchain.com/docs/integrations/chat/azure_chat_openai |
1b46970f824f-0 | AzureML is a platform used to build, train, and deploy machine learning models. Users can explore the types of models to deploy in the Model Catalog, which provides Azure Foundation Models and OpenAI Models. Azure Foundation Models include various open-source models and popular Hugging Face models. Users can also impor... | https://python.langchain.com/docs/integrations/chat/azureml_chat_endpoint |
e428ee2f2025-0 | Bedrock Chat
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
from langchain.chat_models import BedrockChat
from langchain.schema import HumanMessage
chat ... | https://python.langchain.com/docs/integrations/chat/bedrock |
6f14eab6a5de-0 | ERNIE-Bot Chat
ERNIE-Bot is a large language model developed by Baidu, covering a huge amount of Chinese data. This notebook covers how to get started with ErnieBot chat models.
from langchain.chat_models import ErnieBotChat
from langchain.schema import HumanMessage
chat = ErnieBotChat(ernie_client_id='YOUR_CLIENT_ID',... | https://python.langchain.com/docs/integrations/chat/ernie |
85ce067e5905-0 | Note: This is seperate from the Google PaLM integration. Google has chosen to offer an enterprise version of PaLM through GCP, and this supports the models made available through there.
By default, Google Cloud does not use Customer Data to train its foundation models as part of Google Cloud`s AI/ML Privacy Commitment... | https://python.langchain.com/docs/integrations/chat/google_vertex_ai_palm |
85ce067e5905-1 | "You are a helpful assistant that translates {input_language} to {output_language}."
)
system_message_prompt = SystemMessagePromptTemplate.from_template(template)
human_template = "{text}"
human_message_prompt = HumanMessagePromptTemplate.from_template(human_template)
chat_prompt = ChatPromptTemplate.from_messages(
[sy... | https://python.langchain.com/docs/integrations/chat/google_vertex_ai_palm |
85ce067e5905-2 | # get a chat completion from the formatted messages
chat(
chat_prompt.format_prompt(
input_language="English", output_language="French", text="I love programming."
).to_messages()
)
AIMessage(content='Sure, here is the translation of "I love programming" in French:\n\nJ\'aime programmer.', additional_kwargs={}, example... | https://python.langchain.com/docs/integrations/chat/google_vertex_ai_palm |
d13b51108c87-0 | JinaChat
This notebook covers how to get started with JinaChat chat models.
from langchain.chat_models import JinaChat
from langchain.prompts.chat import (
ChatPromptTemplate,
SystemMessagePromptTemplate,
AIMessagePromptTemplate,
HumanMessagePromptTemplate,
)
from langchain.schema import AIMessage, HumanMessage, System... | https://python.langchain.com/docs/integrations/chat/jinachat |
e668e0eaaa3a-0 | 🚅 LiteLLM
LiteLLM is a library that simplifies calling Anthropic, Azure, Huggingface, Replicate, etc.
This notebook covers how to get started with using Langchain + the LiteLLM I/O library.
from langchain.chat_models import ChatLiteLLM
from langchain.prompts.chat import (
ChatPromptTemplate,
SystemMessagePromptTempl... | https://python.langchain.com/docs/integrations/chat/litellm |
21eaafb4c735-0 | Llama API
This notebook shows how to use LangChain with LlamaAPI - a hosted version of Llama2 that adds in support for function calling.
!pip install -U llamaapi
from llamaapi import LlamaAPI
# Replace 'Your_API_Token' with your actual API token
llama = LlamaAPI('Your_API_Token')
from langchain_experimental.llms impor... | https://python.langchain.com/docs/integrations/chat/llama_api |
e10e28c29d51-0 | Ollama allows you to run open-source large language models, such as LLaMA2, locally.
Ollama bundles model weights, configuration, and data into a single package, defined by a Modelfile.
It optimizes setup and configuration details, including GPU usage.
For a complete list of supported models and model variants, see th... | https://python.langchain.com/docs/integrations/chat/ollama |
e10e28c29d51-1 | 1. LLM with simple prompting, such as "Steps for XYZ." or "What are the subgoals for achieving XYZ?"
2. Using task-specific instructions, like "Write a story outline" for writing a novel. | https://python.langchain.com/docs/integrations/chat/ollama |
e10e28c29d51-2 | 3. With human inputs.{'model': 'llama2:13b-chat', 'created_at': '2023-08-23T15:37:51.469127Z', 'done': True, 'context': [1, 29871, 1, 29961, 25580, 29962, 518, 25580, 29962, 518, 25580, 29962, 3532, 14816, 29903, 6778, 4803, 278, 1494, 12785, 310, 3030, 304, 1234, 278, 1139, 472, 278, 1095, 29889, 29871, 13, 3644, 366,... | https://python.langchain.com/docs/integrations/chat/ollama |
e10e28c29d51-3 | 15387, 1060, 29979, 29999, 29973, 613, 313, 29906, 29897, 491, 773, 3414, 29899, 14940, 11994, 29936, 321, 29889, 29887, 29889, 376, 6113, 263, 5828, 27887, 1213, 363, 5007, 263, 9554, 29892, 470, 313, 29941, 29897, 411, 5199, 10970, 29889, 13, 13, 5398, 26227, 508, 367, 2309, 313, 29896, 29897, 491, 365, 26369, 411, 2... | https://python.langchain.com/docs/integrations/chat/ollama |
e10e28c29d51-4 | 975, 263, 3309, 29891, 4955, 322, 17583, 3902, 8253, 278, 1650, 2913, 3933, 18066, 292, 29889, 365, 26369, 29879, 21117, 304, 10365, 13900, 746, 20050, 411, 15668, 4436, 29892, 3907, 963, 3109, 16424, 9401, 304, 25618, 1058, 5110, 515, 14260, 322, 1059, 29889, 13, 13, 1451, 16047, 267, 297, 1472, 29899, 8489, 18987, 32... | https://python.langchain.com/docs/integrations/chat/ollama |
e10e28c29d51-5 | 29962, 29871, 16564, 373, 278, 2183, 3030, 29892, 1244, 338, 278, 1234, 304, 278, 1139, 376, 5618, 526, 278, 13501, 304, 9330, 897, 510, 3283, 3026, 13, 13, 8439, 526, 2211, 13501, 304, 3414, 26227, 29901, 13, 13, 29896, 29889, 365, 26369, 411, 2560, 9508, 292, 29892, 1316, 408, 376, 7789, 567, 363, 1060, 29979, 29999,... | https://python.langchain.com/docs/integrations/chat/ollama |
6ff56ff206cf-0 | PromptLayer ChatOpenAI
This example showcases how to connect to PromptLayer to start recording your ChatOpenAI requests.
Install PromptLayer
The promptlayer package is required to use PromptLayer with OpenAI. Install promptlayer using pip.
Imports
import os
from langchain.chat_models import PromptLayerChatOpenAI
from... | https://python.langchain.com/docs/integrations/chat/promptlayer_chatopenai |
5ed972b2355d-0 | OpenAI
This notebook covers how to get started with OpenAI chat models.
from langchain.chat_models import ChatOpenAI
from langchain.prompts.chat import (
ChatPromptTemplate,
SystemMessagePromptTemplate,
AIMessagePromptTemplate,
HumanMessagePromptTemplate,
)
from langchain.schema import AIMessage, HumanMessage, SystemMe... | https://python.langchain.com/docs/integrations/chat/openai |
5ed972b2355d-1 | # get a chat completion from the formatted messages
chat(
chat_prompt.format_prompt(
input_language="English", output_language="French", text="I love programming."
).to_messages()
)
AIMessage(content="J'adore la programmation.", additional_kwargs={}, example=False)
Fine-tuning
You can call fine-tuned OpenAI models by ... | https://python.langchain.com/docs/integrations/chat/openai |
d2ee9e74e94d-0 | Streamlit
Streamlit is a faster way to build and share data apps. Streamlit turns data scripts into shareable web apps in minutes. All in pure Python. No front‑end experience required. See more examples at streamlit.io/generative-ai.
In this guide we will demonstrate how to use StreamlitCallbackHandler to display the t... | https://python.langchain.com/docs/integrations/callbacks/streamlit |
d2ee9e74e94d-1 | if prompt := st.chat_input():
st.chat_message("user").write(prompt)
with st.chat_message("assistant"):
st_callback = StreamlitCallbackHandler(st.container())
response = agent.run(prompt, callbacks=[st_callback])
st.write(response)
Note: You will need to set OPENAI_API_KEY for the above app code to run successfully. The... | https://python.langchain.com/docs/integrations/callbacks/streamlit |
0fe459504a73-0 | 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 labeling to model monitoring.
In this guide we will demonstrate h... | https://python.langchain.com/docs/integrations/callbacks/argilla |
0fe459504a73-1 | if parse_version(rg.__version__) < parse_version("1.8.0"):
raise RuntimeError(
"`FeedbackDataset` is only available in Argilla v1.8.0 or higher, please "
"upgrade `argilla` as `pip install argilla --upgrade`."
)
dataset = rg.FeedbackDataset(
fields=[
rg.TextField(name="prompt"),
rg.TextField(name="response"),
],
questi... | https://python.langchain.com/docs/integrations/callbacks/argilla |
0fe459504a73-2 | llm = OpenAI(temperature=0.9, callbacks=callbacks)
llm.generate(["Tell me a joke", "Tell me a poem"] * 3) | https://python.langchain.com/docs/integrations/callbacks/argilla |
0fe459504a73-3 | LLMResult(generations=[[Generation(text='\n\nQ: What did the fish say when he hit the wall? \nA: Dam.', generation_info={'finish_reason': 'stop', 'logprobs': None})], [Generation(text='\n\nThe Moon \n\nThe moon is high in the midnight sky,\nSparkling like a star above.\nThe night so peaceful, so serene,\nFilling up the... | https://python.langchain.com/docs/integrations/callbacks/argilla |
0fe459504a73-4 | 'stop', 'logprobs': None})], [Generation(text="\n\nA poem for you\n\nOn a field of green\n\nThe sky so blue\n\nA gentle breeze, the sun above\n\nA beautiful world, for us to love\n\nLife is a journey, full of surprise\n\nFull of joy and full of surprise\n\nBe brave and take small steps\n\nThe future will be revealed wi... | https://python.langchain.com/docs/integrations/callbacks/argilla |
0fe459504a73-5 | Scenario 2: Tracking an LLM in a chain
Then we can create a chain using a prompt template, and then track the initial prompt and the final response in Argilla.
from langchain.callbacks import ArgillaCallbackHandler, StdOutCallbackHandler
from langchain.llms import OpenAI
from langchain.chains import LLMChain
from lang... | https://python.langchain.com/docs/integrations/callbacks/argilla |
0fe459504a73-6 | argilla_callback = ArgillaCallbackHandler(
dataset_name="langchain-dataset",
api_url=os.environ["ARGILLA_API_URL"],
api_key=os.environ["ARGILLA_API_KEY"],
)
callbacks = [StdOutCallbackHandler(), argilla_callback]
llm = OpenAI(temperature=0.9, callbacks=callbacks)
template = """You are a playwright. Given the title of ... | https://python.langchain.com/docs/integrations/callbacks/argilla |
0fe459504a73-7 | > Finished chain.
[{'text': "\n\nDocumentary about Bigfoot in Paris focuses on the story of a documentary filmmaker and their search for evidence of the legendary Bigfoot creature in the city of Paris. The play follows the filmmaker as they explore the city, meeting people from all walks of life who have had encou... | https://python.langchain.com/docs/integrations/callbacks/argilla |
0fe459504a73-8 | > Entering new AgentExecutor chain...
I need to answer a historical question
Action: Search
Action Input: "who was the first president of the United States of America"
Observation: George Washington
Thought: George Washington was the first president
Final Answer: George Washington was the first president of the United... | https://python.langchain.com/docs/integrations/callbacks/argilla |
e1c3eadc67ed-0 | Context
Context provides user analytics for LLM powered products and features.
With Context, you can start understanding your users and improving their experiences in less than 30 minutes.
In this guide we will show you how to integrate with Context.
Installation and Setup
$ pip install context-python --upgrade
Gettin... | https://python.langchain.com/docs/integrations/callbacks/context |
e1c3eadc67ed-1 | from langchain.chat_models import ChatOpenAI
from langchain import LLMChain
from langchain.prompts import PromptTemplate
from langchain.prompts.chat import (
ChatPromptTemplate,
HumanMessagePromptTemplate,
)
from langchain.callbacks import ContextCallbackHandler
token = os.environ["CONTEXT_API_TOKEN"]
human_message_p... | https://python.langchain.com/docs/integrations/callbacks/context |
427bff4d5b51-0 | This example shows how one can track the following while calling OpenAI models via LangChain and Infino:
# Set your key here.
# os.environ["OPENAI_API_KEY"] = "YOUR_API_KEY"
# Create callback handler. This logs latency, errors, token usage, prompts as well as prompt responses to Infino.
handler = InfinoCallbackHandler... | https://python.langchain.com/docs/integrations/callbacks/infino |
427bff4d5b51-1 | # We send the question to OpenAI API, with Infino callback.
llm_result = llm.generate([question], callbacks=[handler])
print(llm_result)
In what country is Normandy located?
generations=[[Generation(text='\n\nNormandy is located in France.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'to... | https://python.langchain.com/docs/integrations/callbacks/infino |
427bff4d5b51-2 | Who was the Norse leader?
generations=[[Generation(text='\n\nThe most famous Norse leader was the legendary Viking king Ragnar Lodbrok. He is believed to have lived in the 9th century and is renowned for his exploits in England and France.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'to... | https://python.langchain.com/docs/integrations/callbacks/infino |
427bff4d5b51-3 | What is France a region of?
generations=[[Generation(text='\n\nFrance is a region of Europe.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 16, 'completion_tokens': 9, 'prompt_tokens': 7}, 'model_name': 'text-davinci-003'} run=RunInfo(run_id=UUID('6943880b-b... | https://python.langchain.com/docs/integrations/callbacks/infino |
427bff4d5b51-4 | Who was the duke in the battle of Hastings?
generations=[[Generation(text='\n\nThe Duke of Normandy, William the Conqueror, was the leader of the Norman forces at the Battle of Hastings in 1066.', generation_info={'finish_reason': 'stop', 'logprobs': None})]] llm_output={'token_usage': {'total_tokens': 39, 'completion_... | https://python.langchain.com/docs/integrations/callbacks/infino |
427bff4d5b51-5 | # Extract x and y values from the data
timestamps = [item["time"] for item in data]
dates = [dt.datetime.fromtimestamp(ts) for ts in timestamps]
y = [item["value"] for item in data]
plt.rcParams["figure.figsize"] = [6, 4]
plt.subplots_adjust(bottom=0.2)
plt.xticks(rotation=25)
ax = plt.gca()
xfmt = md.DateFormatter("%... | https://python.langchain.com/docs/integrations/callbacks/infino |
f0b758da0083-0 | Label Studio
Label Studio is an open-source data labeling platform that provides LangChain with flexibility when it comes to labeling data for fine-tuning large language models (LLMs). It also enables the preparation of custom training data and the collection and evaluation of responses through human feedback.
In this ... | https://python.langchain.com/docs/integrations/callbacks/labelstudio |
f0b758da0083-1 | os.environ['LABEL_STUDIO_URL'] = '<YOUR-LABEL-STUDIO-URL>' # e.g. http://localhost:8080
os.environ['LABEL_STUDIO_API_KEY'] = '<YOUR-LABEL-STUDIO-API-KEY>'
os.environ['OPENAI_API_KEY'] = '<YOUR-OPENAI-API-KEY>'
Collecting LLMs prompts and responses
The data used for labeling is stored in projects within Label Studio. E... | https://python.langchain.com/docs/integrations/callbacks/labelstudio |
f0b758da0083-2 | llm = OpenAI(
temperature=0,
callbacks=[
LabelStudioCallbackHandler(
project_name="My Project"
)]
)
print(llm("Tell me a joke"))
In the Label Studio, open My Project. You will see the prompts, responses, and metadata like the model name.
Collecting Chat model Dialogues
You can also track and display full chat dialogu... | https://python.langchain.com/docs/integrations/callbacks/labelstudio |
f0b758da0083-3 | chat_llm = ChatOpenAI(callbacks=[
LabelStudioCallbackHandler(
mode="chat",
project_name="New Project with Chat",
)
])
llm_results = chat_llm([
SystemMessage(content="Always use a lot of emojis"),
HumanMessage(content="Tell me a joke")
])
In Label Studio, open "New Project with Chat". Click on a created task to view dia... | https://python.langchain.com/docs/integrations/callbacks/labelstudio |
9fc9cb50bd40-0 | LLMonitor is an open-source observability platform that provides cost tracking, user tracking and powerful agent tracing.
Create an account on llmonitor.com, create an App, and then copy the associated tracking id. Once you have it, set it as an environment variable by running:
If you'd prefer not to set an environment... | https://python.langchain.com/docs/integrations/callbacks/llmonitor |
4e689437bd9a-0 | PromptLayer
PromptLayer is a an LLM observability platform that lets you visualize requests, version prompts, and track usage. In this guide we will go over how to setup the PromptLayerCallbackHandler.
While PromptLayer does have LLMs that integrate directly with LangChain (e.g. PromptLayerOpenAI), this callback is th... | https://python.langchain.com/docs/integrations/callbacks/promptlayer |
4e689437bd9a-1 | response = model(
"Once upon a time, ",
callbacks=[PromptLayerCallbackHandler(pl_tags=["langchain", "gpt4all"])],
)
Full Featured Example
In this example we unlock more of the power of PromptLayer.
PromptLayer allows you to visually create, version, and track prompt templates. Using the Prompt Registry, we can program... | https://python.langchain.com/docs/integrations/callbacks/promptlayer |
95ef7a66a708-0 | Discord
This notebook shows how to create your own chat loader that works on copy-pasted messages (from dms) to a list of LangChain messages.
The process has four steps:
Create the chat .txt file by copying chats from the Discord app and pasting them in a file on your local computer
Copy the chat loader definition from... | https://python.langchain.com/docs/integrations/chat_loaders/discord |
95ef7a66a708-1 | def __init__(self, path: str):
"""
Initialize the Discord chat loader.
Args:
path: Path to the exported Discord chat text file.
"""
self.path = path
self._message_line_regex = re.compile(
r"(.+?) — (\w{3,9} \d{1,2}(?:st|nd|rd|th)?(?:, \d{4})? \d{1,2}:\d{2} (?:AM|PM)|Today at \d{1,2}:\d{2} (?:AM|PM)|Yesterday at \d{1,2... | https://python.langchain.com/docs/integrations/chat_loaders/discord |
95ef7a66a708-2 | results: List[schema.BaseMessage] = []
current_sender = None
current_timestamp = None
current_content = []
for line in lines:
if re.match(
r".+? — (\d{2}/\d{2}/\d{4} \d{1,2}:\d{2} (?:AM|PM)|Today at \d{1,2}:\d{2} (?:AM|PM)|Yesterday at \d{1,2}:\d{2} (?:AM|PM))", # noqa
line,
):
if current_sender and current_content:
re... | https://python.langchain.com/docs/integrations/chat_loaders/discord |
95ef7a66a708-3 | Yields:
A `ChatSession` object containing the loaded chat messages.
"""
yield self._load_single_chat_session_from_txt(self.path)
2. Create loader
We will point to the file we just wrote to disk.
loader = DiscordChatLoader(
path="./discord_chats.txt",
)
3. Load Messages
Assuming the format is correct, the loader will ... | https://python.langchain.com/docs/integrations/chat_loaders/discord |
95ef7a66a708-4 | raw_messages = loader.lazy_load()
# Merge consecutive messages from the same sender into a single message
merged_messages = merge_chat_runs(raw_messages)
# Convert messages from "talkingtower" to AI messages
messages: List[ChatSession] = list(map_ai_messages(merged_messages, sender="talkingtower"))
[{'messages': [AIMes... | https://python.langchain.com/docs/integrations/chat_loaders/discord |
95ef7a66a708-5 | llm = ChatOpenAI()
for chunk in llm.stream(messages[0]['messages']):
print(chunk.content, end="", flush=True)
Thank you! Have a wonderful day! 🌟 | https://python.langchain.com/docs/integrations/chat_loaders/discord |
36b055cb0e2b-0 | Facebook Messenger
This notebook shows how to load data from Facebook in a format you can finetune on. The overall steps are:
Download your messenger data to disk.
Create the Chat Loader and call loader.load() (or loader.lazy_load()) to perform the conversion.
Optionally use merge_chat_runs to combine message from the ... | https://python.langchain.com/docs/integrations/chat_loaders/facebook |
36b055cb0e2b-1 | # Download and unzip
download_and_unzip(url)
File file.zip downloaded.
File file.zip has been unzipped.
2. Create Chat Loader
We have 2 different FacebookMessengerChatLoader classes, one for an entire directory of chats, and one to load individual files. We
directory_path = "./hogwarts"
from langchain.chat_loaders.fac... | https://python.langchain.com/docs/integrations/chat_loaders/facebook |
36b055cb0e2b-2 | # Now all of Harry Potter's messages will take the AI message class
# which maps to the 'assistant' role in OpenAI's training format
alternating_sessions[0]['messages'][:3]
[AIMessage(content="Professor Snape, I was hoping I could speak with you for a moment about something that's been concerning me lately.", additiona... | https://python.langchain.com/docs/integrations/chat_loaders/facebook |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 4