(langchain.chat_models.ChatOpenAI attribute)
(langchain.embeddings.HuggingFaceEmbeddings attribute)
(langchain.embeddings.HuggingFaceInstructEmbeddings attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.GooseAI attribute)
(langchain.llms.NLPCloud attribute)
(langchain.llms.OpenAIChat attribute)
(langchain.llms.Petals attribute)
(langchain.llms.PromptLayerOpenAIChat attribute)
model_path (langchain.llms.LlamaCpp attribute)
model_reqs (langchain.embeddings.SelfHostedHuggingFaceEmbeddings attribute)
(langchain.embeddings.SelfHostedHuggingFaceInstructEmbeddings attribute)
(langchain.llms.SelfHostedHuggingFaceLLM attribute)
(langchain.llms.SelfHostedPipeline attribute)
model_url (langchain.embeddings.TensorflowHubEmbeddings attribute)
modelname_to_contextsize() (langchain.llms.AzureOpenAI method)
(langchain.llms.OpenAI method)
(langchain.llms.PromptLayerOpenAI method)
    module

langchain.agents
langchain.agents.agent_toolkits
langchain.chains
langchain.chat_models
langchain.docstore
langchain.document_loaders
langchain.document_transformers
langchain.embeddings
langchain.llms
langchain.memory
langchain.output_parsers
langchain.prompts
langchain.prompts.example_selector
langchain.python
langchain.retrievers
langchain.retrievers.document_compressors
langchain.serpapi
langchain.text_splitter
langchain.tools
langchain.utilities
langchain.utilities.searx_search
langchain.vectorstores
moving_summary_buffer (langchain.memory.ConversationSummaryBufferMemory attribute)
MyScale (class in langchain.vectorstores)
N
n (langchain.chat_models.ChatOpenAI attribute)


