Callback handler for promptlayer.
Upstash Ratelimit Error
Raised when the rate limit is reached in UpstashRatelimitHandler
Callback to handle rate limiting based on the number of requests or the number of tokens in the input.
It uses Upstash Ratelimit to track the ratelimit which utilizes Upstash Redis to track the state
Label Studio mode enumerator.
Label Studio callback handler. Provides the ability to send predictions to Label Studio for human evaluation, feedback and annotation.
Callback handler that is used within a Flyte task.
Callback Handler that records transcripts to the Context service.
(https://context.ai).
Callback Handler that tracks bedrock anthropic info.
Handle the metadata and associated function states for callbacks.
Callback Handler that logs metrics and artifacts to mlflow server.
Callback Handler that logs metrics and artifacts to mlflow server.
Token type enum.
Callback Handler that tracks OpenAI info.
Callback Handler that logs to ClearML.
Callback Handler that logs prompt artifacts and metrics to SageMaker Experiments.
The UpTrain data schema for tracking evaluation results.
Callback Handler that logs evaluation results to uptrain and the console.
Callback Handler that logs to Arize.
Exception to raise when a person manually review and rejects a value.
Callback for manually validating values.
Asynchronous callback for manually validating values.
Callback Handler that logs to Comet.
Callback handler for the metadata and associated function states for callbacks.
Callback Handler that logs to Aim.
Callback Handler that logs to Arthur platform.
Arthur helps enterprise teams optimize model operations and performance at scale. The Arthur API tracks model performance, explainability, and fairness
Context manager for LLMonitor user context.
Callback Handler for LLMonitor`.
Parameters:
- `app_id`: The app id of the app you want to report to. Defaults to
`None`, which means that `LLMONITOR_APP_ID` will be used.
- `api_url
Callback Handler that logs to Infino.
Callback Handler that logs into Argilla.
Callback Handler that logs into deepeval.
Callback handler for Trubrics.
Callback Handler that logs to Weights and Biases.
Callback Handler for logging to WhyLabs. This callback handler utilizes
langkit to extract features from the prompts & responses when interacting with
an LLM. These features can be used to guardrail
Enumerator of the LLMThought state.
Tool record as a NamedTuple.
Generates markdown labels for LLMThought containers. Pass a custom subclass of this to StreamlitCallbackHandler to override its default labeling logic.
A thought in the LLM's thought stream.
Callback handler that writes to a Streamlit app.
Enumerator of the child type.
Child record as a NamedTuple.
Streamlit expander that can be renamed and dynamically expanded/collapsed.
Comet Tracer.
Arguments for the WandbTracer.
Callback Handler that logs to Weights and Biases.
This handler will log the model architecture and run traces to Weights and Biases. This will ensure that all LangChain activity is logged to W&B.
Chain that requests a URL and then uses an LLM to parse results.
Security Note: This chain can make GET requests to arbitrary URLs, including internal URLs.
Control access to who can run
Parse the response and error tags.
Get the response parser.
Parse the request and error tags.
Get the request parser.
Chain interacts with an OpenAPI endpoint using natural language.
Question-answering against Ontotext GraphDB https://graphdb.ontotext.com/ by generating SPARQL queries.
Security note: Make sure that the database connection uses credentials that are narrow
Question-answering against a graph by generating Cypher statements for Kùzu.
Security note: Make sure that the database connection uses credentials that are narrowly-scoped to only include nece
Chain for question-answering against a graph by generating Cypher statements.
Security note: Make sure that the database connection uses credentials that are narrowly-scoped to only include nec
Chain for question-answering against a graph by generating gremlin statements.
Security note: Make sure that the database connection uses credentials that are narrowly-scoped to only include ne
Chain for question-answering against a graph by generating gremlin statements.
Security note: Make sure that the database connection uses credentials that are narrowly-scoped to only include ne
Chain for question-answering against a graph by generating nGQL statements.
Security note: Make sure that the database connection uses credentials that are narrowly-scoped to only include neces
Question-answering against an RDF or OWL graph by generating SPARQL statements.
Security note: Make sure that the database connection uses credentials that are narrowly-scoped to only include n
Chain for question-answering against a graph by generating Cypher statements.
Security note: Make sure that the database connection uses credentials that are narrowly-scoped to only include nec
Chain for question-answering against a graph by generating AQL statements.
Security note: Make sure that the database connection uses credentials that are narrowly-scoped to only include necess
Chain for question-answering against a graph.
Security note: Make sure that the database connection uses credentials that are narrowly-scoped to only include necessary permissions. Failure
Routes available for the Pebblo API as enumerator.
Wrapper for Pebblo Retrieval API.
Class for an authorization context.
Class for a semantic entity filter.
Class for a semantic topic filter.
Class for a semantic context.
Input for PebbloRetrievalQA chain.
OS, language details
Langchain framework details
Retrieval Chain with Identity & Semantic Enforcement for question-answering against a vector database.
Dict like wrapper around search api results.
Wrapper for Searx API.
To use you need to provide the searx host by passing the named parameter
searx_host or exporting the environment variable SEARX_HOST.
In some situations you might want
Access to the TensorFlow Datasets.
The Current implementation can work only with datasets that fit in a memory.
TensorFlow Datasets is a collection of datasets ready to use, with TensorFlow
or oth
Wrapper for AskNews API.
Wrapper for OpenAI's DALL-E Image Generator.
https://platform.openai.com/docs/guides/images/generations?context=node
Usage instructions:
pip install openaiWrapper for AWS Lambda SDK.
To use, you should have the boto3 package installed
and a lambda functions built from the AWS Console or
CLI. Set up your AWS credentials with aws configure
Wrapper around the Serper.dev Google Search API.
You can create a free API key at https://serper.dev.
To use, you should have the environment variable SERPER_API_KEY
set with your API key, or pa
Metadata on a single hit from you.com
A single hit from you.com, which may contain multiple snippets
Output from you.com API.
Output of parsing one snippet.
Wrapper for you.com Search and News API.
To connect to the You.com api requires an API key which you can get at https://api.you.com. You can check out the docs at https://documentation.you.com/api-re
Routes available for the Pebblo API as enumerator.
Pebblo Indexed Document.
Pebblo Runtime.
Pebblo Framework instance.
Pebblo AI application.
Pebblo document.
Wrapper for Pebblo Loader API.
Wrapper for DuckDuckGo Search API.
Free and does not require any setup.
Wrapper for AlphaVantage API for Currency Exchange Rate.
Docs for using:
Base class for all components.
Class for a task.
Component class for a list.
Component class for a member.
Component class for a team.
Component class for a space.
Wrapper for Clickup API.
Wrapper around Google Places API.
Searches for places using Google Maps Platform. Returns detailed information including addresses, phone numbers, and websites.
Requires
Wrapper for Reddit API
To use, set the environment variables REDDIT_CLIENT_ID,
REDDIT_CLIENT_SECRET, REDDIT_USER_AGENT to set the client ID,
client secret, and user agent, respectively, a
Wrapper for SerpApi's Google Scholar API
You can create SerpApi.com key by signing up at: https://serpapi.com/users/sign_up.
The wrapper uses the SerpApi.com python package: https://serpapi.com/inte
Wrapper for NASA API.
Wrapper around semanticscholar.org API. https://github.com/danielnsilva/semanticscholar
You should have this library installed.
pip install semanticscholar
Semantic Scholar API can conduct search
Wrapper around Dria API.
This wrapper facilitates interactions with Dria's vector search and retrieval services, including creating knowledge bases, inserting data, and fetching search results.
Wrapper around the Jina search engine.
Portkey configuration.
Wrapper for Tavily Search API.
Wrapper around requests to handle auth and async.
The main purpose of this wrapper is to handle authentication (by saving headers) and enable easy async methods on the same base object.
Lightweight wrapper around requests library.
Lightweight wrapper around requests library, with async support.
The main purpose of this wrapper is to always return a json output.
Lightweight wrapper around requests library, with async support.
The main purpose of this wrapper is to always return a text output.
Wrapper for GitLab API.
Wrapper for Rememberizer APIs.
Wrapper for Zapier NLA.
Full docs here: https://nla.zapier.com/start/
This wrapper supports both API Key and OAuth Credential auth methods. API Key is the fastest way to get started using this wrapp
Wrapper around Google Books API.
To use, you should have a Google Books API key available. This wrapper will use the Google Books API to conduct searches and fetch books based on a query passed in by
Wrapper for Merriam-Webster.
Docs for using:
Context manager to hide prints.
Wrapper around SerpAPI.
To use, you should have the google-search-results python package installed,
and the environment variable SERPAPI_API_KEY set with your API key, or pass
`serpapi_api_ke
Wrapper around ArxivAPI.
To use, you should have the arxiv python package installed.
https://lukasschwab.me/arxiv.py/index.html
This wrapper will use the Arxiv API to conduct searches and
fetch d
Wrapper around bibtexparser.
To use, you should have the bibtexparser python package installed.
https://bibtexparser.readthedocs.io/en/master/
This wrapper will use bibtexparser to load a collec
Messaging Client using Twilio.
To use, you should have the twilio python package installed,
and the environment variables TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN, and
TWILIO_FROM_NUMBER
Jira OAuth2 token.
Jira OAuth2.
Wrapper for Jira API. You can connect to Jira with either an API token or OAuth2.
Create PowerBI engine from dataset ID and credential or token.
Use either the credential or a supplied token to authenticate. If both are supplied the credential is used to generate a token. The impe
Wrapper for financial datasets API.
Wrapper for SerpApi's Google Scholar API
You can create SerpApi.com key by signing up at: https://serpapi.com/users/sign_up. The wrapper uses the SerpApi.com python package: https://serpapi.com/integ
Wrapper around GraphQL API.
To use, you should have the gql python package installed.
This wrapper will use the GraphQL API to conduct queries.
Wrapper for Bing Web Search API.
Interface for querying Alibaba Cloud MaxCompute tables.
Wrapper for Steam API.
SQLAlchemy wrapper around a database.
Wrapper for OpenWeatherMap API using PyOWM.
Docs for using:
Wrapper around SearchApi API.
To use, you should have the environment variable SEARCHAPI_API_KEY
set with your API key, or pass searchapi_api_key
as a named parameter to the constructor.
Enumerator of the HTTP verbs.
OpenAPI Model that removes mis-formatted parts of the spec.
Wrapper for Stack Exchange API.
Wrapper for Polygon API.
Apache Cassandra® database wrapper.
Exception raised for errors in the database schema.
SparkSQL is a utility class for interacting with Spark SQL.
Mixin to prevent storing on disk.
Manage the token for the NutritionAI API.
Wrapper for the Passio Nutrition AI API.
Wrapper for SceneXplain API.
In order to set this up, you need API key for the SceneXplain API. You can obtain a key by following the steps below.
An empty Sentinel type.
An enum of the possible choices for Riva audio encoding.
The list of types exposed by the Riva GRPC Protobuf files can be found with the following commands:
import riva.client
print(riva.cl
Configuration for the authentication to a Riva service connection.
A collection of common Riva settings.
A message containing streaming audio.
A runnable that performs Automatic Speech Recognition (ASR) using NVIDIA Riva.
A runnable that performs Text-to-Speech (TTS) with NVIDIA Riva.
Wrapper for Wolfram Alpha.
Docs for using:
Wrapper for Google Scholar API
You can create serpapi key by signing up at: https://serpapi.com/users/sign_up.
The wrapper uses the serpapi python package: https://serpapi.com/integrations/python#se
Wrapper for Golden.
Docs for using:
Wrapper for Infobip API for messaging.
Wrapper for SerpApi's Google Lens API
You can create SerpApi.com key by signing up at: https://serpapi.com/users/sign_up.
The wrapper uses the SerpApi.com python package: https://serpapi.com/integra
Wrapper around the Wikidata API.
To use, you should have the wikibase-rest-api-client and
mediawikiapi python packages installed.
This wrapper will use the Wikibase APIs to conduct searches
Wrapper for Metaphor Search API.
Wrapper around OutlineAPI.
This wrapper will use the Outline API to query the documents of your instance. By default it will return the document content of the top-k results. It limits the document c
Escape punctuation within an input string.
Wrapper around WikipediaAPI.
To use, you should have the wikipedia python package installed.
This wrapper will use the Wikipedia API to conduct searches and
fetch page summaries. By default, it w
Wrapper for SerpApi's Google Finance API
You can create SerpApi.com key by signing up at: https://serpapi.com/users/sign_up. The wrapper uses the SerpApi.com python package: https://serpapi.com/integ
Wrapper around PubMed API.
This wrapper will use the PubMed API to conduct searches and fetch document summaries. By default, it will return the document summaries of the top-k results of an input se
Setup mode for AstraDBEnvironment as enumerator.
Routes available for the Arcee API as enumerator.
Filter types available for a DALM retrieval as enumerator.
Filters available for a DALM retrieval and generation.
Source of an Arcee document.
Arcee document.
Adapter for Arcee documents
Wrapper for Arcee API.
For more details, see: https://www.arcee.ai/
Wrapper around the Brave search engine.
Wrapper for Dataherald.
Docs for using:
Wrapper around the DataForSeo API.
Wrapper for GitHub API.
Representation of a callable function to the Ernie API.
Representation of a callable function to the Ernie API.
Parse the output of an LLM call using Guardrails.
Parse an output that is one of sets of values.
Parse an output as the Json object.
Parse an output as the element of the Json object.
Parse an output as a pydantic object.
Parse an output as an attribute of a pydantic object.
Translate Databricks vector search internal query language elements to
valid filters.
Translate Mongo internal query language elements to valid filters.
Translate Elasticsearch internal query language elements to valid filters.
Logic for converting internal query language elements to valid filters.
Translate Chroma internal query language elements to valid filters.
Translate Qdrant internal query language elements to valid filters.
Translate Langchain filters to Supabase PostgREST filters.
Translate Pinecone internal query language elements to valid filters.
Translate Weaviate internal query language elements to valid filters.
Translate Vectara internal query language elements to valid filters.
Translate DingoDB internal query language elements to valid filters.
Translate MyScale internal query language elements to valid filters.
Translate PGVector internal query language elements to valid filters.
Translate the internal query language elements to valid filters.
Translate OpenSearch internal query domain-specific
language elements to valid filters.
Visitor for translating structured queries to Redis filter expressions.
Translate Milvus internal query language elements to valid filters.
Translate StructuredQuery to Tencent VectorDB query.
Translate DeepLake internal query language elements to valid filters.
Translate AstraDB internal query language elements to valid filters.
Fake cross encoder model.
Content handler for CrossEncoder class.
SageMaker Inference CrossEncoder endpoint.
To use, you must supply the endpoint name from your deployed Sagemaker model & the region where it is deployed.
To authenticate, the AWS client uses the fo
HuggingFace cross encoder models.
Allows a BaseModel to return its fields by string variable indexing.
Choice.
Chat completions.
Choice chunk.
Chat completion chunk.
Chat completion.
Completions.
Chat.
Table used to keep track of when a key was last updated.
A SQL Alchemy based implementation of the record manager.
A MongoDB based implementation of the document manager.
Abstract base class for a record manager.
Select and order examples based on ngram overlap score (sentence_bleu score
from NLTK package).
https://www.nltk.org/_modules/nltk/translate/bleu_score.html https://aclanthology.org/P02-1040.pdf
Simple in memory docstore in the form of a dict.
Docstore via arbitrary lookup function.
Wikipedia API.
Interface to access to place that stores documents.
Mixin class that supports adding texts.
A ByteStore implementation using Cassandra as the backend.
BaseStore implementation using MongoDB as the underlying store.
BaseStore implementation using MongoDB as the underlying store.
BaseStore implementation using Upstash Redis as the underlying store to store raw bytes.
Table used to save values.
BaseStore interface that works on an SQL database.
BaseStore implementation using Redis as the underlying store.
Base class for the DataStax AstraDB data store.
Chain for question-answering against a graph by generating Cypher statements.
Security note: Make sure that the database connection uses credentials that are narrowly-scoped to only include nec
Used to correct relationship direction in generated Cypher statements. This code is copied from the winner's submission to the Cypher competition: https://github.com/sakusaku-rich/cypher-direction-com
Wrapper for Google Search API.
Adapted from: Instructions adapted from https://stackoverflow.com/questions/ 37083058/ programmatically-searching-google-in-python-using-custom-search
TODO: DOCS for u
Wrapper around Apify.
To use, you should have the apify-client python package installed,
and the environment variable APIFY_API_TOKEN set with your API key, or pass
apify_api_token as a name
DEPRECATED: This class is deprecated and will no longer be maintained. Please use query_constructors.HanaTranslator from the langchain_hana package instead. It offers an improved implementation an
Translate Neo4j internal query language elements to valid filters.
BaseStore implementation using Upstash Redis as the underlying store to store strings.
Deprecated in favor of the more generic UpstashRedisByteStore.
Import the fiddler python package and raise an error if it is not installed.
Get default Label Studio configs for the given mode.
Import flytekit and flytekitplugins-deck-standard.
Analyze text using textstat and spacy.
Import the getcontext package.
Import the spacy python package and raise an error if it is not installed.
Import the pandas python package and raise an error if it is not installed.
Import the textstat python package and raise an error if it is not installed.
Flatten a nested dictionary into a flat dictionary.
Hash a string using sha1.
Load json file to a string.
Import the mlflow python package and raise an error if it is not installed.
Get the metrics to log to MLFlow.
Get the text complexity metrics from textstat.
Analyze text using textstat and spacy.
Construct an html element from a prompt and a generation.
Standardize the model name to a format that can be used in the OpenAI API.
Get the cost in USD for a given model and number of tokens.
Import the clearml python package and raise an error if it is not installed.
Save dict to local file path.
Import the uptrain package.
Import comet_ml and raise an error if it is not installed.
Import the aim python package and raise an error if it is not installed.
Builds an LLMonitor UserContextManager
Import the infino client.
Import tiktoken for counting tokens for OpenAI models.
Calculate num tokens for OpenAI with tiktoken package.
Get the OpenAI callback handler in a context manager. which conveniently exposes token and cost information.
Get the Bedrock anthropic callback handler in a context manager. which conveniently exposes token and cost information.
Get the WandbTracer in a context manager.
Import the wandb python package and raise an error if it is not installed.
Load json file to a dictionary.
Analyze text using textstat and spacy.
Construct an html element from a prompt and a generation.
Import the langkit python package and raise an error if it is not installed.
Callback Handler that writes to a Streamlit app.
This CallbackHandler is geared towards use with a LangChain Agent; it displays the Agent's LLM and tool-usage "thoughts" inside a series of Streamlit
Import comet_llm api and raise an error if it is not installed.
Utility to flatten a nest run object into a list of runs. :param run: The base run to flatten. :return: The flattened list of runs.
Utility to truncate a list of runs dictionaries to only keep the specified keys in each run. :param runs: The list of runs to truncate. :param keep_keys: The keys to keep in each run. :return: The
Utility to modify the serialized field of a list of runs dictionaries. removes any keys that match the exact_keys and any keys that contain any of the partial_keys. recursively moves the dictionaries
Builds a nested dictionary from a list of runs. :param runs: The list of runs to build the tree from. :return: The nested dictionary representing the langchain Run in a tree structure compatible w
Remove a prefix from a text.
Extract Cypher code from a text.
Extract Cypher code from a text.
Extract Gremlin code from a text.
Extract SPARQL code from a text.
Extract Cypher code from a text. Args: text: Text to extract Cypher code from.
Trim the query to only include Cypher keywords.
Decides whether to use the simple prompt
Fetch the current Framework and Runtime details.
Fetch local runtime ip address.
Clear the identity and semantic enforcement filters in the retriever search_kwargs.
Set identity and semantic enforcement filters in the retriever.
Convert a Python function to an Ernie function-calling API compatible dict.
Assumes the Python function has type hints and a docstring with a description. If the docstring has Google Python style
Convert a raw function/class to an Ernie function.
Get the appropriate function output parser given the user functions.
Create a runnable sequence that uses Ernie functions.
Create a runnable that uses an Ernie function to get a structured output.
[Legacy] Create an LLM chain that uses Ernie functions.