N
n (langchain.chat_models.ChatOpenAI attribute)
(langchain.llms.AlephAlpha attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.GooseAI attribute)
n_batch (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
n_ctx (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
n_parts (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
n_predict (langchain.llms.GPT4All attribute)
n_threads (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
name (langchain.agents.agent_toolkits.VectorStoreInfo attribute)
(langchain.experimental.GenerativeAgent attribute)
(langchain.llms.PredictionGuard attribute)
(langchain.output_parsers.ResponseSchema attribute)
(langchain.tools.BaseTool attribute)
nla_tools (langchain.agents.agent_toolkits.NLAToolkit attribute)
NLTKTextSplitter (class in langchain.text_splitter)
no_update_value (langchain.output_parsers.RegexDictParser attribute)
normalize (langchain.embeddings.AlephAlphaAsymmetricSemanticEmbedding attribute)
NotebookLoader (class in langchain.document_loaders)
NotionDBLoader (class in langchain.document_loaders)
NotionDirectoryLoader (class in langchain.document_loaders)
num_beams (langchain.llms.NLPCloud attribute)
num_return_sequences (langchain.llms.NLPCloud attribute)


num_return_sequences (langchain.llms.NLPCloud attribute)
numResults (langchain.llms.AI21 attribute)
O
observation_prefix (langchain.agents.Agent property)
(langchain.agents.ConversationalAgent property)
(langchain.agents.ConversationalChatAgent property)
(langchain.agents.ZeroShotAgent property)
ObsidianLoader (class in langchain.document_loaders)
OnlinePDFLoader (class in langchain.document_loaders)
openai_api_base (langchain.chat_models.AzureChatOpenAI attribute)
openai_api_key (langchain.chains.OpenAIModerationChain attribute)
(langchain.chat_models.AzureChatOpenAI attribute)
(langchain.chat_models.ChatOpenAI attribute)
openai_api_type (langchain.chat_models.AzureChatOpenAI attribute)
openai_api_version (langchain.chat_models.AzureChatOpenAI attribute)
openai_organization (langchain.chains.OpenAIModerationChain attribute)
(langchain.chat_models.AzureChatOpenAI attribute)
(langchain.chat_models.ChatOpenAI attribute)
openapi (langchain.tools.OpenAPISpec attribute)
OpenSearchVectorSearch (class in langchain.vectorstores)
openweathermap_api_key (langchain.utilities.OpenWeatherMapAPIWrapper attribute)
operation_id (langchain.tools.APIOperation attribute)
other_score_keys (langchain.retrievers.TimeWeightedVectorStoreRetriever attribute)
OutlookMessageLoader (class in langchain.document_loaders)
output_key (langchain.chains.QAGenerationChain attribute)
(langchain.memory.ConversationStringBufferMemory attribute)
output_key_to_format (langchain.output_parsers.RegexDictParser attribute)
output_keys (langchain.chains.ConstitutionalChain property)
(langchain.chains.HypotheticalDocumentEmbedder property)
(langchain.chains.QAGenerationChain property)
(langchain.experimental.BabyAGI property)


(langchain.chains.QAGenerationChain property)
(langchain.experimental.BabyAGI property)
(langchain.output_parsers.RegexParser attribute)
output_parser (langchain.agents.Agent attribute)
(langchain.agents.ConversationalAgent attribute)
(langchain.agents.ConversationalChatAgent attribute)
(langchain.agents.LLMSingleActionAgent attribute)
(langchain.agents.ReActTextWorldAgent attribute)
(langchain.agents.ZeroShotAgent attribute)
(langchain.prompts.BasePromptTemplate attribute)
output_variables (langchain.chains.TransformChain attribute)
owm (langchain.utilities.OpenWeatherMapAPIWrapper attribute)
P
p (langchain.llms.Cohere attribute)
page_content_key (langchain.retrievers.RemoteLangChainRetriever attribute)
PagedPDFSplitter (in module langchain.document_loaders)
paginate_request() (langchain.document_loaders.ConfluenceLoader method)
param_mapping (langchain.chains.OpenAPIEndpointChain attribute)
params (langchain.serpapi.SerpAPIWrapper attribute)
(langchain.utilities.searx_search.SearxSearchWrapper attribute)
(langchain.utilities.SearxSearchWrapper attribute)
(langchain.utilities.SerpAPIWrapper attribute)
parse() (langchain.agents.AgentOutputParser method)
(langchain.output_parsers.CommaSeparatedListOutputParser method)
(langchain.output_parsers.GuardrailsOutputParser method)
(langchain.output_parsers.ListOutputParser method)
(langchain.output_parsers.OutputFixingParser method)
(langchain.output_parsers.PydanticOutputParser method)
(langchain.output_parsers.RegexDictParser method)
(langchain.output_parsers.RegexParser method)
(langchain.output_parsers.RetryOutputParser method)
(langchain.output_parsers.RetryWithErrorOutputParser method)
(langchain.output_parsers.StructuredOutputParser method)


(langchain.output_parsers.StructuredOutputParser method)
parse_filename() (langchain.document_loaders.BlackboardLoader method)
parse_obj() (langchain.tools.OpenAPISpec class method)
parse_sitemap() (langchain.document_loaders.SitemapLoader method)
parse_with_prompt() (langchain.output_parsers.RetryOutputParser method)
(langchain.output_parsers.RetryWithErrorOutputParser method)
parser (langchain.output_parsers.OutputFixingParser attribute)
(langchain.output_parsers.RetryOutputParser attribute)
(langchain.output_parsers.RetryWithErrorOutputParser attribute)
partial() (langchain.prompts.BasePromptTemplate method)
(langchain.prompts.ChatPromptTemplate method)
password (langchain.vectorstores.MyScaleSettings attribute)
patch() (langchain.utilities.TextRequestsWrapper method)
path (langchain.tools.APIOperation attribute)
path_params (langchain.tools.APIOperation property)
paths (langchain.tools.OpenAPISpec attribute)
pause_to_reflect() (langchain.experimental.GenerativeAgentMemory method)
PDFMinerLoader (class in langchain.document_loaders)
PDFMinerPDFasHTMLLoader (class in langchain.document_loaders)
penalty_alpha_frequency (langchain.llms.RWKV attribute)
penalty_alpha_presence (langchain.llms.RWKV attribute)
penalty_bias (langchain.llms.AlephAlpha attribute)
penalty_exceptions (langchain.llms.AlephAlpha attribute)
penalty_exceptions_include_stop_sequences (langchain.llms.AlephAlpha attribute)
persist() (langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
Pinecone (class in langchain.vectorstores)
pl_tags (langchain.chat_models.PromptLayerChatOpenAI attribute)
plan() (langchain.agents.Agent method)


plan() (langchain.agents.Agent method)
(langchain.agents.BaseMultiActionAgent method)
(langchain.agents.BaseSingleActionAgent method)
(langchain.agents.LLMSingleActionAgent method)
PlaywrightURLLoader (class in langchain.document_loaders)
plugin (langchain.tools.AIPluginTool attribute)
port (langchain.vectorstores.MyScaleSettings attribute)
post() (langchain.utilities.TextRequestsWrapper method)
PostgresChatMessageHistory (class in langchain.memory)
powerbi (langchain.agents.agent_toolkits.PowerBIToolkit attribute)
predict() (langchain.chains.LLMChain method)
predict_and_parse() (langchain.chains.LLMChain method)
prefix (langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
prefix_messages (langchain.llms.OpenAIChat attribute)
(langchain.llms.PromptLayerOpenAIChat attribute)
prep_prompts() (langchain.chains.LLMChain method)
prep_streaming_params() (langchain.llms.AzureOpenAI method)
(langchain.llms.OpenAI method)
(langchain.llms.PromptLayerOpenAI method)
prepare_cosmos() (langchain.memory.CosmosDBChatMessageHistory method)
presence_penalty (langchain.llms.AlephAlpha attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.Cohere attribute)
(langchain.llms.GooseAI attribute)
presencePenalty (langchain.llms.AI21 attribute)
prioritize_tasks() (langchain.experimental.BabyAGI method)
process_attachment() (langchain.document_loaders.ConfluenceLoader method)
process_doc() (langchain.document_loaders.ConfluenceLoader method)
process_image() (langchain.document_loaders.ConfluenceLoader method)


process_image() (langchain.document_loaders.ConfluenceLoader method)
process_index_results() (langchain.vectorstores.Annoy method)
process_page() (langchain.document_loaders.ConfluenceLoader method)
process_pdf() (langchain.document_loaders.ConfluenceLoader method)
process_svg() (langchain.document_loaders.ConfluenceLoader method)
process_xls() (langchain.document_loaders.ConfluenceLoader method)
Prompt (in module langchain.prompts)
prompt (langchain.chains.ConversationChain attribute)
(langchain.chains.LLMBashChain attribute)
(langchain.chains.LLMChain attribute)
(langchain.chains.LLMMathChain attribute)
(langchain.chains.PALChain attribute)
(langchain.chains.SQLDatabaseChain attribute)
properties (langchain.tools.APIOperation attribute)
put() (langchain.utilities.TextRequestsWrapper method)
pydantic_object (langchain.output_parsers.PydanticOutputParser attribute)
PyMuPDFLoader (class in langchain.document_loaders)
PyPDFLoader (class in langchain.document_loaders)
python_globals (langchain.chains.PALChain attribute)
python_locals (langchain.chains.PALChain attribute)
PythonCodeTextSplitter (class in langchain.text_splitter)
PythonLoader (class in langchain.document_loaders)
Q
qa_chain (langchain.chains.GraphQAChain attribute)
Qdrant (class in langchain.vectorstores)
query_instruction (langchain.embeddings.HuggingFaceInstructEmbeddings attribute)
(langchain.embeddings.SelfHostedHuggingFaceInstructEmbeddings attribute)
query_name (langchain.vectorstores.SupabaseVectorStore attribute)
query_params (langchain.tools.APIOperation property)
query_suffix (langchain.utilities.searx_search.SearxSearchWrapper attribute)


query_suffix (langchain.utilities.searx_search.SearxSearchWrapper attribute)
(langchain.utilities.SearxSearchWrapper attribute)
R
random_seed (langchain.llms.Writer attribute)
raw_completion (langchain.llms.AlephAlpha attribute)
REACT_DOCSTORE (langchain.agents.AgentType attribute)
ReadTheDocsLoader (class in langchain.document_loaders)
recall_ttl (langchain.memory.RedisEntityStore attribute)
recursive (langchain.document_loaders.GoogleDriveLoader attribute)
RecursiveCharacterTextSplitter (class in langchain.text_splitter)
redis_client (langchain.memory.RedisEntityStore attribute)
RedisChatMessageHistory (class in langchain.memory)
RedisEntityStore (class in langchain.memory)
reduce_k_below_max_tokens (langchain.chains.RetrievalQAWithSourcesChain attribute)
(langchain.chains.VectorDBQAWithSourcesChain attribute)
reflection_threshold (langchain.experimental.GenerativeAgentMemory attribute)
regex (langchain.output_parsers.RegexParser attribute)
regex_pattern (langchain.output_parsers.RegexDictParser attribute)
region_name (langchain.embeddings.SagemakerEndpointEmbeddings attribute)
(langchain.llms.SagemakerEndpoint attribute)
relevancy_threshold (langchain.retrievers.SVMRetriever attribute)
remove_end_sequence (langchain.llms.NLPCloud attribute)
remove_input (langchain.llms.NLPCloud attribute)
repeat_last_n (langchain.llms.GPT4All attribute)
repeat_penalty (langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
repetition_penalties_include_completion (langchain.llms.AlephAlpha attribute)
repetition_penalties_include_prompt (langchain.llms.AlephAlpha attribute)
repetition_penalty (langchain.llms.ForefrontAI attribute)


repetition_penalty (langchain.llms.ForefrontAI attribute)
(langchain.llms.NLPCloud attribute)
(langchain.llms.Writer attribute)
repo_id (langchain.embeddings.HuggingFaceHubEmbeddings attribute)
(langchain.llms.HuggingFaceHub attribute)
request_body (langchain.tools.APIOperation attribute)
request_timeout (langchain.chat_models.ChatOpenAI attribute)
(langchain.llms.AzureOpenAI attribute)
request_url (langchain.utilities.PowerBIDataset property)
requests (langchain.chains.OpenAPIEndpointChain attribute)
(langchain.utilities.TextRequestsWrapper property)
requests_per_second (langchain.document_loaders.WebBaseLoader attribute)
requests_wrapper (langchain.agents.agent_toolkits.OpenAPIToolkit attribute)
(langchain.chains.APIChain attribute)
(langchain.chains.LLMRequestsChain attribute)
response_key (langchain.retrievers.RemoteLangChainRetriever attribute)
response_schemas (langchain.output_parsers.StructuredOutputParser attribute)
results() (langchain.serpapi.SerpAPIWrapper method)
(langchain.utilities.BingSearchAPIWrapper method)
(langchain.utilities.GoogleSearchAPIWrapper method)
(langchain.utilities.searx_search.SearxSearchWrapper method)
(langchain.utilities.SearxSearchWrapper method)
(langchain.utilities.SerpAPIWrapper method)
retriever (langchain.chains.ConversationalRetrievalChain attribute)
(langchain.chains.RetrievalQA attribute)
(langchain.chains.RetrievalQAWithSourcesChain attribute)
(langchain.memory.VectorStoreRetrieverMemory attribute)
retry_chain (langchain.output_parsers.OutputFixingParser attribute)
(langchain.output_parsers.RetryOutputParser attribute)
(langchain.output_parsers.RetryWithErrorOutputParser attribute)
return_all (langchain.chains.SequentialChain attribute)


return_all (langchain.chains.SequentialChain attribute)
return_direct (langchain.chains.SQLDatabaseChain attribute)
(langchain.tools.BaseTool attribute)
return_docs (langchain.memory.VectorStoreRetrieverMemory attribute)
return_intermediate_steps (langchain.agents.AgentExecutor attribute)
(langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute)
(langchain.chains.OpenAPIEndpointChain attribute)
(langchain.chains.PALChain attribute)
(langchain.chains.SQLDatabaseChain attribute)
(langchain.chains.SQLDatabaseSequentialChain attribute)
return_pl_id (langchain.chat_models.PromptLayerChatOpenAI attribute)
return_stopped_response() (langchain.agents.Agent method)
(langchain.agents.BaseMultiActionAgent method)
(langchain.agents.BaseSingleActionAgent method)
return_values (langchain.agents.Agent property)
(langchain.agents.BaseMultiActionAgent property)
(langchain.agents.BaseSingleActionAgent property)
revised_answer_prompt (langchain.chains.LLMCheckerChain attribute)
revised_summary_prompt (langchain.chains.LLMSummarizationCheckerChain attribute)
revision_chain (langchain.chains.ConstitutionalChain attribute)
RoamLoader (class in langchain.document_loaders)
run() (langchain.python.PythonREPL method)
(langchain.serpapi.SerpAPIWrapper method)
(langchain.tools.BaseTool method)
(langchain.utilities.ArxivAPIWrapper method)
(langchain.utilities.BashProcess method)
(langchain.utilities.BingSearchAPIWrapper method)
(langchain.utilities.GooglePlacesAPIWrapper method)
(langchain.utilities.GoogleSearchAPIWrapper method)
(langchain.utilities.GoogleSerperAPIWrapper method)
(langchain.utilities.OpenWeatherMapAPIWrapper method)


(langchain.utilities.OpenWeatherMapAPIWrapper method)
(langchain.utilities.PowerBIDataset method)
(langchain.utilities.PythonREPL method)
(langchain.utilities.searx_search.SearxSearchWrapper method)
(langchain.utilities.SearxSearchWrapper method)
(langchain.utilities.SerpAPIWrapper method)
(langchain.utilities.WikipediaAPIWrapper method)
(langchain.utilities.WolframAlphaAPIWrapper method)
rwkv_verbose (langchain.llms.RWKV attribute)
S
S3DirectoryLoader (class in langchain.document_loaders)
S3FileLoader (class in langchain.document_loaders)
sample_rows_in_table_info (langchain.utilities.PowerBIDataset attribute)
save() (langchain.agents.AgentExecutor method)
(langchain.agents.BaseMultiActionAgent method)
(langchain.agents.BaseSingleActionAgent method)
(langchain.llms.AI21 method)
(langchain.llms.AlephAlpha method)
(langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.Banana method)
(langchain.llms.CerebriumAI method)
(langchain.llms.Cohere method)
(langchain.llms.DeepInfra method)
(langchain.llms.ForefrontAI method)
(langchain.llms.GooseAI method)
(langchain.llms.GPT4All method)
(langchain.llms.HuggingFaceEndpoint method)
(langchain.llms.HuggingFaceHub method)
(langchain.llms.HuggingFacePipeline method)
(langchain.llms.LlamaCpp method)
(langchain.llms.Modal method)
(langchain.llms.NLPCloud method)
(langchain.llms.OpenAI method)
(langchain.llms.OpenAIChat method)
(langchain.llms.Petals method)
(langchain.llms.PredictionGuard method)


(langchain.llms.Petals method)
(langchain.llms.PredictionGuard method)
(langchain.llms.PromptLayerOpenAI method)
(langchain.llms.PromptLayerOpenAIChat method)
(langchain.llms.Replicate method)
(langchain.llms.RWKV method)
(langchain.llms.SagemakerEndpoint method)
(langchain.llms.SelfHostedHuggingFaceLLM method)
(langchain.llms.SelfHostedPipeline method)
(langchain.llms.StochasticAI method)
(langchain.llms.Writer method)
(langchain.prompts.BasePromptTemplate method)
(langchain.prompts.ChatPromptTemplate method)
save_agent() (langchain.agents.AgentExecutor method)
save_context() (langchain.experimental.GenerativeAgentMemory method)
(langchain.memory.CombinedMemory method)
(langchain.memory.ConversationEntityMemory method)
(langchain.memory.ConversationKGMemory method)
(langchain.memory.ConversationStringBufferMemory method)
(langchain.memory.ConversationSummaryBufferMemory method)
(langchain.memory.ConversationSummaryMemory method)
(langchain.memory.ConversationTokenBufferMemory method)
(langchain.memory.ReadOnlySharedMemory method)
(langchain.memory.SimpleMemory method)
(langchain.memory.VectorStoreRetrieverMemory method)
save_local() (langchain.vectorstores.Annoy method)
(langchain.vectorstores.FAISS method)
schemas (langchain.utilities.PowerBIDataset attribute)
scrape() (langchain.document_loaders.WebBaseLoader method)
scrape_all() (langchain.document_loaders.WebBaseLoader method)
search() (langchain.docstore.InMemoryDocstore method)
(langchain.docstore.Wikipedia method)
(langchain.vectorstores.DeepLake method)
search_kwargs (langchain.chains.ChatVectorDBChain attribute)
(langchain.chains.VectorDBQA attribute)


(langchain.chains.VectorDBQA attribute)
(langchain.chains.VectorDBQAWithSourcesChain attribute)
(langchain.retrievers.TimeWeightedVectorStoreRetriever attribute)
search_type (langchain.chains.VectorDBQA attribute)
searx_host (langchain.utilities.searx_search.SearxSearchWrapper attribute)
(langchain.utilities.SearxSearchWrapper attribute)
SearxResults (class in langchain.utilities.searx_search)
security (langchain.tools.OpenAPISpec attribute)
seed (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
select_examples() (langchain.prompts.example_selector.LengthBasedExampleSelector method)
(langchain.prompts.example_selector.MaxMarginalRelevanceExampleSelector method)
(langchain.prompts.example_selector.SemanticSimilarityExampleSelector method)
SeleniumURLLoader (class in langchain.document_loaders)
SELF_ASK_WITH_SEARCH (langchain.agents.AgentType attribute)
SentenceTransformerEmbeddings (in module langchain.embeddings)
serpapi_api_key (langchain.serpapi.SerpAPIWrapper attribute)
(langchain.utilities.SerpAPIWrapper attribute)
serper_api_key (langchain.utilities.GoogleSerperAPIWrapper attribute)
servers (langchain.tools.OpenAPISpec attribute)
service_account_key (langchain.document_loaders.GoogleDriveLoader attribute)
service_account_path (langchain.document_loaders.GoogleApiClient attribute)
session_id (langchain.memory.RedisEntityStore attribute)
set() (langchain.memory.InMemoryEntityStore method)
(langchain.memory.RedisEntityStore method)
similarity_fn (langchain.document_transformers.EmbeddingsRedundantFilter attribute)
(langchain.retrievers.document_compressors.EmbeddingsFilter attribute)


(langchain.retrievers.document_compressors.EmbeddingsFilter attribute)
similarity_search() (langchain.vectorstores.AnalyticDB method)
(langchain.vectorstores.Annoy method)
(langchain.vectorstores.AtlasDB method)
(langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
(langchain.vectorstores.ElasticVectorSearch method)
(langchain.vectorstores.FAISS method)
(langchain.vectorstores.Milvus method)
(langchain.vectorstores.MyScale method)
(langchain.vectorstores.OpenSearchVectorSearch method)
(langchain.vectorstores.Pinecone method)
(langchain.vectorstores.Qdrant method)
(langchain.vectorstores.SupabaseVectorStore method)
(langchain.vectorstores.VectorStore method)
(langchain.vectorstores.Weaviate method)
similarity_search_by_index() (langchain.vectorstores.Annoy method)
similarity_search_by_vector() (langchain.vectorstores.AnalyticDB method)
(langchain.vectorstores.Annoy method)
(langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
(langchain.vectorstores.FAISS method)
(langchain.vectorstores.Milvus method)
(langchain.vectorstores.MyScale method)
(langchain.vectorstores.SupabaseVectorStore method)
(langchain.vectorstores.VectorStore method)
(langchain.vectorstores.Weaviate method)
similarity_search_by_vector_returning_embeddings() (langchain.vectorstores.SupabaseVectorStore method)
similarity_search_by_vector_with_relevance_scores() (langchain.vectorstores.SupabaseVectorStore method)
similarity_search_with_relevance_scores() (langchain.vectorstores.MyScale method)
(langchain.vectorstores.SupabaseVectorStore method)
(langchain.vectorstores.VectorStore method)
similarity_search_with_score() (langchain.vectorstores.AnalyticDB method)


similarity_search_with_score() (langchain.vectorstores.AnalyticDB method)
(langchain.vectorstores.Annoy method)
(langchain.vectorstores.Chroma method)
(langchain.vectorstores.DeepLake method)
(langchain.vectorstores.ElasticVectorSearch method)
(langchain.vectorstores.FAISS method)
(langchain.vectorstores.Milvus method)
(langchain.vectorstores.Pinecone method)
(langchain.vectorstores.Qdrant method)
similarity_search_with_score_by_index() (langchain.vectorstores.Annoy method)
similarity_search_with_score_by_vector() (langchain.vectorstores.AnalyticDB method)
(langchain.vectorstores.Annoy method)
(langchain.vectorstores.FAISS method)
(langchain.vectorstores.Milvus method)
similarity_threshold (langchain.document_transformers.EmbeddingsRedundantFilter attribute)
(langchain.retrievers.document_compressors.EmbeddingsFilter attribute)
SitemapLoader (class in langchain.document_loaders)
siterestrict (langchain.utilities.GoogleSearchAPIWrapper attribute)
SlackDirectoryLoader (class in langchain.document_loaders)
SpacyTextSplitter (class in langchain.text_splitter)
sparse_encoder (langchain.retrievers.PineconeHybridSearchRetriever attribute)
spec (langchain.agents.agent_toolkits.JsonToolkit attribute)
split_documents() (langchain.text_splitter.TextSplitter method)
split_text() (langchain.text_splitter.CharacterTextSplitter method)
(langchain.text_splitter.NLTKTextSplitter method)
(langchain.text_splitter.RecursiveCharacterTextSplitter method)
(langchain.text_splitter.SpacyTextSplitter method)
(langchain.text_splitter.TextSplitter method)
(langchain.text_splitter.TokenTextSplitter method)
sql_chain (langchain.chains.SQLDatabaseSequentialChain attribute)


sql_chain (langchain.chains.SQLDatabaseSequentialChain attribute)
SRTLoader (class in langchain.document_loaders)
status (langchain.experimental.GenerativeAgent attribute)
stop (langchain.agents.LLMSingleActionAgent attribute)
(langchain.chains.PALChain attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
(langchain.llms.Writer attribute)
stop_sequences (langchain.llms.AlephAlpha attribute)
store (langchain.memory.InMemoryEntityStore attribute)
strategy (langchain.llms.RWKV attribute)
stream() (langchain.llms.Anthropic method)
(langchain.llms.AzureOpenAI method)
(langchain.llms.LlamaCpp method)
(langchain.llms.OpenAI method)
(langchain.llms.PromptLayerOpenAI method)
streaming (langchain.chat_models.ChatOpenAI attribute)
(langchain.llms.Anthropic attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
(langchain.llms.OpenAIChat attribute)
(langchain.llms.PromptLayerOpenAIChat attribute)
strip_outputs (langchain.chains.SimpleSequentialChain attribute)
suffix (langchain.llms.LlamaCpp attribute)
(langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
summarize_related_memories() (langchain.experimental.GenerativeAgent method)
summary (langchain.experimental.GenerativeAgent attribute)
summary_message_cls (langchain.memory.ConversationKGMemory attribute)
summary_refresh_seconds (langchain.experimental.GenerativeAgent attribute)
SupabaseVectorStore (class in langchain.vectorstores)
T
table (langchain.vectorstores.MyScaleSettings attribute)


T
table (langchain.vectorstores.MyScaleSettings attribute)
table_info (langchain.utilities.PowerBIDataset property)
table_name (langchain.vectorstores.SupabaseVectorStore attribute)
table_names (langchain.utilities.PowerBIDataset attribute)
tags (langchain.tools.OpenAPISpec attribute)
task (langchain.embeddings.HuggingFaceHubEmbeddings attribute)
(langchain.llms.HuggingFaceEndpoint attribute)
(langchain.llms.HuggingFaceHub attribute)
(langchain.llms.SelfHostedHuggingFaceLLM attribute)
TelegramChatLoader (class in langchain.document_loaders)
temp (langchain.llms.GPT4All attribute)
temperature (langchain.chat_models.ChatOpenAI attribute)
(langchain.llms.AI21 attribute)
(langchain.llms.AlephAlpha attribute)
(langchain.llms.Anthropic attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.Cohere attribute)
(langchain.llms.ForefrontAI attribute)
(langchain.llms.GooseAI attribute)
(langchain.llms.LlamaCpp attribute)
(langchain.llms.NLPCloud attribute)
(langchain.llms.Petals attribute)
(langchain.llms.PredictionGuard attribute)
(langchain.llms.RWKV attribute)
(langchain.llms.Writer attribute)
template (langchain.prompts.PromptTemplate attribute)
template_format (langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
(langchain.prompts.PromptTemplate attribute)
text_length (langchain.chains.LLMRequestsChain attribute)
text_splitter (langchain.chains.AnalyzeDocumentChain attribute)
(langchain.chains.MapReduceChain attribute)
(langchain.chains.QAGenerationChain attribute)
TextLoader (class in langchain.document_loaders)


TextLoader (class in langchain.document_loaders)
texts (langchain.retrievers.SVMRetriever attribute)
TextSplitter (class in langchain.text_splitter)
tfidf_array (langchain.retrievers.TFIDFRetriever attribute)
to_typescript() (langchain.tools.APIOperation method)
token (langchain.utilities.PowerBIDataset attribute)
token_path (langchain.document_loaders.GoogleApiClient attribute)
(langchain.document_loaders.GoogleDriveLoader attribute)
tokenizer (langchain.llms.Petals attribute)
tokens (langchain.llms.AlephAlpha attribute)
tokens_path (langchain.llms.RWKV attribute)
tokens_to_generate (langchain.llms.Writer attribute)
TokenTextSplitter (class in langchain.text_splitter)
tool() (in module langchain.agents)
tool_run_logging_kwargs() (langchain.agents.Agent method)
(langchain.agents.BaseMultiActionAgent method)
(langchain.agents.BaseSingleActionAgent method)
(langchain.agents.LLMSingleActionAgent method)
tools (langchain.agents.agent_toolkits.JiraToolkit attribute)
(langchain.agents.agent_toolkits.ZapierToolkit attribute)
(langchain.agents.AgentExecutor attribute)
(langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute)
top_k (langchain.chains.SQLDatabaseChain attribute)
(langchain.llms.AlephAlpha attribute)
(langchain.llms.Anthropic attribute)
(langchain.llms.ForefrontAI attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
(langchain.llms.NLPCloud attribute)
(langchain.llms.Petals attribute)
(langchain.llms.Writer attribute)


(langchain.llms.Petals attribute)
(langchain.llms.Writer attribute)
(langchain.retrievers.ChatGPTPluginRetriever attribute)
(langchain.retrievers.DataberryRetriever attribute)
(langchain.retrievers.PineconeHybridSearchRetriever attribute)
top_k_docs_for_context (langchain.chains.ChatVectorDBChain attribute)
top_k_results (langchain.utilities.ArxivAPIWrapper attribute)
(langchain.utilities.GooglePlacesAPIWrapper attribute)
(langchain.utilities.WikipediaAPIWrapper attribute)
top_p (langchain.llms.AlephAlpha attribute)
(langchain.llms.Anthropic attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.ForefrontAI attribute)
(langchain.llms.GooseAI attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
(langchain.llms.NLPCloud attribute)
(langchain.llms.Petals attribute)
(langchain.llms.RWKV attribute)
(langchain.llms.Writer attribute)
topP (langchain.llms.AI21 attribute)
traits (langchain.experimental.GenerativeAgent attribute)
transform (langchain.chains.TransformChain attribute)
transform_documents() (langchain.document_transformers.EmbeddingsRedundantFilter method)
(langchain.text_splitter.TextSplitter method)
transformers (langchain.retrievers.document_compressors.DocumentCompressorPipeline attribute)
truncate (langchain.embeddings.CohereEmbeddings attribute)
(langchain.llms.Cohere attribute)
ts_type_from_python() (langchain.tools.APIOperation static method)
ttl (langchain.memory.RedisEntityStore attribute)
TwitterTweetLoader (class in langchain.document_loaders)
U
unsecure (langchain.utilities.searx_search.SearxSearchWrapper attribute)


U
unsecure (langchain.utilities.searx_search.SearxSearchWrapper attribute)
(langchain.utilities.SearxSearchWrapper attribute)
UnstructuredEmailLoader (class in langchain.document_loaders)
UnstructuredEPubLoader (class in langchain.document_loaders)
UnstructuredFileIOLoader (class in langchain.document_loaders)
UnstructuredFileLoader (class in langchain.document_loaders)
UnstructuredHTMLLoader (class in langchain.document_loaders)
UnstructuredImageLoader (class in langchain.document_loaders)
UnstructuredMarkdownLoader (class in langchain.document_loaders)
UnstructuredPDFLoader (class in langchain.document_loaders)
UnstructuredPowerPointLoader (class in langchain.document_loaders)
UnstructuredRTFLoader (class in langchain.document_loaders)
UnstructuredURLLoader (class in langchain.document_loaders)
UnstructuredWordDocumentLoader (class in langchain.document_loaders)
update_document() (langchain.vectorstores.Chroma method)
update_forward_refs() (langchain.llms.AI21 class method)
(langchain.llms.AlephAlpha class method)
(langchain.llms.Anthropic class method)
(langchain.llms.AzureOpenAI class method)
(langchain.llms.Banana class method)
(langchain.llms.CerebriumAI class method)
(langchain.llms.Cohere class method)
(langchain.llms.DeepInfra class method)
(langchain.llms.ForefrontAI class method)
(langchain.llms.GooseAI class method)
(langchain.llms.GPT4All class method)
(langchain.llms.HuggingFaceEndpoint class method)
(langchain.llms.HuggingFaceHub class method)
(langchain.llms.HuggingFacePipeline class method)
(langchain.llms.LlamaCpp class method)


(langchain.llms.LlamaCpp class method)
(langchain.llms.Modal class method)
(langchain.llms.NLPCloud class method)
(langchain.llms.OpenAI class method)
(langchain.llms.OpenAIChat class method)
(langchain.llms.Petals class method)
(langchain.llms.PredictionGuard class method)
(langchain.llms.PromptLayerOpenAI class method)
(langchain.llms.PromptLayerOpenAIChat class method)
(langchain.llms.Replicate class method)
(langchain.llms.RWKV class method)
(langchain.llms.SagemakerEndpoint class method)
(langchain.llms.SelfHostedHuggingFaceLLM class method)
(langchain.llms.SelfHostedPipeline class method)
(langchain.llms.StochasticAI class method)
(langchain.llms.Writer class method)
upsert_messages() (langchain.memory.CosmosDBChatMessageHistory method)
url (langchain.retrievers.ChatGPTPluginRetriever attribute)
(langchain.retrievers.RemoteLangChainRetriever attribute)
(langchain.tools.IFTTTWebhook attribute)
urls (langchain.document_loaders.PlaywrightURLLoader attribute)
(langchain.document_loaders.SeleniumURLLoader attribute)
use_mlock (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
use_mmap (langchain.llms.LlamaCpp attribute)
use_multiplicative_presence_penalty (langchain.llms.AlephAlpha attribute)
username (langchain.vectorstores.MyScaleSettings attribute)
V
validate_channel_or_videoIds_is_set() (langchain.document_loaders.GoogleApiClient class method)
(langchain.document_loaders.GoogleApiYoutubeLoader class method)


(langchain.document_loaders.GoogleApiYoutubeLoader class method)
validate_init_args() (langchain.document_loaders.ConfluenceLoader static method)
validate_template (langchain.prompts.FewShotPromptTemplate attribute)
(langchain.prompts.FewShotPromptWithTemplates attribute)
(langchain.prompts.PromptTemplate attribute)
vectorizer (langchain.retrievers.TFIDFRetriever attribute)
VectorStore (class in langchain.vectorstores)
vectorstore (langchain.agents.agent_toolkits.VectorStoreInfo attribute)
(langchain.chains.ChatVectorDBChain attribute)
(langchain.chains.VectorDBQA attribute)
(langchain.chains.VectorDBQAWithSourcesChain attribute)
(langchain.prompts.example_selector.SemanticSimilarityExampleSelector attribute)
(langchain.retrievers.TimeWeightedVectorStoreRetriever attribute)
vectorstore_info (langchain.agents.agent_toolkits.VectorStoreToolkit attribute)
vectorstores (langchain.agents.agent_toolkits.VectorStoreRouterToolkit attribute)
verbose (langchain.agents.MRKLChain attribute)
(langchain.agents.ReActChain attribute)
(langchain.agents.SelfAskWithSearchChain attribute)
(langchain.chat_models.ChatAnthropic attribute)
(langchain.llms.AzureOpenAI attribute)
(langchain.llms.OpenAI attribute)
(langchain.llms.OpenAIChat attribute)
(langchain.tools.BaseTool attribute)
video_ids (langchain.document_loaders.GoogleApiYoutubeLoader attribute)
vocab_only (langchain.embeddings.LlamaCppEmbeddings attribute)
(langchain.llms.GPT4All attribute)
(langchain.llms.LlamaCpp attribute)
W
Weaviate (class in langchain.vectorstores)
WeaviateHybridSearchRetriever (class in langchain.retrievers)
WeaviateHybridSearchRetriever.Config (class in langchain.retrievers)


WeaviateHybridSearchRetriever.Config (class in langchain.retrievers)
web_path (langchain.document_loaders.WebBaseLoader property)
web_paths (langchain.document_loaders.AZLyricsLoader attribute)
(langchain.document_loaders.CollegeConfidentialLoader attribute)
(langchain.document_loaders.GitbookLoader attribute)
(langchain.document_loaders.HNLoader attribute)
(langchain.document_loaders.IMSDbLoader attribute)
(langchain.document_loaders.SitemapLoader attribute)
(langchain.document_loaders.WebBaseLoader attribute)
WebBaseLoader (class in langchain.document_loaders)
webhooks (langchain.tools.OpenAPISpec attribute)
WhatsAppChatLoader (class in langchain.document_loaders)
Wikipedia (class in langchain.docstore)
wolfram_alpha_appid (langchain.utilities.WolframAlphaAPIWrapper attribute)
Y
YoutubeLoader (class in langchain.document_loaders)
Z
ZERO_SHOT_REACT_DESCRIPTION (langchain.agents.AgentType attribute)
Zilliz (class in langchain.vectorstores)
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


Search
Error
Please activate JavaScript to enable the search functionality.
Ctrl+K
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Deployments
 Contents
Streamlit
Gradio (on Hugging Face)
Beam
Vercel
Digitalocean App Platform
Google Cloud Run
SteamShip
Langchain-serve
BentoML
Databutton
Deployments#
So you’ve made a really cool chain - now what? How do you deploy it and make it easily sharable with the world?
This section covers several options for that.
Note that these are meant as quick deployment options for prototypes and demos, and not for production systems.
If you are looking for help with deployment of a production system, please contact us directly.
What follows is a list of template GitHub repositories aimed that are intended to be
very easy to fork and modify to use your chain.
This is far from an exhaustive list of options, and we are EXTREMELY open to contributions here.
Streamlit#
This repo serves as a template for how to deploy a LangChain with Streamlit.
It implements a chatbot interface.
It also contains instructions for how to deploy this app on the Streamlit platform.
Gradio (on Hugging Face)#
This repo serves as a template for how deploy a LangChain with Gradio.
It implements a chatbot interface, with a “Bring-Your-Own-Token” approach (nice for not wracking up big bills).
It also contains instructions for how to deploy this app on the Hugging Face platform.
This is heavily influenced by James Weaver’s excellent examples.
Beam#
This repo serves as a template for how deploy a LangChain with Beam.
It implements a Question Answering app and contains instructions for deploying the app as a serverless REST API.
Vercel#
A minimal example on how to run LangChain on Vercel using Flask.
Digitalocean App Platform#


Digitalocean App Platform#
A minimal example on how to deploy LangChain to DigitalOcean App Platform.
Google Cloud Run#
A minimal example on how to deploy LangChain to Google Cloud Run.
SteamShip#
This repository contains LangChain adapters for Steamship, enabling LangChain developers to rapidly deploy their apps on Steamship.
This includes: production ready endpoints, horizontal scaling across dependencies, persistant storage of app state, multi-tenancy support, etc.
Langchain-serve#
This repository allows users to serve local chains and agents as RESTful, gRPC, or Websocket APIs thanks to Jina. Deploy your chains & agents with ease and enjoy independent scaling, serverless and autoscaling APIs, as well as a Streamlit playground on Jina AI Cloud.
BentoML#
This repository provides an example of how to deploy a LangChain application with BentoML. BentoML is a framework that enables the containerization of machine learning applications as standard OCI images. BentoML also allows for the automatic generation of OpenAPI and gRPC endpoints. With BentoML, you can integrate models from all popular ML frameworks and deploy them as microservices running on the most optimal hardware and scaling independently.
Databutton#
These templates serve as examples of how to build, deploy, and share LangChain applications using Databutton. You can create user interfaces with Streamlit, automate tasks by scheduling Python code, and store files and data in the built-in store. Examples include Chatbot interface with conversational memory, Personal search engine, and a starter template for LangChain apps. Deploying and sharing is one click.
previous
LangChain Gallery
next
Tracing
 Contents

Streamlit
Gradio (on Hugging Face)
Beam
Vercel
Digitalocean App Platform
Google Cloud Run
SteamShip
Langchain-serve
BentoML
Databutton


Google Cloud Run
SteamShip
Langchain-serve
BentoML
Databutton
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.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 nomic
Nomic is also included in langchains poetry extras poetry install -E all
Wrappers#
VectorStore#
There exists a wrapper around the Atlas neural database, allowing you to use it as a vectorstore.
This vectorstore also gives you full access to the underlying AtlasProject object, which will allow you to use the full range of Atlas map interactions, such as bulk tagging and automatic topic modeling.
Please see the Atlas docs for more detailed information.
To import this vectorstore:
from langchain.vectorstores import AtlasDB
For a more detailed walkthrough of the AtlasDB wrapper, see this notebook
previous
Apify
next
Banana
 Contents

Installation and Setup
Wrappers
VectorStore
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.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 install pgvector
Setup#
The first step is to create a database with the pgvector extension installed.
Follow the steps at PGVector Installation Steps to install the database and the extension. The docker image is the easiest way to get started.
Wrappers#
VectorStore#
There exists a wrapper around Postgres vector databases, allowing you to use it as a vectorstore,
whether for semantic search or example selection.
To import this vectorstore:
from langchain.vectorstores.pgvector import PGVector
Usage#
For a more detailed walkthrough of the PGVector Wrapper, see this notebook
previous
Petals
next
Pinecone
 Contents

Installation
Setup
Wrappers
VectorStore
Usage
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.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, crawling, and extraction use cases.
This integration enables you run Actors on the Apify platform and load their results into LangChain to feed your vector
indexes with documents and data from the web, e.g. to generate answers from websites with documentation,
blogs, or knowledge bases.
Installation and Setup#
Install the Apify API client for Python with pip install apify-client
Get your Apify API token and either set it as
an environment variable (APIFY_API_TOKEN) or pass it to the ApifyWrapper as apify_api_token in the constructor.
Wrappers#
Utility#
You can use the ApifyWrapper to run Actors on the Apify platform.
from langchain.utilities import ApifyWrapper
For a more detailed walkthrough of this wrapper, see this notebook.
Loader#
You can also use our ApifyDatasetLoader to get data from Apify dataset.
from langchain.document_loaders import ApifyDatasetLoader
For a more detailed walkthrough of this loader, see this notebook.
previous
AnalyticDB
next
AtlasDB
 Contents

Overview
Installation and Setup
Wrappers
Utility
Loader
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Zilliz
 Contents
Installation and Setup
Wrappers
VectorStore
Zilliz#
This page covers how to use the Zilliz Cloud ecosystem within LangChain.
Zilliz uses the Milvus integration.
It is broken into two parts: installation and setup, and then references to specific Milvus wrappers.
Installation and Setup#
Install the Python SDK with pip install pymilvus
Wrappers#
VectorStore#
There exists a wrapper around Zilliz indexes, allowing you to use it as a vectorstore,
whether for semantic search or example selection.
To import this vectorstore:
from langchain.vectorstores import Milvus
For a more detailed walkthrough of the Miluvs wrapper, see this notebook
previous
Yeager.ai
next
Glossary
 Contents

Installation and Setup
Wrappers
VectorStore
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Google Search Wrapper
 Contents
Installation and Setup
Wrappers
Utility
Tool
Google Search Wrapper#
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 with pip install google-api-python-client
Set up a Custom Search Engine, following these instructions
Get an API Key and Custom Search Engine ID from the previous step, and set them as environment variables GOOGLE_API_KEY and GOOGLE_CSE_ID respectively
Wrappers#
Utility#
There exists a GoogleSearchAPIWrapper utility which wraps this API. To import this utility:
from langchain.utilities import GoogleSearchAPIWrapper
For a more detailed walkthrough of this wrapper, see this notebook.
Tool#
You can also easily load this wrapper as a Tool (to use with an Agent).
You can do this with:
from langchain.agents import load_tools
tools = load_tools(["google-search"])
For more information on this, see this page
previous
ForefrontAI
next
Google Serper Wrapper
 Contents

Installation and Setup
Wrappers
Utility
Tool
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.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-client
Wrappers#
VectorStore#
There exists a wrapper around Qdrant indexes, allowing you to use it as a vectorstore,
whether for semantic search or example selection.
To import this vectorstore:
from langchain.vectorstores import Qdrant
For a more detailed walkthrough of the Qdrant wrapper, see this notebook
previous
PromptLayer
next
Replicate
 Contents

Installation and Setup
Wrappers
VectorStore
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.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 promptlayer python library pip install promptlayer
Create a PromptLayer account
Create an api token and set it as an environment variable (PROMPTLAYER_API_KEY)
Wrappers#
LLM#
There exists an PromptLayer OpenAI LLM wrapper, which you can access with
from langchain.llms import PromptLayerOpenAI
To tag your requests, use the argument pl_tags when instanializing the LLM
from langchain.llms import PromptLayerOpenAI
llm = PromptLayerOpenAI(pl_tags=["langchain-requests", "chatbot"])
To get the PromptLayer request id, use the argument return_pl_id when instanializing the LLM
from langchain.llms import PromptLayerOpenAI
llm = PromptLayerOpenAI(return_pl_id=True)
This will add the PromptLayer request ID in the generation_info field of the Generation returned when using .generate or .agenerate
For example:
llm_results = llm.generate(["hello world"])
for res in llm_results.generations:
    print("pl request id: ", res[0].generation_info["pl_request_id"])
You can use the PromptLayer request ID to add a prompt, score, or other metadata to your request. Read more about it here.
This LLM is identical to the OpenAI LLM, except that
all your requests will be logged to your PromptLayer account
you can add pl_tags when instantializing to tag your requests on PromptLayer


you can add pl_tags when instantializing to tag your requests on PromptLayer
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
Qdrant
 Contents

Installation and Setup
Wrappers
LLM
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.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 variable (WRITER_API_KEY)
Wrappers#
LLM#
There exists an Writer LLM wrapper, which you can access with
from langchain.llms import Writer
previous
Wolfram Alpha Wrapper
next
Yeager.ai
 Contents

Installation and Setup
Wrappers
LLM
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Milvus
 Contents
Installation and Setup
Wrappers
VectorStore
Milvus#
This page covers how to use the Milvus ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific Milvus wrappers.
Installation and Setup#
Install the Python SDK with pip install pymilvus
Wrappers#
VectorStore#
There exists a wrapper around Milvus indexes, allowing you to use it as a vectorstore,
whether for semantic search or example selection.
To import this vectorstore:
from langchain.vectorstores import Milvus
For a more detailed walkthrough of the Miluvs wrapper, see this notebook
previous
Llama.cpp
next
Modal
 Contents

Installation and Setup
Wrappers
VectorStore
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
GPT4All
 Contents
Installation and Setup
Usage
GPT4All
Model File
GPT4All#
This page covers how to use the GPT4All wrapper within LangChain. The tutorial is divided into two parts: installation and setup, followed by usage with an example.
Installation and Setup#
Install the Python package with pip install pyllamacpp
Download a GPT4All model and place it in your desired directory
Usage#
GPT4All#
To use the GPT4All wrapper, you need to provide the path to the pre-trained model file and the model’s configuration.
from langchain.llms import GPT4All
# Instantiate the model. Callbacks support token-wise streaming
model = GPT4All(model="./models/gpt4all-model.bin", n_ctx=512, n_threads=8)
# Generate text
response = model("Once upon a time, ")
You can also customize the generation parameters, such as n_predict, temp, top_p, top_k, and others.
To stream the model’s predictions, add in a CallbackManager.
from langchain.llms import GPT4All
from langchain.callbacks.base import CallbackManager
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
# There are many CallbackHandlers supported, such as
# from langchain.callbacks.streamlit import StreamlitCallbackHandler
callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
model = GPT4All(model="./models/gpt4all-model.bin", n_ctx=512, n_threads=8, callback_handler=callback_handler, verbose=True)
# Generate text. Tokens are streamed through the callback manager.
model("Once upon a time, ")
Model File#
You can find links to model file downloads in the pyllamacpp repository.


Model File#
You can find links to model file downloads in the pyllamacpp repository.
For a more detailed walkthrough of this, see this notebook
previous
GooseAI
next
Graphsignal
 Contents

Installation and Setup
Usage
GPT4All
Model File
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
ForefrontAI
 Contents
Installation and Setup
Wrappers
LLM
ForefrontAI#
This page covers how to use the ForefrontAI ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific ForefrontAI wrappers.
Installation and Setup#
Get an ForefrontAI api key and set it as an environment variable (FOREFRONTAI_API_KEY)
Wrappers#
LLM#
There exists an ForefrontAI LLM wrapper, which you can access with
from langchain.llms import ForefrontAI
previous
Deep Lake
next
Google Search Wrapper
 Contents

Installation and Setup
Wrappers
LLM
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Chroma
 Contents
Installation and Setup
Wrappers
VectorStore
Chroma#
This page covers how to use the Chroma ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific Chroma wrappers.
Installation and Setup#
Install the Python package with pip install chromadb
Wrappers#
VectorStore#
There exists a wrapper around Chroma vector databases, allowing you to use it as a vectorstore,
whether for semantic search or example selection.
To import this vectorstore:
from langchain.vectorstores import Chroma
For a more detailed walkthrough of the Chroma wrapper, see this notebook
previous
CerebriumAI
next
ClearML Integration
 Contents

Installation and Setup
Wrappers
VectorStore
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Deep Lake
 Contents
Why Deep Lake?
More Resources
Installation and Setup
Wrappers
VectorStore
Deep Lake#
This page covers how to use the Deep Lake ecosystem within LangChain.
Why Deep Lake?#
More than just a (multi-modal) vector store. You can later use the dataset to fine-tune your own LLM models.
Not only stores embeddings, but also the original data with automatic version control.
Truly serverless. Doesn’t require another service and can be used with major cloud providers (AWS S3, GCS, etc.)
More Resources#
Ultimate Guide to LangChain & Deep Lake: Build ChatGPT to Answer Questions on Your Financial Data
Twitter the-algorithm codebase analysis with Deep Lake
Here is whitepaper and academic paper for Deep Lake
Here is a set of additional resources available for review: Deep Lake, Getting Started and Tutorials
Installation and Setup#
Install the Python package with pip install deeplake
Wrappers#
VectorStore#
There exists a wrapper around Deep Lake, a data lake for Deep Learning applications, allowing you to use it as a vector store (for now), whether for semantic search or example selection.
To import this vectorstore:
from langchain.vectorstores import DeepLake
For a more detailed walkthrough of the Deep Lake wrapper, see this notebook
previous
DeepInfra
next
ForefrontAI
 Contents

Why Deep Lake?
More Resources
Installation and Setup
Wrappers
VectorStore
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Google Serper Wrapper
 Contents
Setup
Wrappers
Utility
Output
Tool
Google Serper Wrapper#
This page covers how to use the Serper Google Search API within LangChain. Serper is a low-cost Google Search API that can be used to add answer box, knowledge graph, and organic results data from Google Search.
It is broken into two parts: setup, and then references to the specific Google Serper wrapper.
Setup#
Go to serper.dev to sign up for a free account
Get the api key and set it as an environment variable (SERPER_API_KEY)
Wrappers#
Utility#
There exists a GoogleSerperAPIWrapper utility which wraps this API. To import this utility:
from langchain.utilities import GoogleSerperAPIWrapper
You can use it as part of a Self Ask chain:
from langchain.utilities import GoogleSerperAPIWrapper
from langchain.llms.openai import OpenAI
from langchain.agents import initialize_agent, Tool
from langchain.agents import AgentType
import os
os.environ["SERPER_API_KEY"] = ""
os.environ['OPENAI_API_KEY'] = ""
llm = OpenAI(temperature=0)
search = GoogleSerperAPIWrapper()
tools = [
    Tool(
        name="Intermediate Answer",
        func=search.run,
        description="useful for when you need to ask with search"
    )
]
self_ask_with_search = initialize_agent(tools, llm, agent=AgentType.SELF_ASK_WITH_SEARCH, verbose=True)
self_ask_with_search.run("What is the hometown of the reigning men's U.S. Open champion?")
Output#
Entering new AgentExecutor chain...
 Yes.
Follow up: Who is the reigning men's U.S. Open champion?


Yes.
Follow up: Who is the reigning men's U.S. Open champion?
Intermediate answer: Current champions Carlos Alcaraz, 2022 men's singles champion.
Follow up: Where is Carlos Alcaraz from?
Intermediate answer: El Palmar, Spain
So the final answer is: El Palmar, Spain
> Finished chain.
'El Palmar, Spain'
For a more detailed walkthrough of this wrapper, see this notebook.
Tool#
You can also easily load this wrapper as a Tool (to use with an Agent).
You can do this with:
from langchain.agents import load_tools
tools = load_tools(["google-serper"])
For more information on this, see this page
previous
Google Search Wrapper
next
GooseAI
 Contents

Setup
Wrappers
Utility
Output
Tool
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
StochasticAI
 Contents
Installation and Setup
Wrappers
LLM
StochasticAI#
This page covers how to use the StochasticAI ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific StochasticAI wrappers.
Installation and Setup#
Install with pip install stochasticx
Get an StochasticAI api key and set it as an environment variable (STOCHASTICAI_API_KEY)
Wrappers#
LLM#
There exists an StochasticAI LLM wrapper, which you can access with
from langchain.llms import StochasticAI
previous
SerpAPI
next
Unstructured
 Contents

Installation and Setup
Wrappers
LLM
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Weaviate
 Contents
Installation and Setup
Wrappers
VectorStore
Weaviate#
This page covers how to use the Weaviate ecosystem within LangChain.
What is Weaviate?
Weaviate in a nutshell:
Weaviate is an open-source database of the type vector search engine.
Weaviate allows you to store JSON documents in a class property-like fashion while attaching machine learning vectors to these documents to represent them in vector space.
Weaviate can be used stand-alone (aka bring your vectors) or with a variety of modules that can do the vectorization for you and extend the core capabilities.
Weaviate has a GraphQL-API to access your data easily.
We aim to bring your vector search set up to production to query in mere milliseconds (check our open source benchmarks to see if Weaviate fits your use case).
Get to know Weaviate in the basics getting started guide in under five minutes.
Weaviate in detail:
Weaviate is a low-latency vector search engine with out-of-the-box support for different media types (text, images, etc.). It offers Semantic Search, Question-Answer Extraction, Classification, Customizable Models (PyTorch/TensorFlow/Keras), etc. Built from scratch in Go, Weaviate stores both objects and vectors, allowing for combining vector search with structured filtering and the fault tolerance of a cloud-native database. It is all accessible through GraphQL, REST, and various client-side programming languages.
Installation and Setup#
Install the Python SDK with pip install weaviate-client
Wrappers#
VectorStore#
There exists a wrapper around Weaviate indexes, allowing you to use it as a vectorstore,
whether for semantic search or example selection.
To import this vectorstore:
from langchain.vectorstores import Weaviate


To import this vectorstore:
from langchain.vectorstores import Weaviate
For a more detailed walkthrough of the Weaviate wrapper, see this notebook
previous
Weights & Biases
next
Wolfram Alpha Wrapper
 Contents

Installation and Setup
Wrappers
VectorStore
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Helicone
 Contents
What is Helicone?
Quick start
How to enable Helicone caching
How to use Helicone custom properties
Helicone#
This page covers how to use the Helicone ecosystem within LangChain.
What is Helicone?#
Helicone is an open source observability platform that proxies your OpenAI traffic and provides you key insights into your spend, latency and usage.
Quick start#
With your LangChain environment you can just add the following parameter.
export OPENAI_API_BASE="https://oai.hconeai.com/v1"
Now head over to helicone.ai to create your account, and add your OpenAI API key within our dashboard to view your logs.
How to enable Helicone caching#
from langchain.llms import OpenAI
import openai
openai.api_base = "https://oai.hconeai.com/v1"
llm = OpenAI(temperature=0.9, headers={"Helicone-Cache-Enabled": "true"})
text = "What is a helicone?"
print(llm(text))
Helicone caching docs
How to use Helicone custom properties#
from langchain.llms import OpenAI
import openai
openai.api_base = "https://oai.hconeai.com/v1"
llm = OpenAI(temperature=0.9, headers={
        "Helicone-Property-Session": "24",
        "Helicone-Property-Conversation": "support_issue_2",
        "Helicone-Property-App": "mobile",
      })
text = "What is a helicone?"
print(llm(text))
Helicone property docs
previous
Hazy Research
next
Hugging Face
 Contents

What is Helicone?
Quick start
How to enable Helicone caching
How to use Helicone custom properties


Quick start
How to enable Helicone caching
How to use Helicone custom properties
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Unstructured
 Contents
Installation and Setup
Wrappers
Data Loaders
Unstructured#
This page covers how to use the unstructured
ecosystem within LangChain. The unstructured package from
Unstructured.IO extracts clean text from raw source documents like
PDFs and Word documents.
This page is broken into two parts: installation and setup, and then references to specific
unstructured wrappers.
Installation and Setup#
Install the Python SDK with pip install "unstructured[local-inference]"
Install the following system dependencies if they are not already available on your system.
Depending on what document types you’re parsing, you may not need all of these.
libmagic-dev (filetype detection)
poppler-utils (images and PDFs)
tesseract-ocr(images and PDFs)
libreoffice (MS Office docs)
pandoc (EPUBs)
If you are parsing PDFs using the "hi_res" strategy, run the following to install the detectron2 model, which
unstructured uses for layout detection:
pip install "detectron2@git+https://github.com/facebookresearch/detectron2.git@e2ce8dc#egg=detectron2"
If detectron2 is not installed, unstructured will fallback to processing PDFs
using the "fast" strategy, which uses pdfminer directly and doesn’t require
detectron2.
Wrappers#
Data Loaders#
The primary unstructured wrappers within langchain are data loaders. The following
shows how to use the most basic unstructured data loader. There are other file-specific
data loaders available in the langchain.document_loaders module.
from langchain.document_loaders import UnstructuredFileLoader
loader = UnstructuredFileLoader("state_of_the_union.txt")
loader.load()


loader = UnstructuredFileLoader("state_of_the_union.txt")
loader.load()
If you instantiate the loader with UnstructuredFileLoader(mode="elements"), the loader
will track additional metadata like the page number and text type (i.e. title, narrative text)
when that information is available.
previous
StochasticAI
next
Weights & Biases
 Contents

Installation and Setup
Wrappers
Data Loaders
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.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 pip install opensearch-py
Wrappers#
VectorStore#
There exists a wrapper around OpenSearch vector databases, allowing you to use it as a vectorstore
for semantic search using approximate vector search powered by lucene, nmslib and faiss engines
or using painless scripting and script scoring functions for bruteforce vector search.
To import this vectorstore:
from langchain.vectorstores import OpenSearchVectorSearch
For a more detailed walkthrough of the OpenSearch wrapper, see this notebook
previous
OpenAI
next
Petals
 Contents

Installation and Setup
Wrappers
VectorStore
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Wolfram Alpha Wrapper
 Contents
Installation and Setup
Wrappers
Utility
Tool
Wolfram Alpha Wrapper#
This page covers how to use the Wolfram Alpha API within LangChain.
It is broken into two parts: installation and setup, and then references to specific Wolfram Alpha wrappers.
Installation and Setup#
Install requirements with pip install wolframalpha
Go to wolfram alpha and sign up for a developer account here
Create an app and get your APP ID
Set your APP ID as an environment variable WOLFRAM_ALPHA_APPID
Wrappers#
Utility#
There exists a WolframAlphaAPIWrapper utility which wraps this API. To import this utility:
from langchain.utilities.wolfram_alpha import WolframAlphaAPIWrapper
For a more detailed walkthrough of this wrapper, see this notebook.
Tool#
You can also easily load this wrapper as a Tool (to use with an Agent).
You can do this with:
from langchain.agents import load_tools
tools = load_tools(["wolfram-alpha"])
For more information on this, see this page
previous
Weaviate
next
Writer
 Contents

Installation and Setup
Wrappers
Utility
Tool
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Cohere
 Contents
Installation and Setup
Wrappers
LLM
Embeddings
Cohere#
This page covers how to use the Cohere ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific Cohere wrappers.
Installation and Setup#
Install the Python SDK with pip install cohere
Get an Cohere api key and set it as an environment variable (COHERE_API_KEY)
Wrappers#
LLM#
There exists an Cohere LLM wrapper, which you can access with
from langchain.llms import Cohere
Embeddings#
There exists an Cohere Embeddings wrapper, which you can access with
from langchain.embeddings import CohereEmbeddings
For a more detailed walkthrough of this, see this notebook
previous
ClearML Integration
next
Comet
 Contents

Installation and Setup
Wrappers
LLM
Embeddings
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.ipynb
.pdf
Weights & Biases
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 alongside the resultant dashboards you can expect to see.
Run in Colab: https://colab.research.google.com/drive/1DXH4beT4HFaRKy_Vm4PoxhXVDRf7Ym8L?usp=sharing
View Report: https://wandb.ai/a-sh0ts/langchain_callback_demo/reports/Prompt-Engineering-LLMs-with-LangChain-and-W-B–VmlldzozNjk1NTUw#👋-how-to-build-a-callback-in-langchain-for-better-prompt-engineering
!pip install wandb
!pip install pandas
!pip install textstat
!pip install spacy
!python -m spacy download en_core_web_sm
import os
os.environ["WANDB_API_KEY"] = ""
# os.environ["OPENAI_API_KEY"] = ""
# os.environ["SERPAPI_API_KEY"] = ""
from datetime import datetime
from langchain.callbacks import WandbCallbackHandler, StdOutCallbackHandler
from langchain.callbacks.base import CallbackManager
from langchain.llms import OpenAI
Callback Handler that logs to Weights and Biases.
Parameters:
    job_type (str): The type of job.
    project (str): The project to log to.
    entity (str): The entity to log to.
    tags (list): The tags to log.
    group (str): The group to log to.
    name (str): The name of the run.
    notes (str): The notes to log.


notes (str): The notes to log.
    visualize (bool): Whether to visualize the run.
    complexity_metrics (bool): Whether to log complexity metrics.
    stream_logs (bool): Whether to stream callback actions to W&B
Default values for WandbCallbackHandler(...)
visualize: bool = False,
complexity_metrics: bool = False,
stream_logs: bool = False,
NOTE: For beta workflows we have made the default analysis based on textstat and the visualizations based on spacy
"""Main function.
This function is used to try the callback handler.
Scenarios:
1. OpenAI LLM
2. Chain with multiple SubChains on multiple generations
3. Agent with Tools
"""
session_group = datetime.now().strftime("%m.%d.%Y_%H.%M.%S")
wandb_callback = WandbCallbackHandler(
    job_type="inference",
    project="langchain_callback_demo",
    group=f"minimal_{session_group}",
    name="llm",
    tags=["test"],
)
manager = CallbackManager([StdOutCallbackHandler(), wandb_callback])
llm = OpenAI(temperature=0, callback_manager=manager, verbose=True)
wandb: Currently logged in as: harrison-chase. Use `wandb login --relogin` to force relogin


Tracking run with wandb version 0.14.0Run data is saved locally in /Users/harrisonchase/workplace/langchain/docs/ecosystem/wandb/run-20230318_150408-e47j1914Syncing run llm to Weights & Biases (docs) View project at https://wandb.ai/harrison-chase/langchain_callback_demo View run at https://wandb.ai/harrison-chase/langchain_callback_demo/runs/e47j1914wandb: WARNING The wandb callback is currently in beta and is subject to change based on updates to `langchain`. Please report any issues to https://github.com/wandb/wandb/issues with the tag `langchain`.
# Defaults for WandbCallbackHandler.flush_tracker(...)
reset: bool = True,
finish: bool = False,
The flush_tracker function is used to log LangChain sessions to Weights & Biases. It takes in the LangChain module or agent, and logs at minimum the prompts and generations alongside the serialized form of the LangChain module to the specified Weights & Biases project. By default we reset the session as opposed to concluding the session outright.
# SCENARIO 1 - LLM
llm_result = llm.generate(["Tell me a joke", "Tell me a poem"] * 3)
wandb_callback.flush_tracker(llm, name="simple_sequential")


wandb_callback.flush_tracker(llm, name="simple_sequential")
Waiting for W&B process to finish... (success). View run llm at: https://wandb.ai/harrison-chase/langchain_callback_demo/runs/e47j1914Synced 5 W&B file(s), 2 media file(s), 5 artifact file(s) and 0 other file(s)Find logs at: ./wandb/run-20230318_150408-e47j1914/logsTracking run with wandb version 0.14.0Run data is saved locally in /Users/harrisonchase/workplace/langchain/docs/ecosystem/wandb/run-20230318_150534-jyxma7huSyncing run simple_sequential to Weights & Biases (docs) View project at https://wandb.ai/harrison-chase/langchain_callback_demo View run at https://wandb.ai/harrison-chase/langchain_callback_demo/runs/jyxma7hu
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain
# SCENARIO 2 - Chain
template = """You are a playwright. Given the title of play, it is your job to write a synopsis for that title.
Title: {title}
Playwright: This is a synopsis for the above play:"""
prompt_template = PromptTemplate(input_variables=["title"], template=template)
synopsis_chain = LLMChain(llm=llm, prompt=prompt_template, callback_manager=manager)
test_prompts = [
    {
        "title": "documentary about good video games that push the boundary of game design"
    },
    {"title": "cocaine bear vs heroin wolf"},
    {"title": "the best in class mlops tooling"},
]
synopsis_chain.apply(test_prompts)


]
synopsis_chain.apply(test_prompts)
wandb_callback.flush_tracker(synopsis_chain, name="agent")
Waiting for W&B process to finish... (success). View run simple_sequential at: https://wandb.ai/harrison-chase/langchain_callback_demo/runs/jyxma7huSynced 4 W&B file(s), 2 media file(s), 6 artifact file(s) and 0 other file(s)Find logs at: ./wandb/run-20230318_150534-jyxma7hu/logsTracking run with wandb version 0.14.0Run data is saved locally in /Users/harrisonchase/workplace/langchain/docs/ecosystem/wandb/run-20230318_150550-wzy59zjqSyncing run agent to Weights & Biases (docs) View project at https://wandb.ai/harrison-chase/langchain_callback_demo View run at https://wandb.ai/harrison-chase/langchain_callback_demo/runs/wzy59zjq
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, callback_manager=manager)
agent = initialize_agent(
    tools,
    llm,
    agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
    callback_manager=manager,
    verbose=True,
)
agent.run(
    "Who is Leo DiCaprio's girlfriend? What is her current age raised to the 0.43 power?"
)
wandb_callback.flush_tracker(agent, reset=False, finish=True)
> Entering new AgentExecutor chain...
 I need to find out who Leo DiCaprio's girlfriend is and then calculate her age raised to the 0.43 power.
Action: Search


Action: Search
Action Input: "Leo DiCaprio girlfriend"
Observation: DiCaprio had a steady girlfriend in Camila Morrone. He had been with the model turned actress for nearly five years, as they were first said to be dating at the end of 2017. And the now 26-year-old Morrone is no stranger to Hollywood.
Thought: I need to calculate her age raised to the 0.43 power.
Action: Calculator
Action Input: 26^0.43
Observation: Answer: 4.059182145592686
Thought: I now know the final answer.
Final Answer: Leo DiCaprio's girlfriend is Camila Morrone and her current age raised to the 0.43 power is 4.059182145592686.
> Finished chain.
Waiting for W&B process to finish... (success). View run agent at: https://wandb.ai/harrison-chase/langchain_callback_demo/runs/wzy59zjqSynced 5 W&B file(s), 2 media file(s), 7 artifact file(s) and 0 other file(s)Find logs at: ./wandb/run-20230318_150550-wzy59zjq/logs
previous
Unstructured
next
Weaviate
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
DeepInfra
 Contents
Installation and Setup
Wrappers
LLM
DeepInfra#
This page covers how to use the DeepInfra ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific DeepInfra wrappers.
Installation and Setup#
Get your DeepInfra api key from this link here.
Get an DeepInfra api key and set it as an environment variable (DEEPINFRA_API_TOKEN)
Wrappers#
LLM#
There exists an DeepInfra LLM wrapper, which you can access with
from langchain.llms import DeepInfra
previous
Databerry
next
Deep Lake
 Contents

Installation and Setup
Wrappers
LLM
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
AI21 Labs
 Contents
Installation and Setup
Wrappers
LLM
AI21 Labs#
This page covers how to use the AI21 ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific AI21 wrappers.
Installation and Setup#
Get an AI21 api key and set it as an environment variable (AI21_API_KEY)
Wrappers#
LLM#
There exists an AI21 LLM wrapper, which you can access with
from langchain.llms import AI21
previous
LangChain Ecosystem
next
Aim
 Contents

Installation and Setup
Wrappers
LLM
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
NLPCloud
 Contents
Installation and Setup
Wrappers
LLM
NLPCloud#
This page covers how to use the NLPCloud ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific NLPCloud wrappers.
Installation and Setup#
Install the Python SDK with pip install nlpcloud
Get an NLPCloud api key and set it as an environment variable (NLPCLOUD_API_KEY)
Wrappers#
LLM#
There exists an NLPCloud LLM wrapper, which you can access with
from langchain.llms import NLPCloud
previous
MyScale
next
OpenAI
 Contents

Installation and Setup
Wrappers
LLM
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
AnalyticDB
 Contents
VectorStore
AnalyticDB#
This page covers how to use the AnalyticDB ecosystem within LangChain.
VectorStore#
There exists a wrapper around AnalyticDB, allowing you to use it as a vectorstore,
whether for semantic search or example selection.
To import this vectorstore:
from langchain.vectorstores import AnalyticDB
For a more detailed walkthrough of the AnalyticDB wrapper, see this notebook
previous
Aim
next
Apify
 Contents

VectorStore
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Banana
 Contents
Installation and Setup
Define your Banana Template
Build the Banana app
Wrappers
LLM
Banana#
This page covers how to use the Banana ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific Banana wrappers.
Installation and Setup#
Install with pip install banana-dev
Get an Banana api key and set it as an environment variable (BANANA_API_KEY)
Define your Banana Template#
If you want to use an available language model template you can find one here.
This template uses the Palmyra-Base model by Writer.
You can check out an example Banana repository here.
Build the Banana app#
Banana Apps must include the “output” key in the return json.
There is a rigid response structure.
# Return the results as a dictionary
result = {'output': result}
An example inference function would be:
def inference(model_inputs:dict) -> dict:
    global model
    global tokenizer
    # Parse out your arguments
    prompt = model_inputs.get('prompt', None)
    if prompt == None:
        return {'message': "No prompt provided"}
    # Run the model
    input_ids = tokenizer.encode(prompt, return_tensors='pt').cuda()
    output = model.generate(
        input_ids,
        max_length=100,
        do_sample=True,
        top_k=50,
        top_p=0.95,
        num_return_sequences=1,
        temperature=0.9,
        early_stopping=True,
        no_repeat_ngram_size=3,
        num_beams=5,
        length_penalty=1.5,
        repetition_penalty=1.5,
        bad_words_ids=[[tokenizer.encode(' ', add_prefix_space=True)[0]]]
        )


bad_words_ids=[[tokenizer.encode(' ', add_prefix_space=True)[0]]]
        )
    result = tokenizer.decode(output[0], skip_special_tokens=True)
    # Return the results as a dictionary
    result = {'output': result}
    return result
You can find a full example of a Banana app here.
Wrappers#
LLM#
There exists an Banana LLM wrapper, which you can access with
from langchain.llms import Banana
You need to provide a model key located in the dashboard:
llm = Banana(model_key="YOUR_MODEL_KEY")
previous
AtlasDB
next
CerebriumAI
 Contents

Installation and Setup
Define your Banana Template
Build the Banana app
Wrappers
LLM
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Hugging Face
 Contents
Installation and Setup
Wrappers
LLM
Embeddings
Tokenizer
Datasets
Hugging Face#
This page covers how to use the Hugging Face ecosystem (including the Hugging Face Hub) within LangChain.
It is broken into two parts: installation and setup, and then references to specific Hugging Face wrappers.
Installation and Setup#
If you want to work with the Hugging Face Hub:
Install the Hub client library with pip install huggingface_hub
Create a Hugging Face account (it’s free!)
Create an access token and set it as an environment variable (HUGGINGFACEHUB_API_TOKEN)
If you want work with the Hugging Face Python libraries:
Install pip install transformers for working with models and tokenizers
Install pip install datasets for working with datasets
Wrappers#
LLM#
There exists two Hugging Face LLM wrappers, one for a local pipeline and one for a model hosted on Hugging Face Hub.
Note that these wrappers only work for models that support the following tasks: text2text-generation, text-generation
To use the local pipeline wrapper:
from langchain.llms import HuggingFacePipeline
To use a the wrapper for a model hosted on Hugging Face Hub:
from langchain.llms import HuggingFaceHub
For a more detailed walkthrough of the Hugging Face Hub wrapper, see this notebook
Embeddings#
There exists two Hugging Face Embeddings wrappers, one for a local model and one for a model hosted on Hugging Face Hub.
Note that these wrappers only work for sentence-transformers models.
To use the local pipeline wrapper:
from langchain.embeddings import HuggingFaceEmbeddings
To use a the wrapper for a model hosted on Hugging Face Hub:
from langchain.embeddings import HuggingFaceHubEmbeddings


from langchain.embeddings import HuggingFaceHubEmbeddings
For a more detailed walkthrough of this, see this notebook
Tokenizer#
There are several places you can use tokenizers available through the transformers package.
By default, it is used to count tokens for all LLMs.
You can also use it to count tokens when splitting documents with
from langchain.text_splitter import CharacterTextSplitter
CharacterTextSplitter.from_huggingface_tokenizer(...)
For a more detailed walkthrough of this, see this notebook
Datasets#
The Hugging Face Hub has lots of great datasets that can be used to evaluate your LLM chains.
For a detailed walkthrough of how to use them to do so, see this notebook
previous
Helicone
next
Jina
 Contents

Installation and Setup
Wrappers
LLM
Embeddings
Tokenizer
Datasets
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.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
Get an CerebriumAI api key and set it as an environment variable (CEREBRIUMAI_API_KEY)
Wrappers#
LLM#
There exists an CerebriumAI LLM wrapper, which you can access with
from langchain.llms import CerebriumAI
previous
Banana
next
Chroma
 Contents

Installation and Setup
Wrappers
LLM
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Petals
 Contents
Installation and Setup
Wrappers
LLM
Petals#
This page covers how to use the Petals ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific Petals wrappers.
Installation and Setup#
Install with pip install petals
Get a Hugging Face api key and set it as an environment variable (HUGGINGFACE_API_KEY)
Wrappers#
LLM#
There exists an Petals LLM wrapper, which you can access with
from langchain.llms import Petals
previous
OpenSearch
next
PGVector
 Contents

Installation and Setup
Wrappers
LLM
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Graphsignal
 Contents
Installation and Setup
Tracing and Monitoring
Graphsignal#
This page covers how to use Graphsignal to trace and monitor LangChain. Graphsignal enables full visibility into your application. It provides latency breakdowns by chains and tools, exceptions with full context, data monitoring, compute/GPU utilization, OpenAI cost analytics, and more.
Installation and Setup#
Install the Python library with pip install graphsignal
Create free Graphsignal account here
Get an API key and set it as an environment variable (GRAPHSIGNAL_API_KEY)
Tracing and Monitoring#
Graphsignal automatically instruments and starts tracing and monitoring chains. Traces and metrics are then available in your Graphsignal dashboards.
Initialize the tracer by providing a deployment name:
import graphsignal
graphsignal.configure(deployment='my-langchain-app-prod')
To additionally trace any function or code, you can use a decorator or a context manager:
@graphsignal.trace_function
def handle_request():
    chain.run("some initial text")
with graphsignal.start_trace('my-chain'):
    chain.run("some initial text")
Optionally, enable profiling to record function-level statistics for each trace.
with graphsignal.start_trace(
        'my-chain', options=graphsignal.TraceOptions(enable_profiling=True)):
    chain.run("some initial text")
See the Quick Start guide for complete setup instructions.
previous
GPT4All
next
Hazy Research
 Contents

Installation and Setup
Tracing and Monitoring
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Hazy Research
 Contents
Installation and Setup
Wrappers
LLM
Hazy Research#
This page covers how to use the Hazy Research ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific Hazy Research wrappers.
Installation and Setup#
To use the manifest, install it with pip install manifest-ml
Wrappers#
LLM#
There exists an LLM wrapper around Hazy Research’s manifest library.
manifest is a python library which is itself a wrapper around many model providers, and adds in caching, history, and more.
To use this wrapper:
from langchain.llms.manifest import ManifestWrapper
previous
Graphsignal
next
Helicone
 Contents

Installation and Setup
Wrappers
LLM
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Databerry
 Contents
What is Databerry?
Quick start
Databerry#
This page covers how to use the Databerry within LangChain.
What is Databerry?#
Databerry is an open source document retrievial platform that helps to connect your personal data with Large Language Models.
Quick start#
Retrieving documents stored in Databerry from LangChain is very easy!
from langchain.retrievers import DataberryRetriever
retriever = DataberryRetriever(
    datastore_url="https://api.databerry.ai/query/clg1xg2h80000l708dymr0fxc",
    # api_key="DATABERRY_API_KEY", # optional if datastore is public
    # top_k=10 # optional
)
docs = retriever.get_relevant_documents("What's Databerry?")
previous
Comet
next
DeepInfra
 Contents

What is Databerry?
Quick start
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
SerpAPI
 Contents
Installation and Setup
Wrappers
Utility
Tool
SerpAPI#
This page covers how to use the SerpAPI search APIs within LangChain.
It is broken into two parts: installation and setup, and then references to the specific SerpAPI wrapper.
Installation and Setup#
Install requirements with pip install google-search-results
Get a SerpAPI api key and either set it as an environment variable (SERPAPI_API_KEY)
Wrappers#
Utility#
There exists a SerpAPI utility which wraps this API. To import this utility:
from langchain.utilities import SerpAPIWrapper
For a more detailed walkthrough of this wrapper, see this notebook.
Tool#
You can also easily load this wrapper as a Tool (to use with an Agent).
You can do this with:
from langchain.agents import load_tools
tools = load_tools(["serpapi"])
For more information on this, see this page
previous
SearxNG Search API
next
StochasticAI
 Contents

Installation and Setup
Wrappers
Utility
Tool
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
SearxNG Search API
 Contents
Installation and Setup
Self Hosted Instance:
Wrappers
Utility
Tool
SearxNG Search API#
This page covers how to use the SearxNG search API within LangChain.
It is broken into two parts: installation and setup, and then references to the specific SearxNG API wrapper.
Installation and Setup#
While it is possible to utilize the wrapper in conjunction with  public searx
instances these instances frequently do not permit API
access (see note on output format below) and have limitations on the frequency
of requests. It is recommended to opt for a self-hosted instance instead.
Self Hosted Instance:#
See this page for installation instructions.
When you install SearxNG, the only active output format by default is the HTML format.
You need to activate the json format to use the API. This can be done by adding the following line to the settings.yml file:
search:
    formats:
        - html
        - json
You can make sure that the API is working by issuing a curl request to the API endpoint:
curl -kLX GET --data-urlencode q='langchain' -d format=json http://localhost:8888
This should return a JSON object with the results.
Wrappers#
Utility#
To use the wrapper we need to pass the host of the SearxNG instance to the wrapper with:
1. the named parameter searx_host when creating the instance.
2. exporting the environment variable SEARXNG_HOST.
You can use the wrapper to get results from a SearxNG instance.
from langchain.utilities import SearxSearchWrapper
s = SearxSearchWrapper(searx_host="http://localhost:8888")
s.run("what is a large language model?")


s.run("what is a large language model?")
Tool#
You can also load this wrapper as a Tool (to use with an Agent).
You can do this with:
from langchain.agents import load_tools
tools = load_tools(["searx-search"],
                    searx_host="http://localhost:8888",
                    engines=["github"])
Note that we could optionally pass custom engines to use.
If you want to obtain results with metadata as json you can use:
tools = load_tools(["searx-search-results-json"],
                    searx_host="http://localhost:8888",
                    num_results=5)
For more information on tools, see this page
previous
RWKV-4
next
SerpAPI
 Contents

Installation and Setup
Self Hosted Instance:
Wrappers
Utility
Tool
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Yeager.ai
 Contents
What is Yeager.ai?
yAgents
How to use?
Creating and Executing Tools with yAgents
Yeager.ai#
This page covers how to use Yeager.ai to generate LangChain tools and agents.
What is Yeager.ai?#
Yeager.ai is an ecosystem designed to simplify the process of creating AI agents and tools.
It features yAgents, a No-code LangChain Agent Builder, which enables users to build, test, and deploy AI solutions with ease. Leveraging the LangChain framework, yAgents allows seamless integration with various language models and resources, making it suitable for developers, researchers, and AI enthusiasts across diverse applications.
yAgents#
Low code generative agent designed to help you build, prototype, and deploy Langchain tools with ease.
How to use?#
pip install yeagerai-agent
yeagerai-agent
Go to http://127.0.0.1:7860
This will install the necessary dependencies and set up yAgents on your system. After the first run, yAgents will create a .env file where you can input your OpenAI API key. You can do the same directly from the Gradio interface under the tab “Settings”.
OPENAI_API_KEY=<your_openai_api_key_here>
We recommend using GPT-4,. However, the tool can also work with GPT-3 if the problem is broken down sufficiently.
Creating and Executing Tools with yAgents#
yAgents makes it easy to create and execute AI-powered tools. Here’s a brief overview of the process:
Create a tool: To create a tool, provide a natural language prompt to yAgents. The prompt should clearly describe the tool’s purpose and functionality. For example:
create a tool that returns the n-th prime number


create a tool that returns the n-th prime number
Load the tool into the toolkit: To load a tool into yAgents, simply provide a command to yAgents that says so. For example:
load the tool that you just created it into your toolkit
Execute the tool: To run a tool or agent, simply provide a command to yAgents that includes the name of the tool and any required parameters. For example:
generate the 50th prime number
You can see a video of how it works here.
As you become more familiar with yAgents, you can create more advanced tools and agents to automate your work and enhance your productivity.
For more information, see yAgents’ Github or our docs
previous
Writer
next
Zilliz
 Contents

What is Yeager.ai?
yAgents
How to use?
Creating and Executing Tools with yAgents
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Llama.cpp
 Contents
Installation and Setup
Wrappers
LLM
Embeddings
Llama.cpp#
This page covers how to use llama.cpp within LangChain.
It is broken into two parts: installation and setup, and then references to specific Llama-cpp wrappers.
Installation and Setup#
Install the Python package with pip install llama-cpp-python
Download one of the supported models and convert them to the llama.cpp format per the instructions
Wrappers#
LLM#
There exists a LlamaCpp LLM wrapper, which you can access with
from langchain.llms import LlamaCpp
For a more detailed walkthrough of this, see this notebook
Embeddings#
There exists a LlamaCpp Embeddings wrapper, which you can access with
from langchain.embeddings import LlamaCppEmbeddings
For a more detailed walkthrough of this, see this notebook
previous
Jina
next
Milvus
 Contents

Installation and Setup
Wrappers
LLM
Embeddings
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Pinecone
 Contents
Installation and Setup
Wrappers
VectorStore
Pinecone#
This page covers how to use the Pinecone ecosystem within LangChain.
It is broken into two parts: installation and setup, and then references to specific Pinecone wrappers.
Installation and Setup#
Install the Python SDK with pip install pinecone-client
Wrappers#
VectorStore#
There exists a wrapper around Pinecone indexes, allowing you to use it as a vectorstore,
whether for semantic search or example selection.
To import this vectorstore:
from langchain.vectorstores import Pinecone
For a more detailed walkthrough of the Pinecone wrapper, see this notebook
previous
PGVector
next
Prediction Guard
 Contents

Installation and Setup
Wrappers
VectorStore
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.md
.pdf
Runhouse
 Contents
Installation and Setup
Self-hosted LLMs
Self-hosted Embeddings
Runhouse#
This page covers how to use the Runhouse ecosystem within LangChain.
It is broken into three parts: installation and setup, LLMs, and Embeddings.
Installation and Setup#
Install the Python SDK with pip install runhouse
If you’d like to use on-demand cluster, check your cloud credentials with sky check
Self-hosted LLMs#
For a basic self-hosted LLM, you can use the SelfHostedHuggingFaceLLM class. For more
custom LLMs, you can use the SelfHostedPipeline parent class.
from langchain.llms import SelfHostedPipeline, SelfHostedHuggingFaceLLM
For a more detailed walkthrough of the Self-hosted LLMs, see this notebook
Self-hosted Embeddings#
There are several ways to use self-hosted embeddings with LangChain via Runhouse.
For a basic self-hosted embedding from a Hugging Face Transformers model, you can use
the SelfHostedEmbedding class.
from langchain.llms import SelfHostedPipeline, SelfHostedHuggingFaceLLM
For a more detailed walkthrough of the Self-hosted Embeddings, see this notebook
previous
Replicate
next
RWKV-4
 Contents

Installation and Setup
Self-hosted LLMs
Self-hosted Embeddings
By Harrison Chase

      © Copyright 2023, Harrison Chase.

  Last updated on Apr 26, 2023.


.ipynb
.pdf
Comet
 Contents
Install Comet and Dependencies
Initialize Comet and Set your Credentials
Set OpenAI and SerpAPI credentials
Scenario 1: Using just an LLM
Scenario 2: Using an LLM in a Chain
Scenario 3: Using An Agent with Tools
Scenario 4: Using Custom Evaluation Metrics
Comet#
In this guide we will demonstrate how to track your Langchain Experiments, Evaluation Metrics, and LLM Sessions with Comet.
Example Project: Comet with LangChain
Install Comet and Dependencies#
%pip install comet_ml langchain openai google-search-results spacy textstat pandas
import sys
!{sys.executable} -m spacy download en_core_web_sm
Initialize Comet and Set your Credentials#
You can grab your Comet API Key here or click the link after initializing Comet
import comet_ml
comet_ml.init(project_name="comet-example-langchain")
Set OpenAI and SerpAPI credentials#
You will need an OpenAI API Key and a SerpAPI API Key to run the following examples
import os
os.environ["OPENAI_API_KEY"] = "..."
#os.environ["OPENAI_ORGANIZATION"] = "..."
os.environ["SERPAPI_API_KEY"] = "..."
Scenario 1: Using just an LLM#
from datetime import datetime
from langchain.callbacks import CometCallbackHandler, StdOutCallbackHandler
from langchain.callbacks.base import CallbackManager
from langchain.llms import OpenAI
comet_callback = CometCallbackHandler(
    project_name="comet-example-langchain",
    complexity_metrics=True,
    stream_logs=True,
    tags=["llm"],
    visualizations=["dep"],
)
manager = CallbackManager([StdOutCallbackHandler(), comet_callback])
llm = OpenAI(temperature=0.9, callback_manager=manager, verbose=True)


llm = OpenAI(temperature=0.9, callback_manager=manager, verbose=True)
llm_result = llm.generate(["Tell me a joke", "Tell me a poem", "Tell me a fact"] * 3)
print("LLM result", llm_result)
comet_callback.flush_tracker(llm, finish=True)
Scenario 2: Using an LLM in a Chain#
from langchain.callbacks import CometCallbackHandler, StdOutCallbackHandler
from langchain.callbacks.base import CallbackManager
from langchain.chains import LLMChain
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate
comet_callback = CometCallbackHandler(
    complexity_metrics=True,
    project_name="comet-example-langchain",
    stream_logs=True,
    tags=["synopsis-chain"],
)
manager = CallbackManager([StdOutCallbackHandler(), comet_callback])
llm = OpenAI(temperature=0.9, callback_manager=manager, verbose=True)
template = """You are a playwright. Given the title of play, it is your job to write a synopsis for that title.
Title: {title}
Playwright: This is a synopsis for the above play:"""
prompt_template = PromptTemplate(input_variables=["title"], template=template)
synopsis_chain = LLMChain(llm=llm, prompt=prompt_template, callback_manager=manager)
test_prompts = [{"title": "Documentary about Bigfoot in Paris"}]
print(synopsis_chain.apply(test_prompts))
comet_callback.flush_tracker(synopsis_chain, finish=True)
Scenario 3: Using An Agent with Tools#
from langchain.agents import initialize_agent, load_tools
from langchain.callbacks import CometCallbackHandler, StdOutCallbackHandler
from langchain.callbacks.base import CallbackManager
from langchain.llms import OpenAI