LangChain - classes

文章目录


说明

LangChain 发展越来越大,但从范例难以窥全貌,这样学起来云里雾里。

这里整理了它的类,方便查看使用。

基于 0.1.13 版本


官方文档:https://python.langchain.com/docs/get_started/introduction

API 文档:https://api.python.langchain.com/en/latest/langchain_api_reference.html#


langchain

python 复制代码
help(langchain) 

PACKAGE CONTENTS

  • _api (package)
  • adapters (package) w
  • agents (package)
  • base_language
  • cache
  • callbacks (package)
  • chains (package)
  • chat_loaders (package)
  • chat_models (package)
  • docstore (package)
  • document_loaders (package)
  • document_transformers (package)
  • embeddings (package)
  • env
  • evaluation (package)
  • example_generator
  • formatting
  • globals (package)
  • graphs (package)
  • hub
  • indexes (package)
  • input
  • llms (package)
  • load (package)
  • memory (package)
  • model_laboratory
  • output_parsers (package)
  • prompts (package)
  • pydantic_v1 (package)
  • python
  • requests
  • retrievers (package)
  • runnables (package)
  • schema (package)
  • serpapi
  • smith (package)
  • sql_database
  • storage (package)
  • text_splitter
  • tools (package)
  • utilities (package)
  • utils (package)
  • vectorstores (package)

agents


PACKAGE CONTENTS

  • agent
  • agent_iterator
  • agent_toolkits (package)
  • agent_types
  • chat (package)
  • conversational (package)
  • conversational_chat (package)
  • format_scratchpad (package)
  • initialize
  • json_chat (package)
  • load_tools
  • loading
  • mrkl (package)
  • openai_assistant (package)
  • openai_functions_agent (package)
  • openai_functions_multi_agent (package)
  • openai_tools (package)
  • output_parsers (package)
  • react (package)
  • schema
  • self_ask_with_search (package)
  • structured_chat (package)
  • tools
  • types
  • utils
  • xml (package)

CLASSES

  • builtins.object
    • langchain.agents.agent_iterator.AgentExecutorIterator
  • builtins.str(builtins.object)
    • langchain.agents.agent_types.AgentType(builtins.str, enum.Enum)
  • enum.Enum(builtins.object)
    • langchain.agents.agent_types.AgentType(builtins.str, enum.Enum)
  • langchain.agents.react.base.ReActDocstoreAgent(langchain.agents.agent.Agent)
    • langchain.agents.react.base.ReActTextWorldAgent
  • langchain.chains.base.Chain(langchain_core.runnables.base.RunnableSerializable, abc.ABC)
    • langchain.agents.agent.AgentExecutor
      • langchain.agents.mrkl.base.MRKLChain
      • langchain.agents.react.base.ReActChain
      • langchain.agents.self_ask_with_search.base.SelfAskWithSearchChain
  • langchain_core.output_parsers.base.BaseOutputParser(langchain_core.output_parsers.base.BaseLLMOutputParser, langchain_core.runnables.base.RunnableSerializable)
    • langchain.agents.agent.AgentOutputParser
  • langchain_core.tools.BaseTool(langchain_core.runnables.base.RunnableSerializable)
    • langchain_core.tools.Tool
  • pydantic.v1.main.BaseModel(pydantic.v1.utils.Representation)
    • langchain.agents.agent.BaseMultiActionAgent
      • langchain.agents.openai_functions_multi_agent.base.OpenAIMultiFunctionsAgent
    • langchain.agents.agent.BaseSingleActionAgent
      • langchain.agents.agent.Agent
        • langchain.agents.conversational.base.ConversationalAgent
        • langchain.agents.conversational_chat.base.ConversationalChatAgent
        • langchain.agents.mrkl.base.ZeroShotAgent
        • langchain.agents.structured_chat.base.StructuredChatAgent
      • langchain.agents.agent.LLMSingleActionAgent
      • langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent
      • langchain.agents.xml.base.XMLAgent

cache

Help on module langchain.cache in langchain:


CLASSES

  • langchain_community.cache._RedisCacheBase(langchain_core.caches.BaseCache, abc.ABC)
    • langchain_community.cache.RedisCache
  • langchain_core.caches.BaseCache(abc.ABC)
    • langchain_community.cache.AstraDBCache
    • langchain_community.cache.AstraDBSemanticCache
    • langchain_community.cache.CassandraCache
    • langchain_community.cache.CassandraSemanticCache
    • langchain_community.cache.GPTCache
    • langchain_community.cache.InMemoryCache
    • langchain_community.cache.MomentoCache
    • langchain_community.cache.RedisSemanticCache
    • langchain_community.cache.SQLAlchemyCache
      • langchain_community.cache.SQLiteCache
    • langchain_community.cache.SQLAlchemyMd5Cache
    • langchain_community.cache.UpstashRedisCache
  • sqlalchemy.orm.decl_api.Base(builtins.object)
    • langchain_community.cache.FullLLMCache
    • langchain_community.cache.FullMd5LLMCache

callbacks

Help on package langchain.callbacks in langchain:


NAME

langchain.callbacks -Callback handlers allow listening to events in LangChain.


DESCRIPTION


Class hierarchy:

... code-block::

​ BaseCallbackHandler --> CallbackHandler # Example: AimCallbackHandler


PACKAGE CONTENTS

  • aim_callback
  • argilla_callback
  • arize_callback
  • arthur_callback
  • base
  • clearml_callback
  • comet_ml_callback
  • confident_callback
  • context_callback
  • file
  • flyte_callback
  • human
  • infino_callback
  • labelstudio_callback
  • llmonitor_callback
  • manager
  • mlflow_callback
  • openai_info
  • promptlayer_callback
  • sagemaker_callback
  • stdout
  • streaming_aiter
  • streaming_aiter_final_only
  • streaming_stdout
  • streaming_stdout_final_only
  • streamlit (package)
  • tracers (package)
  • trubrics_callback
  • utils
  • wandb_callback
  • whylabs_callback

CLASSES

  • langchain_core.callbacks.base.AsyncCallbackHandler(langchain_core.callbacks.base.BaseCallbackHandler)
    • langchain.callbacks.streaming_aiter.AsyncIteratorCallbackHandler
  • langchain_core.callbacks.base.BaseCallbackHandler(langchain_core.callbacks.base.LLMManagerMixin, langchain_core.callbacks.base.ChainManagerMixin, langchain_core.callbacks.base.ToolManagerMixin, langchain_core.callbacks.base.RetrieverManagerMixin, langchain_core.callbacks.base.CallbackManagerMixin, langchain_core.callbacks.base.RunManagerMixin)
    • langchain.callbacks.file.FileCallbackHandler
    • langchain_core.callbacks.stdout.StdOutCallbackHandler
    • langchain_core.callbacks.streaming_stdout.StreamingStdOutCallbackHandler
      • langchain.callbacks.streaming_stdout_final_only.FinalStreamingStdOutCallbackHandler
  • langchain_core.tracers.base.BaseTracer(langchain_core.callbacks.base.BaseCallbackHandler, abc.ABC)
    • langchain_core.tracers.langchain.LangChainTracer

memory


PACKAGE CONTENTS

  • buffer
  • buffer_window
  • chat_memory
  • chat_message_histories (package)
  • combined
  • entity
  • kg
  • motorhead_memory
  • prompt
  • readonly
  • simple
  • summary
  • summary_buffer
  • token_buffer
  • utils
  • vectorstore
  • zep_memory

CLASSES

  • langchain.memory.chat_memory.BaseChatMemory(langchain_core.memory.BaseMemory, abc.ABC)
    • langchain.memory.buffer.ConversationBufferMemory
      • langchain.memory.zep_memory.ZepMemory
    • langchain.memory.buffer_window.ConversationBufferWindowMemory
    • langchain.memory.entity.ConversationEntityMemory
    • langchain.memory.kg.ConversationKGMemory
    • langchain.memory.motorhead_memory.MotorheadMemory
    • langchain.memory.summary.ConversationSummaryMemory(langchain.memory.chat_memory.BaseChatMemory, langchain.memory.summary.SummarizerMixin)
    • langchain.memory.summary_buffer.ConversationSummaryBufferMemory(langchain.memory.chat_memory.BaseChatMemory, langchain.memory.summary.SummarizerMixin)
    • langchain.memory.token_buffer.ConversationTokenBufferMemory
  • langchain.memory.entity.BaseEntityStore (pydantic.v1.main.BaseModel, abc.ABC)
    • langchain.memory.entity.InMemoryEntityStore
    • langchain.memory.entity.RedisEntityStore
    • langchain.memory.entity.SQLiteEntityStore
    • langchain.memory.entity.UpstashRedisEntityStore
  • langchain.memory.summary.SummarizerMixin(pydantic.v1.main.BaseModel)
    • langchain.memory.summary.ConversationSummaryMemory(langchain.memory.chat_memory.BaseChatMemory, langchain.memory.summary.SummarizerMixin)
    • langchain.memory.summary_buffer.ConversationSummaryBufferMemory(langchain.memory.chat_memory.BaseChatMemory, langchain.memory.summary.SummarizerMixin)
  • langchain_core.chat_history.BaseChatMessageHistory (abc.ABC)
    • langchain_community.chat_message_histories.astradb.AstraDBChatMessageHistory
    • langchain_community.chat_message_histories.cassandra.CassandraChatMessageHistory
    • langchain_community.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory
    • langchain_community.chat_message_histories.dynamodb.DynamoDBChatMessageHistory
    • langchain_community.chat_message_histories.elasticsearch.ElasticsearchChatMessageHistory
    • langchain_community.chat_message_histories.file.FileChatMessageHistory
    • langchain_community.chat_message_histories.in_memory.ChatMessageHistory(langchain_core.chat_history.BaseChatMessageHistory, pydantic.v1.main.BaseModel)
    • langchain_community.chat_message_histories.momento.MomentoChatMessageHistory
    • langchain_community.chat_message_histories.mongodb.MongoDBChatMessageHistory
    • langchain_community.chat_message_histories.postgres.PostgresChatMessageHistory
    • langchain_community.chat_message_histories.redis.RedisChatMessageHistory
    • langchain_community.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory
    • langchain_community.chat_message_histories.sql.SQLChatMessageHistory
    • langchain_community.chat_message_histories.streamlit.StreamlitChatMessageHistory
    • langchain_community.chat_message_histories.upstash_redis.UpstashRedisChatMessageHistory
    • langchain_community.chat_message_histories.xata.XataChatMessageHistory
    • langchain_community.chat_message_histories.zep.ZepChatMessageHistory
  • langchain_core.memory.BaseMemory(langchain_core.load.serializable.Serializable, abc.ABC)
    • langchain.memory.buffer.ConversationStringBufferMemory
    • langchain.memory.combined.CombinedMemory
    • langchain.memory.readonly.ReadOnlySharedMemory
    • langchain.memory.simple.SimpleMemory
    • langchain.memory.vectorstore.VectorStoreRetrieverMemory
  • pydantic.v1.main.BaseModel(pydantic.v1.utils.Representation)
    • langchain_community.chat_message_histories.in_memory.ChatMessageHistory(langchain_core.chat_history.BaseChatMessageHistory, pydantic.v1.main.BaseModel)


PACKAGE CONTENTS

  • amadeus (package)
  • arxiv (package)
  • base
  • bearly (package)
  • bing_search (package)
  • brave_search (package)
  • clickup (package)
  • convert_to_openai
  • dataforseo_api_search (package)
  • ddg_search (package)
  • e2b_data_analysis (package)
  • edenai (package)
  • eleven_labs (package)
  • file_management (package)
  • github (package)
  • gitlab (package)
  • gmail (package)
  • golden_query (package)
  • google_cloud (package)
  • google_finance (package)
  • google_jobs (package)
  • google_lens (package)
  • google_places (package)
  • google_scholar (package)
  • google_search (package)
  • google_trends (package)
  • graphql (package)
  • human (package)
  • ifttt
  • interaction (package)
  • jira (package)
  • json (package)
  • memorize (package)
  • merriam_webster (package)
  • metaphor_search (package)
  • multion (package)
  • nasa (package)
  • nuclia (package)
  • office365 (package)
  • openapi (package)
  • openweathermap (package)
  • playwright (package)
  • plugin
  • powerbi (package)
  • pubmed (package)
  • python (package)
  • reddit_search (package)
  • render
  • requests (package)
  • retriever
  • scenexplain (package)
  • searchapi (package)
  • searx_search (package)
  • shell (package)
  • slack (package)
  • sleep (package)
  • spark_sql (package)
  • sql_database (package)
  • stackexchange (package)
  • steam (package)
  • steamship_image_generation (package)
  • tavily_search (package)
  • vectorstore (package)
  • wikipedia (package)
  • wolfram_alpha (package)
  • yahoo_finance_news
  • youtube (package)
  • zapier (package)

CLASSES

  • langchain_core.runnables.base.RunnableSerializable(langchain_core.load.serializable.Serializable, langchain_core.runnables.base.Runnable)
    • langchain_core.tools.BaseTool
      • langchain_core.tools.StructuredTool
      • langchain_core.tools.Tool

chat_loaders

Load chat messages from various communications platforms such as Facebook Messenger, Telegram, and WhatsApp. The loaded chat messages can be used for fine-tuning models.


Class hierarchy:

... code-block::

​ BaseChatLoader --> ChatLoader # Examples: WhatsAppChatLoader, IMessageChatLoader


Main helpers:

... code-block::

​ ChatSession


PACKAGE CONTENTS

  • base
  • facebook_messenger
  • gmail
  • imessage
  • langsmith
  • slack
  • telegram
  • utils
  • whatsapp

chat_models


NAME

langchain.chat_models -Chat Models are a variation on language models.


DESCRIPTION

While Chat Models use language models under the hood, the interface they expose is a bit different. Rather than expose a "text in, text out" API, they expose an interface where "chat messages" are the inputs and outputs.


Class hierarchy:

... code-block::

​ BaseLanguageModel --> BaseChatModel --> # Examples: ChatOpenAI, ChatGooglePalm


Main helpers:

... code-block::

​ AIMessage, BaseMessage, HumanMessage


PACKAGE CONTENTS

  • anthropic
  • anyscale
  • azure_openai
  • azureml_endpoint
  • baichuan
  • baidu_qianfan_endpoint
  • base
  • bedrock
  • cohere
  • databricks
  • ernie
  • everlyai
  • fake
  • fireworks
  • gigachat
  • google_palm
  • human
  • hunyuan
  • javelin_ai_gateway
  • jinachat
  • konko
  • litellm
  • meta
  • minimax
  • mlflow
  • mlflow_ai_gateway
  • ollama
  • openai
  • pai_eas_endpoint
  • promptlayer_openai
  • tongyi
  • vertexai
  • volcengine_maas
  • yandex

docstore

Help on package langchain.docstore in langchain:


NAME

langchain.docstore -Docstores are classes to store and load Documents.


DESCRIPTION

The Docstore is a simplified version of the Document Loader.


Class hierarchy:

... code-block::

​ Docstore --> # Examples: InMemoryDocstore, Wikipedia


Main helpers:

... code-block::

​ Document, AddableMixin


PACKAGE CONTENTS

  • arbitrary_fn
  • base
  • document
  • in_memory
  • wikipedia

document_loaders

shell 复制代码
help(langchain_community.document_loaders) 

PACKAGE CONTENTS

  • acreom
  • airbyte
  • airbyte_json
  • airtable
  • apify_dataset
  • arcgis_loader
  • arxiv
  • assemblyai
  • astradb
  • async_html
  • athena
  • azlyrics
  • azure_ai_data
  • azure_blob_storage_container
  • azure_blob_storage_file
  • baiducloud_bos_directory
  • baiducloud_bos_file
  • base
  • base_o365
  • bibtex
  • bigquery
  • bilibili
  • blackboard
  • blob_loaders (package)
  • blockchain
  • brave_search
  • browserless
  • cassandra
  • chatgpt
  • chm
  • chromium
  • college_confidential
  • concurrent
  • confluence
  • conllu
  • couchbase
  • csv_loader
  • cube_semantic
  • datadog_logs
  • dataframe
  • diffbot
  • directory
  • discord
  • doc_intelligence
  • docugami
  • docusaurus
  • dropbox
  • duckdb_loader
  • email
  • epub
  • etherscan
  • evernote
  • excel
  • facebook_chat
  • fauna
  • figma
  • gcs_directory
  • gcs_file
  • generic
  • geodataframe
  • git
  • gitbook
  • github
  • google_speech_to_text
  • googledrive
  • gutenberg
  • helpers
  • hn
  • html
  • html_bs
  • hugging_face_dataset
  • hugging_face_model
  • ifixit
  • image
  • image_captions
  • imsdb
  • iugu
  • joplin
  • json_loader
  • lakefs
  • larksuite
  • markdown
  • mastodon
  • max_compute
  • mediawikidump
  • merge
  • mhtml
  • modern_treasury
  • mongodb
  • news
  • notebook
  • notion
  • notiondb
  • nuclia
  • obs_directory
  • obs_file
  • obsidian
  • odt
  • onedrive
  • onedrive_file
  • onenote
  • open_city_data
  • org_mode
  • parsers (package)
  • pdf
  • pebblo
  • polars_dataframe
  • powerpoint
  • psychic
  • pubmed
  • pyspark_dataframe
  • python
  • quip
  • readthedocs
  • recursive_url_loader
  • reddit
  • roam
  • rocksetdb
  • rspace
  • rss
  • rst
  • rtf
  • s3_directory
  • s3_file
  • sharepoint
  • sitemap
  • slack_directory
  • snowflake_loader
  • spreedly
  • sql_database
  • srt
  • stripe
  • surrealdb
  • telegram
  • tencent_cos_directory
  • tencent_cos_file
  • tensorflow_datasets
  • text
  • tidb
  • tomarkdown
  • toml
  • trello
  • tsv
  • twitter
  • unstructured
  • url
  • url_playwright
  • url_selenium
  • vsdx
  • weather
  • web_base
  • whatsapp_chat
  • wikipedia
  • word_document
  • xml
  • xorbits
  • youtube
  • yuque

document_transformers


PACKAGE CONTENTS

  • beautiful_soup_transformer
  • doctran_text_extract
  • doctran_text_qa
  • doctran_text_translate
  • embeddings_redundant_filter
  • google_translate
  • html2text
  • long_context_reorder
  • nuclia_text_transform
  • openai_functions

embeddings


PACKAGE CONTENTS

  • aleph_alpha
  • awa
  • azure_openai
  • baidu_qianfan_endpoint
  • base
  • bedrock
  • bookend
  • cache
  • clarifai
  • cloudflare_workersai
  • cohere
  • dashscope
  • databricks
  • deepinfra
  • edenai
  • elasticsearch
  • embaas
  • ernie
  • fake
  • fastembed
  • google_palm
  • gpt4all
  • gradient_ai
  • huggingface
  • huggingface_hub
  • infinity
  • javelin_ai_gateway
  • jina
  • johnsnowlabs
  • llamacpp
  • llm_rails
  • localai
  • minimax
  • mlflow
  • mlflow_gateway
  • modelscope_hub
  • mosaicml
  • nlpcloud
  • octoai_embeddings
  • ollama
  • openai
  • sagemaker_endpoint
  • self_hosted
  • self_hosted_hugging_face
  • sentence_transformer
  • spacy_embeddings
  • tensorflow_hub
  • vertexai
  • voyageai
  • xinference

CLASSES

  • langchain_core.embeddings.Embeddings(abc.ABC)
    • langchain.embeddings.cache.CacheBackedEmbeddings

evaluation


NAME

langchain.evaluation -Evaluation chains for grading LLM and Chain outputs.


DESCRIPTION

This module contains off-the-shelf evaluation chains for grading the output of LangChain primitives such as language models and chains.

Loading an evaluator to load an evaluator, you can use the :func:load_evaluators <langchain.evaluation.loading.load_evaluators> or

:func:load_evaluator <langchain.evaluation.loading.load_evaluator> functions with the

names of the evaluators to load.

... code-block:: python

​ from langchain.evaluation import load_evaluator

​ evaluator = load_evaluator("qa")

​ evaluator.evaluate_strings(

​ prediction="We sold more than 40,000 units last week",

​ input="How many units did we sell last week?",

​ reference="We sold 32,378 units",

​ )

The evaluator must be one of :class:EvaluatorType <langchain.evaluation.schema.EvaluatorType>.

Datasets to load one of the LangChain HuggingFace datasets, you can use the :func:load_dataset <langchain.evaluation.loading.load_dataset> function with the name of the dataset to load.

... code-block:: python

​ from langchain.evaluation import load_dataset

​ ds = load_dataset("llm-math")

Some common use cases for evaluation include:

  • Grading the accuracy of a response against ground truth answers: :class:QAEvalChain <langchain.evaluation.qa.eval_chain.QAEvalChain>
  • Comparing the output of two models: :class:PairwiseStringEvalChain <langchain.evaluation.comparison.eval_chain.PairwiseStringEvalChain> or :class:LabeledPairwiseStringEvalChain <langchain.evaluation.comparison.eval_chain.LabeledPairwiseStringEvalChain> when there is additionally a reference label.
  • Judging the efficacy of an agent's tool usage: :class:TrajectoryEvalChain <langchain.evaluation.agents.trajectory_eval_chain.TrajectoryEvalChain>
  • Checking whether an output complies with a set of criteria: :class:CriteriaEvalChain <langchain.evaluation.criteria.eval_chain.CriteriaEvalChain> or :class:LabeledCriteriaEvalChain <langchain.evaluation.criteria.eval_chain.LabeledCriteriaEvalChain> when there is additionally a reference label.
  • Computing semantic difference between a prediction and reference: :class:EmbeddingDistanceEvalChain <langchain.evaluation.embedding_distance.base.EmbeddingDistanceEvalChain> or between two predictions: :class:PairwiseEmbeddingDistanceEvalChain <langchain.evaluation.embedding_distance.base.PairwiseEmbeddingDistanceEvalChain>
  • Measuring the string distance between a prediction and reference :class:StringDistanceEvalChain <langchain.evaluation.string_distance.base.StringDistanceEvalChain> or between two predictions :class:PairwiseStringDistanceEvalChain <langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain>

Low-level API

These evaluators implement one of the following interfaces:

  • :class:StringEvaluator <langchain.evaluation.schema.StringEvaluator>: Evaluate a prediction string against a reference label and/or input context.
  • :class:PairwiseStringEvaluator <langchain.evaluation.schema.PairwiseStringEvaluator>: Evaluate two prediction strings against each other. Useful for scoring preferences, measuring similarity between two chain or llm agents, or comparing outputs on similar inputs.
  • :class:AgentTrajectoryEvaluator <langchain.evaluation.schema.AgentTrajectoryEvaluator> Evaluate the full sequence of actions taken by an agent.

These interfaces enable easier composability and usage within a higher level evaluation framework.


PACKAGE CONTENTS

  • agents (package)
  • comparison (package)
  • criteria (package)
  • embedding_distance (package)
  • exact_match (package)
  • loading
  • parsing (package)
  • qa (package)
  • regex_match (package)
  • schema
  • scoring (package)
  • string_distance (package)

CLASSES

  • abc.ABC(builtins.object)
    • langchain.evaluation.schema.AgentTrajectoryEvaluator(langchain.evaluation.schema._EvalArgsMixin, abc.ABC)
      • langchain.evaluation.agents.trajectory_eval_chain.TrajectoryEvalChain(langchain.evaluation.schema.AgentTrajectoryEvaluator, langchain.evaluation.schema.LLMEvalChain)
    • langchain.evaluation.schema.PairwiseStringEvaluator(langchain.evaluation.schema._EvalArgsMixin, abc.ABC)
      • langchain.evaluation.comparison.eval_chain.PairwiseStringEvalChain(langchain.evaluation.schema.PairwiseStringEvaluator, langchain.evaluation.schema.LLMEvalChain, langchain.chains.llm.LLMChain)
        • langchain.evaluation.comparison.eval_chain.LabeledPairwiseStringEvalChain
      • langchain.evaluation.embedding_distance.base.PairwiseEmbeddingDistanceEvalChain(langchain.evaluation.embedding_distance.base._EmbeddingDistanceChainMixin, langchain.evaluation.schema.PairwiseStringEvaluator)
      • langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain(langchain.evaluation.schema.PairwiseStringEvaluator, langchain.evaluation.string_distance.base._RapidFuzzChainMixin)
    • langchain.evaluation.schema.StringEvaluator(langchain.evaluation.schema._EvalArgsMixin, abc.ABC)
      • langchain.evaluation.criteria.eval_chain.CriteriaEvalChain(langchain.evaluation.schema.StringEvaluator, langchain.evaluation.schema.LLMEvalChain, langchain.chains.llm.LLMChain)
        • langchain.evaluation.criteria.eval_chain.LabeledCriteriaEvalChain
      • langchain.evaluation.embedding_distance.base.EmbeddingDistanceEvalChain(langchain.evaluation.embedding_distance.base._EmbeddingDistanceChainMixin, langchain.evaluation.schema.StringEvaluator)
      • langchain.evaluation.exact_match.base.ExactMatchStringEvaluator
      • langchain.evaluation.parsing.base.JsonEqualityEvaluator
      • langchain.evaluation.parsing.base.JsonValidityEvaluator
      • langchain.evaluation.parsing.json_distance.JsonEditDistanceEvaluator
      • langchain.evaluation.parsing.json_schema.JsonSchemaEvaluator
      • langchain.evaluation.qa.eval_chain.ContextQAEvalChain(langchain.chains.llm.LLMChain, langchain.evaluation.schema.StringEvaluator, langchain.evaluation.schema.LLMEvalChain)
        • langchain.evaluation.qa.eval_chain.CotQAEvalChain
      • langchain.evaluation.qa.eval_chain.QAEvalChain(langchain.chains.llm.LLMChain, langchain.evaluation.schema.StringEvaluator, langchain.evaluation.schema.LLMEvalChain)
      • langchain.evaluation.regex_match.base.RegexMatchStringEvaluator
      • langchain.evaluation.scoring.eval_chain.ScoreStringEvalChain(langchain.evaluation.schema.StringEvaluator, langchain.evaluation.schema.LLMEvalChain, langchain.chains.llm.LLMChain)
        • langchain.evaluation.scoring.eval_chain.LabeledScoreStringEvalChain
      • langchain.evaluation.string_distance.base.StringDistanceEvalChain(langchain.evaluation.schema.StringEvaluator, langchain.evaluation.string_distance.base._RapidFuzzChainMixin)
  • builtins.str(builtins.object)
    • langchain.evaluation.criteria.eval_chain.Criteria(builtins.str, enum.Enum)
    • langchain.evaluation.embedding_distance.base.EmbeddingDistance(builtins.str, enum.Enum)
    • langchain.evaluation.schema.EvaluatorType(builtins.str, enum.Enum)
    • langchain.evaluation.string_distance.base.StringDistance(builtins.str, enum.Enum)
  • enum.Enum(builtins.object)
    • langchain.evaluation.criteria.eval_chain.Criteria(builtins.str, enum.Enum)
    • langchain.evaluation.embedding_distance.base.EmbeddingDistance(builtins.str, enum.Enum)
    • langchain.evaluation.schema.EvaluatorType(builtins.str, enum.Enum)
    • langchain.evaluation.string_distance.base.StringDistance(builtins.str, enum.Enum)
  • langchain.chains.llm.LLMChain(langchain.chains.base.Chain)
    • langchain.evaluation.qa.eval_chain.ContextQAEvalChain(langchain.chains.llm.LLMChain, langchain.evaluation.schema.StringEvaluator, langchain.evaluation.schema.LLMEvalChain)
      • langchain.evaluation.qa.eval_chain.CotQAEvalChain
    • langchain.evaluation.qa.eval_chain.QAEvalChain(langchain.chains.llm.LLMChain, langchain.evaluation.schema.StringEvaluator, langchain.evaluation.schema.LLMEvalChain)
  • langchain.evaluation.embedding_distance.base._EmbeddingDistanceChainMixin(langchain.chains.base.Chain)
    • langchain.evaluation.embedding_distance.base.EmbeddingDistanceEvalChain(langchain.evaluation.embedding_distance.base._EmbeddingDistanceChainMixin, langchain.evaluation.schema.StringEvaluator)
    • langchain.evaluation.embedding_distance.base.PairwiseEmbeddingDistanceEvalChain(langchain.evaluation.embedding_distance.base._EmbeddingDistanceChainMixin, langchain.evaluation.schema.PairwiseStringEvaluator)
  • langchain.evaluation.schema._EvalArgsMixin(builtins.object)
    • langchain.evaluation.schema.AgentTrajectoryEvaluator(langchain.evaluation.schema._EvalArgsMixin, abc.ABC)
      • langchain.evaluation.agents.trajectory_eval_chain.TrajectoryEvalChain(langchain.evaluation.schema.AgentTrajectoryEvaluator, langchain.evaluation.schema.LLMEvalChain)
    • langchain.evaluation.schema.PairwiseStringEvaluator(langchain.evaluation.schema._EvalArgsMixin, abc.ABC)
      • langchain.evaluation.comparison.eval_chain.PairwiseStringEvalChain(langchain.evaluation.schema.PairwiseStringEvaluator, langchain.evaluation.schema.LLMEvalChain, langchain.chains.llm.LLMChain)
        • langchain.evaluation.comparison.eval_chain.LabeledPairwiseStringEvalChain
      • langchain.evaluation.embedding_distance.base.PairwiseEmbeddingDistanceEvalChain(langchain.evaluation.embedding_distance.base._EmbeddingDistanceChainMixin, langchain.evaluation.schema.PairwiseStringEvaluator)
      • langchain.evaluation.string_distance.base.PairwiseStringDistanceEvalChain(langchain.evaluation.schema.PairwiseStringEvaluator, langchain.evaluation.string_distance.base._RapidFuzzChainMixin)
    • langchain.evaluation.schema.StringEvaluator(langchain.evaluation.schema._EvalArgsMixin, abc.ABC)
      • langchain.evaluation.criteria.eval_chain.CriteriaEvalChain(langchain.evaluation.schema.StringEvaluator, langchain.evaluation.schema.LLMEvalChain, langchain.chains.llm.LLMChain)
        • langchain.evaluation.criteria.eval_chain.LabeledCriteriaEvalChain
      • langchain.evaluation.embedding_distance.base.EmbeddingDistanceEvalChain(langchain.evaluation.embedding_distance.base._EmbeddingDistanceChainMixin, langchain.evaluation.schema.StringEvaluator)
      • langchain.evaluation.exact_match.base.ExactMatchStringEvaluator
      • langchain.evaluation.parsing.base.JsonEqualityEvaluator
      • langchain.evaluation.parsing.base.JsonValidityEvaluator
      • langchain.evaluation.parsing.json_distance.JsonEditDistanceEvaluator
      • langchain.evaluation.parsing.json_schema.JsonSchemaEvaluator
      • langchain.evaluation.qa.eval_chain.ContextQAEvalChain(langchain.chains.llm.LLMChain, langchain.evaluation.schema.StringEvaluator, langchain.evaluation.schema.LLMEvalChain)
        • langchain.evaluation.qa.eval_chain.CotQAEvalChain
      • langchain.evaluation.qa.eval_chain.QAEvalChain(langchain.chains.llm.LLMChain, langchain.evaluation.schema.StringEvaluator, langchain.evaluation.schema.LLMEvalChain)
      • langchain.evaluation.regex_match.base.RegexMatchStringEvaluator
      • langchain.evaluation.scoring.eval_chain.ScoreStringEvalChain(langchain.evaluation.schema.StringEvaluator, langchain.evaluation.schema.LLMEvalChain, langchain.chains.llm.LLMChain)
        • langchain.evaluation.scoring.eval_chain.LabeledScoreStringEvalChain
      • langchain.evaluation.string_distance.base.StringDistanceEvalChain(langchain.evaluation.schema.StringEvaluator, langchain.evaluation.string_distance.base._RapidFuzzChainMixin)

graphs

Help on package langchain.graphs in langchain:


NAME

langchain.graphs -Graphs provide a natural language interface to graph databases.


PACKAGE CONTENTS

  • arangodb_graph
  • falkordb_graph
  • graph_document
  • graph_store
  • hugegraph
  • kuzu_graph
  • memgraph_graph
  • nebula_graph
  • neo4j_graph
  • neptune_graph
  • networkx_graph
  • rdf_graph

indexes

Help on package langchain.indexes in langchain:


NAME

langchain.indexes


DESCRIPTION

Index is used to avoid writing duplicated content into the vectostore and to avoid over-writing content if it's unchanged.

Indexes also :

  • Create knowledge graphs from data.

  • Support indexing workflows from LangChain data loaders to vectorstores.

    Importantly, Index keeps on working even if the content being written is derived via a set of transformations from some source content (e.g., indexing children

    documents that were derived from parent documents by chunking.)


PACKAGE CONTENTS

  • _api
  • _sql_record_manager
  • base
  • graph
  • prompts (package)
  • vectorstore

CLASSES

  • builtins.dict(builtins.object)
    • langchain.indexes._api.IndexingResult
  • langchain.indexes.base.RecordManager(abc.ABC)
    • langchain.indexes._sql_record_manager.SQLRecordManager
  • pydantic.v1.main.BaseModel(pydantic.v1.utils.Representation)
    • langchain.indexes.graph.GraphIndexCreator
    • langchain.indexes.vectorstore.VectorstoreIndexCreator

llms

Help on package langchain.llms in langchain:


NAME

langchain.llms


DESCRIPTION

LLM classes provide access to the large language model (LLM) APIs and services.


Class hierarchy:

... code-block::

​ BaseLanguageModel --> BaseLLM --> LLM --> # Examples: AI21, HuggingFaceHub, OpenAI


Main helpers:

... code-block::

​ LLMResult, PromptValue,

​ CallbackManagerForLLMRun, AsyncCallbackManagerForLLMRun,

​ CallbackManager, AsyncCallbackManager,

​ AIMessage, BaseMessage


PACKAGE CONTENTS

  • ai21
  • aleph_alpha
  • amazon_api_gateway
  • anthropic
  • anyscale
  • arcee
  • aviary
  • azureml_endpoint
  • baidu_qianfan_endpoint
  • bananadev
  • base
  • baseten
  • beam
  • bedrock
  • bittensor
  • cerebriumai
  • chatglm
  • clarifai
  • cloudflare_workersai
  • cohere
  • ctransformers
  • ctranslate2
  • databricks
  • deepinfra
  • deepsparse
  • edenai
  • fake
  • fireworks
  • forefrontai
  • gigachat
  • google_palm
  • gooseai
  • gpt4all
  • gradient_ai
  • huggingface_endpoint
  • huggingface_hub
  • huggingface_pipeline
  • huggingface_text_gen_inference
  • human
  • javelin_ai_gateway
  • koboldai
  • llamacpp
  • loading
  • manifest
  • minimax
  • mlflow
  • mlflow_ai_gateway
  • modal
  • mosaicml
  • nlpcloud
  • octoai_endpoint
  • ollama
  • opaqueprompts
  • openai
  • openllm
  • openlm
  • pai_eas_endpoint
  • petals
  • pipelineai
  • predibase
  • predictionguard
  • promptlayer_openai
  • replicate
  • rwkv
  • sagemaker_endpoint
  • self_hosted
  • self_hosted_hugging_face
  • stochasticai
  • symblai_nebula
  • textgen
  • titan_takeoff
  • titan_takeoff_pro
  • together
  • tongyi
  • utils
  • vertexai
  • vllm
  • volcengine_maas
  • watsonxllm
  • writer
  • xinference
  • yandex

load

Help on package langchain.load in langchain:


NAME

langchain.load - Serialization and deserialization.


PACKAGE CONTENTS

  • dump
  • load
  • serializable

memory

Help on package langchain.memory in langchain:

NAME

langchain.memory -Memory maintains Chain state, incorporating context from

past runs.

DESCRIPTION
Class hierarchy for Memory:

.. code-block::

    BaseMemory --> BaseChatMemory --> <name>Memory  # Examples: ZepMemory, MotorheadMemory

Main helpers:

​ ... code-block::

​ BaseChatMessageHistory

Chat Message History stores the chat message history in different stores.

Class hierarchy for ChatMessageHistory:

... code-block::

BaseChatMessageHistory --> ChatMessageHistory # Example: ZepChatMessageHistory


Main helpers:

​ ... code-block::

​ AIMessage, BaseMessage, HumanMessage


PACKAGE CONTENTS

  • buffer
  • buffer_window
  • chat_memory
  • chat_message_histories (package)
  • combined
  • entity
  • kg
  • motorhead_memory
  • prompt
  • readonly
  • simple
  • summary
  • summary_buffer
  • token_buffer
  • utils
  • vectorstore
  • zep_memory

CLASSES

  • langchain.memory.chat_memory.BaseChatMemory(langchain_core.memory.BaseMemory, abc.ABC)
    • langchain.memory.buffer.ConversationBufferMemory
      • langchain.memory.zep_memory.ZepMemory
    • langchain.memory.buffer_window.ConversationBufferWindowMemory
    • langchain.memory.entity.ConversationEntityMemory
    • langchain.memory.kg.ConversationKGMemory
    • langchain.memory.motorhead_memory.MotorheadMemory
    • langchain.memory.summary.ConversationSummaryMemory(langchain.memory.chat_memory.BaseChatMemory, langchain.memory.summary.SummarizerMixin)
    • langchain.memory.summary_buffer.ConversationSummaryBufferMemory(langchain.memory.chat_memory.BaseChatMemory, langchain.memory.summary.SummarizerMixin)
    • langchain.memory.token_buffer.ConversationTokenBufferMemory
  • langchain.memory.entity.BaseEntityStore(pydantic.v1.main.BaseModel, abc.ABC)
    • langchain.memory.entity.InMemoryEntityStore
    • langchain.memory.entity.RedisEntityStore
    • langchain.memory.entity.SQLiteEntityStore
    • langchain.memory.entity.UpstashRedisEntityStore
  • langchain.memory.summary.SummarizerMixin(pydantic.v1.main.BaseModel)
    • langchain.memory.summary.ConversationSummaryMemory(langchain.memory.chat_memory.BaseChatMemory, langchain.memory.summary.SummarizerMixin)
    • langchain.memory.summary_buffer.ConversationSummaryBufferMemory(langchain.memory.chat_memory.BaseChatMemory, langchain.memory.summary.SummarizerMixin)
  • langchain_core.chat_history.BaseChatMessageHistory(abc.ABC)
    • langchain_community.chat_message_histories.astradb.AstraDBChatMessageHistory
    • langchain_community.chat_message_histories.cassandra.CassandraChatMessageHistory
    • langchain_community.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory
    • langchain_community.chat_message_histories.dynamodb.DynamoDBChatMessageHistory
    • langchain_community.chat_message_histories.elasticsearch.ElasticsearchChatMessageHistory
    • langchain_community.chat_message_histories.file.FileChatMessageHistory
    • langchain_community.chat_message_histories.in_memory.ChatMessageHistory(langchain_core.chat_history.BaseChatMessageHistory, pydantic.v1.main.BaseModel)
    • langchain_community.chat_message_histories.momento.MomentoChatMessageHistory
    • langchain_community.chat_message_histories.mongodb.MongoDBChatMessageHistory
    • langchain_community.chat_message_histories.postgres.PostgresChatMessageHistory
    • langchain_community.chat_message_histories.redis.RedisChatMessageHistory
    • langchain_community.chat_message_histories.singlestoredb.SingleStoreDBChatMessageHistory
    • langchain_community.chat_message_histories.sql.SQLChatMessageHistory
    • langchain_community.chat_message_histories.streamlit.StreamlitChatMessageHistory
    • langchain_community.chat_message_histories.upstash_redis.UpstashRedisChatMessageHistory
    • langchain_community.chat_message_histories.xata.XataChatMessageHistory
    • langchain_community.chat_message_histories.zep.ZepChatMessageHistory
  • langchain_core.memory.BaseMemory(langchain_core.load.serializable.Serializable, abc.ABC)
    • langchain.memory.buffer.ConversationStringBufferMemory
    • langchain.memory.combined.CombinedMemory
    • langchain.memory.readonly.ReadOnlySharedMemory
    • langchain.memory.simple.SimpleMemory
    • langchain.memory.vectorstore.VectorStoreRetrieverMemory
  • pydantic.v1.main.BaseModel(pydantic.v1.utils.Representation)
    • langchain_community.chat_message_histories.in_memory.ChatMessageHistory(langchain_core.chat_history.BaseChatMessageHistory, pydantic.v1.main.BaseModel)

output_parsers

Help on package langchain.output_parsers in langchain:


NAME

langchain.output_parsers -OutputParser classes parse the output of an LLM call.


DESCRIPTION

Class hierarchy:

... code-block::

​ BaseLLMOutputParser --> BaseOutputParser --> OutputParser # ListOutputParser, PydanticOutputParser

Main helpers:

... code-block::

​ Serializable, Generation, PromptValue


PACKAGE CONTENTS

  • boolean
  • combining
  • datetime
  • enum
  • ernie_functions
  • fix
  • format_instructions
  • json
  • list
  • loading
  • openai_functions
  • openai_tools
  • pandas_dataframe
  • prompts
  • pydantic
  • rail_parser
  • regex
  • regex_dict
  • retry
  • structured
  • xml
  • yaml

CLASSES

  • langchain_core.output_parsers.base.BaseOutputParser(langchain_core.output_parsers.base.BaseLLMOutputParser, langchain_core.runnables.base.RunnableSerializable)
    • langchain.output_parsers.boolean.BooleanOutputParser
    • langchain.output_parsers.combining.CombiningOutputParser
    • langchain.output_parsers.datetime.DatetimeOutputParser
    • langchain.output_parsers.enum.EnumOutputParser
    • langchain.output_parsers.fix.OutputFixingParser
    • langchain.output_parsers.pandas_dataframe.PandasDataFrameOutputParser
    • langchain.output_parsers.regex.RegexParser
    • langchain.output_parsers.regex_dict.RegexDictParser
    • langchain.output_parsers.retry.RetryOutputParser
    • langchain.output_parsers.retry.RetryWithErrorOutputParser
    • langchain.output_parsers.structured.StructuredOutputParser
    • langchain.output_parsers.yaml.YamlOutputParser
    • langchain_community.output_parsers.rail_parser.GuardrailsOutputParser
  • langchain_core.output_parsers.json.JsonOutputParser(langchain_core.output_parsers.transform.BaseCumulativeTransformOutputParser)
    • langchain_core.output_parsers.pydantic.PydanticOutputParser(langchain_core.output_parsers.json.JsonOutputParser, typing.Generic)
  • langchain_core.output_parsers.transform.BaseCumulativeTransformOutputParser(langchain_core.output_parsers.transform.BaseTransformOutputParser)
    • langchain_core.output_parsers.openai_tools.JsonOutputToolsParser
      • langchain_core.output_parsers.openai_tools.JsonOutputKeyToolsParser
      • langchain_core.output_parsers.openai_tools.PydanticToolsParser
  • langchain_core.output_parsers.transform.BaseTransformOutputParser(langchain_core.output_parsers.base.BaseOutputParser)
    • langchain_core.output_parsers.list.ListOutputParser
      • langchain_core.output_parsers.list.CommaSeparatedListOutputParser
      • langchain_core.output_parsers.list.MarkdownListOutputParser
      • langchain_core.output_parsers.list.NumberedListOutputParser
    • langchain_core.output_parsers.xml.XMLOutputParser
  • pydantic.v1.main.BaseModel(pydantic.v1.utils.Representation)
    • langchain.output_parsers.structured.ResponseSchema
  • typing.Generic(builtins.object)
    • langchain_core.output_parsers.pydantic.PydanticOutputParser(langchain_core.output_parsers.json.JsonOutputParser, typing.Generic)

prompts

Help on package langchain.prompts in langchain:


NAME

langchain.prompts -Prompt is the input to the model.


DESCRIPTION

Prompt is often constructed from multiple components. Prompt classes and functions make constructing and working with prompts easy.


Class hierarchy:

  • BasePromptTemplate
    • PipelinePromptTemplate
    • StringPromptTemplate
      • PromptTemplate
      • FewShotPromptTemplate
      • FewShotPromptWithTemplates
    • BaseChatPromptTemplate
      • AutoGPTPrompt
      • ChatPromptTemplate
        • AgentScratchPadChatPromptTemplate
  • BaseMessagePromptTemplate
    • MessagesPlaceholder
    • BaseStringMessagePromptTemplate
      • ChatMessagePromptTemplate
      • HumanMessagePromptTemplate
      • AIMessagePromptTemplate
      • SystemMessagePromptTemplate
  • PromptValue
    • StringPromptValue
    • ChatPromptValue

PACKAGE CONTENTS

  • base
  • chat
  • example_selector (package)
  • few_shot
  • few_shot_with_templates
  • loading
  • pipeline
  • prompt

CLASSES

  • abc.ABC(builtins.object)
    • langchain_core.prompts.base.BasePromptTemplate(langchain_core.runnables.base.RunnableSerializable, typing.Generic, abc.ABC)
      • langchain_core.prompts.chat.BaseChatPromptTemplate(langchain_core.prompts.base.BasePromptTemplate, abc.ABC)
        • langchain_core.prompts.chat.ChatPromptTemplate
        • langchain_core.prompts.few_shot.FewShotChatMessagePromptTemplate(langchain_core.prompts.chat.BaseChatPromptTemplate, langchain_core.prompts.few_shot._FewShotPromptTemplateMixin)
      • langchain_core.prompts.pipeline.PipelinePromptTemplate
      • langchain_core.prompts.string.StringPromptTemplate(langchain_core.prompts.base.BasePromptTemplate, abc.ABC)
        • langchain_core.prompts.few_shot.FewShotPromptTemplate(langchain_core.prompts.few_shot._FewShotPromptTemplateMixin, langchain_core.prompts.string.StringPromptTemplate)
        • langchain_core.prompts.few_shot_with_templates.FewShotPromptWithTemplates
        • langchain_core.prompts.prompt.PromptTemplate
  • langchain_core.example_selectors.base.BaseExampleSelector(abc.ABC)
    • langchain_community.example_selectors.ngram_overlap.NGramOverlapExampleSelector(langchain_core.example_selectors.base.BaseExampleSelector, pydantic.v1.main.BaseModel)
    • langchain_core.example_selectors.length_based.LengthBasedExampleSelector(langchain_core.example_selectors.base.BaseExampleSelector, pydantic.v1.main.BaseModel)
    • langchain_core.example_selectors.semantic_similarity.SemanticSimilarityExampleSelector(langchain_core.example_selectors.base.BaseExampleSelector, pydantic.v1.main.BaseModel)
      • langchain_core.example_selectors.semantic_similarity.MaxMarginalRelevanceExampleSelector
  • langchain_core.prompts.chat.BaseMessagePromptTemplate(langchain_core.load.serializable.Serializable, abc.ABC)
    • langchain_core.prompts.chat.MessagesPlaceholder
  • langchain_core.prompts.chat.BaseStringMessagePromptTemplate(langchain_core.prompts.chat.BaseMessagePromptTemplate, abc.ABC)
    • langchain_core.prompts.chat.ChatMessagePromptTemplate
  • langchain_core.prompts.chat._StringImageMessagePromptTemplate(langchain_core.prompts.chat.BaseMessagePromptTemplate)
    • langchain_core.prompts.chat.AIMessagePromptTemplate
    • langchain_core.prompts.chat.HumanMessagePromptTemplate
    • langchain_core.prompts.chat.SystemMessagePromptTemplate
  • langchain_core.prompts.few_shot._FewShotPromptTemplateMixin(pydantic.v1.main.BaseModel)
    • langchain_core.prompts.few_shot.FewShotPromptTemplate(langchain_core.prompts.few_shot._FewShotPromptTemplateMixin, langchain_core.prompts.string.StringPromptTemplate)
  • langchain_core.runnables.base.RunnableSerializable(langchain_core.load.serializable.Serializable, langchain_core.runnables.base.Runnable)
    • langchain_core.prompts.base.BasePromptTemplate(langchain_core.runnables.base.RunnableSerializable, typing.Generic, abc.ABC)
      • langchain_core.prompts.chat.BaseChatPromptTemplate(langchain_core.prompts.base.BasePromptTemplate, abc.ABC)
        • langchain_core.prompts.chat.ChatPromptTemplate
        • langchain_core.prompts.few_shot.FewShotChatMessagePromptTemplate(langchain_core.prompts.chat.BaseChatPromptTemplate, langchain_core.prompts.few_shot._FewShotPromptTemplateMixin)
      • langchain_core.prompts.pipeline.PipelinePromptTemplate
      • langchain_core.prompts.string.StringPromptTemplate(langchain_core.prompts.base.BasePromptTemplate, abc.ABC)
        • langchain_core.prompts.few_shot.FewShotPromptTemplate(langchain_core.prompts.few_shot._FewShotPromptTemplateMixin, langchain_core.prompts.string.StringPromptTemplate)
        • langchain_core.prompts.few_shot_with_templates.FewShotPromptWithTemplates
        • langchain_core.prompts.prompt.PromptTemplate
  • pydantic.v1.main.BaseModel(pydantic.v1.utils.Representation)
    • langchain_community.example_selectors.ngram_overlap.NGramOverlapExampleSelector(langchain_core.example_selectors.base.BaseExampleSelector, pydantic.v1.main.BaseModel)
    • langchain_core.example_selectors.length_based.LengthBasedExampleSelector(langchain_core.example_selectors.base.BaseExampleSelector, pydantic.v1.main.BaseModel)
    • langchain_core.example_selectors.semantic_similarity.SemanticSimilarityExampleSelector(langchain_core.example_selectors.base.BaseExampleSelector, pydantic.v1.main.BaseModel)
      • langchain_core.example_selectors.semantic_similarity.MaxMarginalRelevanceExampleSelector
  • typing.Generic(builtins.object)
    • langchain_core.prompts.base.BasePromptTemplate(langchain_core.runnables.base.RunnableSerializable, typing.Generic, abc.ABC)
      • langchain_core.prompts.chat.BaseChatPromptTemplate(langchain_core.prompts.base.BasePromptTemplate, abc.ABC)
        • langchain_core.prompts.chat.ChatPromptTemplate
        • langchain_core.prompts.few_shot.FewShotChatMessagePromptTemplate(langchain_core.prompts.chat.BaseChatPromptTemplate, langchain_core.prompts.few_shot._FewShotPromptTemplateMixin)
      • langchain_core.prompts.pipeline.PipelinePromptTemplate
      • langchain_core.prompts.string.StringPromptTemplate(langchain_core.prompts.base.BasePromptTemplate, abc.ABC)
        • langchain_core.prompts.few_shot.FewShotPromptTemplate(langchain_core.prompts.few_shot._FewShotPromptTemplateMixin, langchain_core.prompts.string.StringPromptTemplate)
        • langchain_core.prompts.few_shot_with_templates.FewShotPromptWithTemplates
        • langchain_core.prompts.prompt.PromptTemplate

retrievers

Help on package langchain.retrievers in langchain:


NAME

langchain.retrievers -Retriever class returns Documents given a textquery.


DESCRIPTION

It is more general than a vector store. A retriever does not need to be able to store documents, only to return (or retrieve) it. Vector stores can be used as the backbone of a retriever, but there are other types of retrievers as well.


Class hierarchy:

... code-block::

​ BaseRetriever --> Retriever # Examples: ArxivRetriever, MergerRetriever

Main helpers:

... code-block::

​ Document, Serializable, Callbacks, CallbackManagerForRetrieverRun, AsyncCallbackManagerForRetrieverRun


PACKAGE CONTENTS

  • arcee
  • arxiv
  • azure_cognitive_search
  • bedrock
  • bm25
  • chaindesk
  • chatgpt_plugin_retriever
  • cohere_rag_retriever
  • contextual_compression
  • databerry
  • docarray
  • document_compressors (package)
  • elastic_search_bm25
  • embedchain
  • ensemble
  • google_cloud_documentai_warehouse
  • google_vertex_ai_search
  • kay
  • kendra
  • knn
  • llama_index
  • merger_retriever
  • metal
  • milvus
  • multi_query
  • multi_vector
  • outline
  • parent_document_retriever
  • pinecone_hybrid_search
  • pubmed
  • pupmed
  • re_phraser
  • remote_retriever
  • self_query (package)
  • svm
  • tavily_search_api
  • tfidf
  • time_weighted_retriever
  • vespa_retriever
  • weaviate_hybrid_search
  • web_research
  • wikipedia
  • you
  • zep
  • zilliz

CLASSES

  • langchain_community.utilities.outline.OutlineAPIWrapper(pydantic.v1.main.BaseModel)
    • langchain_community.retrievers.outline.OutlineRetriever(langchain_core.retrievers.BaseRetriever, langchain_community.utilities.outline.OutlineAPIWrapper)
  • langchain_core.retrievers.BaseRetriever(langchain_core.runnables.base.RunnableSerializable, abc.ABC)
    • langchain.retrievers.contextual_compression.ContextualCompressionRetriever
    • langchain.retrievers.ensemble.EnsembleRetriever
    • langchain.retrievers.merger_retriever.MergerRetriever
    • langchain.retrievers.multi_query.MultiQueryRetriever
    • langchain.retrievers.multi_vector.MultiVectorRetriever
      • langchain.retrievers.parent_document_retriever.ParentDocumentRetriever
    • langchain.retrievers.re_phraser.RePhraseQueryRetriever
    • langchain.retrievers.self_query.base.SelfQueryRetriever
    • langchain.retrievers.time_weighted_retriever.TimeWeightedVectorStoreRetriever
    • langchain.retrievers.web_research.WebResearchRetriever
    • langchain_community.retrievers.outline.OutlineRetriever(langchain_core.retrievers.BaseRetriever, langchain_community.utilities.outline.OutlineAPIWrapper)

runnables

Help on package langchain.runnables in langchain:


NAME

langchain.runnables - LangChainRunnable and the LangChain Expression Language (LCEL).


DESCRIPTION

The LangChain Expression Language (LCEL) offers a declarative method to build production-grade programs that harness the power of LLMs.

Programs created using LCEL and LangChain Runnables inherently support synchronous, asynchronous, batch, and streaming operations.

Support forasync allows servers hosting the LCEL based programs to scale better for higher concurrent loads.


Batch operations allow for processing multiple inputs in parallel.

Streaming of intermediate outputs, as they're being generated, allows for creating more responsive UX.

This module contains non-core Runnable classes.


PACKAGE CONTENTS

  • hub
  • openai_functions

schema

Help on package langchain.schema in langchain:


NAME

langchain.schema -Schemas are the LangChain Base Classes and Interfaces.


PACKAGE CONTENTS

  • agent
  • cache
  • callbacks (package)
  • chat
  • chat_history
  • document
  • embeddings
  • exceptions
  • language_model
  • memory
  • messages
  • output
  • output_parser
  • prompt
  • prompt_template
  • retriever
  • runnable (package)
  • storage
  • vectorstore

CLASSES

  • abc.ABC(builtins.object)
    • langchain_core.caches.BaseCache
    • langchain_core.chat_history.BaseChatMessageHistory
    • langchain_core.documents.transformers.BaseDocumentTransformer
    • langchain_core.memory.BaseMemory(langchain_core.load.serializable.Serializable, abc.ABC)
    • langchain_core.output_parsers.base.BaseLLMOutputParser(typing.Generic, abc.ABC)
      • langchain_core.output_parsers.base.BaseOutputParser(langchain_core.output_parsers.base.BaseLLMOutputParser, langchain_core.runnables.base.RunnableSerializable)
    • langchain_core.prompt_values.PromptValue(langchain_core.load.serializable.Serializable, abc.ABC)
    • langchain_core.prompts.base.BasePromptTemplate(langchain_core.runnables.base.RunnableSerializable, typing.Generic, abc.ABC)
    • langchain_core.retrievers.BaseRetriever(langchain_core.runnables.base.RunnableSerializable, abc.ABC)
    • langchain_core.stores.BaseStore(typing.Generic, abc.ABC)
  • builtins.Exception(builtins.BaseException)
    • langchain_core.exceptions.LangChainException
      • langchain_core.exceptions.OutputParserException(builtins.ValueError, langchain_core.exceptions.LangChainException)
  • builtins.ValueError(builtins.Exception)
    • langchain_core.exceptions.OutputParserException(builtins.ValueError, langchain_core.exceptions.LangChainException)
  • langchain_core.load.serializable.Serializable(pydantic.v1.main.BaseModel, abc.ABC)
    • langchain_core.agents.AgentAction
    • langchain_core.agents.AgentFinish
    • langchain_core.documents.base.Document
    • langchain_core.memory.BaseMemory(langchain_core.load.serializable.Serializable, abc.ABC)
    • langchain_core.messages.base.BaseMessage
      • langchain_core.messages.ai.AIMessage
      • langchain_core.messages.chat.ChatMessage
      • langchain_core.messages.function.FunctionMessage
      • langchain_core.messages.human.HumanMessage
      • langchain_core.messages.system.SystemMessage
    • langchain_core.outputs.generation.Generation
      • langchain_core.outputs.chat_generation.ChatGeneration
    • langchain_core.prompt_values.PromptValue(langchain_core.load.serializable.Serializable, abc.ABC)
  • langchain_core.output_parsers.transform.BaseTransformOutputParser(langchain_core.output_parsers.base.BaseOutputParser)
    • langchain_core.output_parsers.string.StrOutputParser
  • langchain_core.runnables.base.RunnableSerializable(langchain_core.load.serializable.Serializable, langchain_core.runnables.base.Runnable)
    • langchain_core.prompts.base.BasePromptTemplate(langchain_core.runnables.base.RunnableSerializable, typing.Generic, abc.ABC)
    • langchain_core.retrievers.BaseRetriever(langchain_core.runnables.base.RunnableSerializable, abc.ABC)
  • pydantic.v1.main.BaseModel(pydantic.v1.utils.Representation)
    • langchain_core.outputs.chat_result.ChatResult
    • langchain_core.outputs.llm_result.LLMResult
    • langchain_core.outputs.run_info.RunInfo
  • typing.Generic(builtins.object)
    • langchain_core.output_parsers.base.BaseLLMOutputParser(typing.Generic, abc.ABC)
      • langchain_core.output_parsers.base.BaseOutputParser(langchain_core.output_parsers.base.BaseLLMOutputParser, langchain_core.runnables.base.RunnableSerializable)
    • langchain_core.prompts.base.BasePromptTemplate(langchain_core.runnables.base.RunnableSerializable, typing.Generic, abc.ABC)
    • langchain_core.stores.BaseStore(typing.Generic, abc.ABC)

smith

Help on package langchain.smith in langchain:


NAME

langchain.smith -LangSmith utilities.


DESCRIPTION

This module provides utilities for connecting to LangSmith <https://smith.langchain.com/>.

For more information on LangSmith, see the LangSmith documentation <https://docs.smith.langchain.com/>_.


PACKAGE CONTENTS

  • evaluation (package)

ClassES

  • pydantic.v1.main.BaseModel(pydantic.v1.utils.Representation)
    • langchain.smith.evaluation.config.RunEvalConfig

storage

Help on package langchain.storage in langchain:


NAME

langchain.storage - Implementations of key-value stores and storage helpers.


DESCRIPTION

Module provides implementations of various key-value stores that conform to a simple key-value interface.

The primary goal of these storages is to support implementation of caching.


PACKAGE CONTENTS

  • _lc_store
  • encoder_backed
  • exceptions
  • file_system
  • in_memory
  • redis
  • upstash_redis

CLASSES

  • langchain_core.stores.BaseStore(typing.Generic, abc.ABC)
    • langchain.storage.encoder_backed.EncoderBackedStore
    • langchain.storage.file_system.LocalFileStore

text_splitter

Help on module langchain.text_splitter in langchain:


NAME

langchain.text_splitter - Kept for backwards compatibility.


CLASSES

  • abc.ABC(builtins.object)
    • langchain_text_splitters.base.TextSplitter(langchain_core.documents.transformers.BaseDocumentTransformer, abc.ABC)
      • langchain_text_splitters.base.TokenTextSplitter
      • langchain_text_splitters.character.CharacterTextSplitter
      • langchain_text_splitters.character.RecursiveCharacterTextSplitter
        • langchain_text_splitters.latex.LatexTextSplitter
        • langchain_text_splitters.markdown.MarkdownTextSplitter
        • langchain_text_splitters.python.PythonCodeTextSplitter
      • langchain_text_splitters.konlpy.KonlpyTextSplitter
      • langchain_text_splitters.nltk.NLTKTextSplitter
      • langchain_text_splitters.sentence_transformers.SentenceTransformersTokenTextSplitter
      • langchain_text_splitters.spacy.SpacyTextSplitter
  • builtins.dict(builtins.object)
    • langchain_text_splitters.html.ElementType
    • langchain_text_splitters.markdown.HeaderType
    • langchain_text_splitters.markdown.LineType
  • builtins.object
    • langchain_text_splitters.base.Tokenizer
    • langchain_text_splitters.html.HTMLHeaderTextSplitter
    • langchain_text_splitters.json.RecursiveJsonSplitter
    • langchain_text_splitters.markdown.MarkdownHeaderTextSplitter
  • builtins.str(builtins.object)
    • langchain_text_splitters.base.Language(builtins.str, enum.Enum)
  • enum.Enum(builtins.object)
    • langchain_text_splitters.base.Language(builtins.str, enum.Enum)
  • langchain_core.documents.transformers.BaseDocumentTransformer(abc.ABC)
    • langchain_text_splitters.base.TextSplitter(langchain_core.documents.transformers.BaseDocumentTransformer, abc.ABC)
      • langchain_text_splitters.base.TokenTextSplitter
      • langchain_text_splitters.character.CharacterTextSplitter
      • langchain_text_splitters.character.RecursiveCharacterTextSplitter
        • langchain_text_splitters.latex.LatexTextSplitter
        • langchain_text_splitters.markdown.MarkdownTextSplitter
        • langchain_text_splitters.python.PythonCodeTextSplitter
      • langchain_text_splitters.konlpy.KonlpyTextSplitter
      • langchain_text_splitters.nltk.NLTKTextSplitter
      • langchain_text_splitters.sentence_transformers.SentenceTransformersTokenTextSplitter
      • langchain_text_splitters.spacy.SpacyTextSplitter

tools

Help on package langchain.tools in langchain:


NAME

langchain.tools -Tools are classes that an Agent uses to interact with the world.


DESCRIPTION

Each tool has adescription. Agent uses the description to choose the right tool for the job.


Class hierarchy:

... code-block::

​ ToolMetaclass --> BaseTool --> Tool # Examples: AIPluginTool, BaseGraphQLTool

​ # Examples: BraveSearch, HumanInputRun

Main helpers:

... code-block::

​ CallbackManagerForToolRun, AsyncCallbackManagerForToolRun


PACKAGE CONTENTS

  • amadeus (package)
  • arxiv (package)
  • azure_cognitive_services (package)
  • base
  • bearly (package)
  • bing_search (package)
  • brave_search (package)
  • clickup (package)
  • convert_to_openai
  • dataforseo_api_search (package)
  • ddg_search (package)
  • e2b_data_analysis (package)
  • edenai (package)
  • eleven_labs (package)
  • file_management (package)
  • github (package)
  • gitlab (package)
  • gmail (package)
  • golden_query (package)
  • google_cloud (package)
  • google_finance (package)
  • google_jobs (package)
  • google_lens (package)
  • google_places (package)
  • google_scholar (package)
  • google_search (package)
  • google_serper (package)
  • google_trends (package)
  • graphql (package)
  • human (package)
  • ifttt
  • interaction (package)
  • jira (package)
  • json (package)
  • memorize (package)
  • merriam_webster (package)
  • metaphor_search (package)
  • multion (package)
  • nasa (package)
  • nuclia (package)
  • office365 (package)
  • openapi (package)
  • openweathermap (package)
  • playwright (package)
  • plugin
  • powerbi (package)
  • pubmed (package)
  • python (package)
  • reddit_search (package)
  • render
  • requests (package)
  • retriever
  • scenexplain (package)
  • searchapi (package)
  • searx_search (package)
  • shell (package)
  • slack (package)
  • sleep (package)
  • spark_sql (package)
  • sql_database (package)
  • stackexchange (package)
  • steam (package)
  • steamship_image_generation (package)
  • tavily_search (package)
  • vectorstore (package)
  • wikipedia (package)
  • wolfram_alpha (package)
  • yahoo_finance_news
  • youtube (package)
  • zapier (package)

CLASSES

  • langchain_core.runnables.base.RunnableSerializable(langchain_core.load.serializable.Serializable, langchain_core.runnables.base.Runnable)
    • langchain_core.tools.BaseTool
      • langchain_core.tools.StructuredTool
      • langchain_core.tools.Tool

utilities

Help on package langchain.utilities in langchain:


NAME

langchain.utilities -Utilities are the integrations with third-part systems and packages.


DESCRIPTION

Other LangChain classes useUtilities to interact with third-part systems


PACKAGE CONTENTS

  • alpha_vantage
  • anthropic
  • apify
  • arcee
  • arxiv
  • asyncio
  • awslambda
  • bibtex
  • bing_search
  • brave_search
  • clickup
  • dalle_image_generator
  • dataforseo_api_search
  • duckduckgo_search
  • github
  • gitlab
  • golden_query
  • google_finance
  • google_jobs
  • google_lens
  • google_places_api
  • google_scholar
  • google_search
  • google_serper
  • google_trends
  • graphql
  • jira
  • loading
  • max_compute
  • merriam_webster
  • metaphor_search
  • nasa
  • opaqueprompts
  • openapi
  • openweathermap
  • outline
  • portkey
  • powerbi
  • pubmed
  • python
  • reddit_search
  • redis
  • requests
  • scenexplain
  • searchapi
  • searx_search
  • serpapi
  • spark_sql
  • sql_database
  • stackexchange
  • steam
  • tavily_search
  • tensorflow_datasets
  • twilio
  • vertexai
  • wikipedia
  • wolfram_alpha
  • zapier

CLASSES

  • langchain_community.utilities.requests.GenericRequestsWrapper(pydantic.v1.main.BaseModel)
    • langchain_community.utilities.requests.TextRequestsWrapper
  • pydantic.v1.main.BaseModel(pydantic.v1.utils.Representation)
    • langchain_community.utilities.requests.Requests

utils

Help on package langchain.utils in langchain:


NAME

langchain.utils -Utility functions for LangChain.


DESCRIPTION

These functions do not depend on any other LangChain module.


PACKAGE CONTENTS

  • aiter
  • env
  • ernie_functions
  • formatting
  • html
  • input
  • interactive_env
  • iter
  • json_schema
  • loading
  • math
  • openai
  • openai_functions
  • pydantic
  • strings
  • utils

CLASSES

  • string.Formatter(builtins.object)
    • langchain_core.utils.formatting.StrictFormatter

vectorstores

Help on package langchain.vectorstores in langchain:


NAME

langchain.vectorstores -Vector store stores embedded data and performs vector search.


DESCRIPTION

One of the most common ways to store and search over unstructured data is to embed it and store the resulting embedding vectors, and then query the store and retrieve the data that are 'most similar' to the embedded query.


Class hierarchy:

... code-block::

VectorStore --> # Examples: Annoy, FAISS, Milvus

BaseRetriever --> VectorStoreRetriever --> Retriever # Example: VespaRetriever


Main helpers:

... code-block::

Embeddings, Document


PACKAGE CONTENTS

  • alibabacloud_opensearch
  • analyticdb
  • annoy
  • astradb
  • atlas
  • awadb
  • azure_cosmos_db
  • azuresearch
  • bageldb
  • baiducloud_vector_search
  • base
  • cassandra
  • chroma
  • clarifai
  • clickhouse
  • dashvector
  • databricks_vector_search
  • deeplake
  • dingo
  • docarray (package)
  • elastic_vector_search
  • elasticsearch
  • epsilla
  • faiss
  • hippo
  • hologres
  • lancedb
  • llm_rails
  • marqo
  • matching_engine
  • meilisearch
  • milvus
  • momento_vector_index
  • mongodb_atlas
  • myscale
  • neo4j_vector
  • nucliadb
  • opensearch_vector_search
  • pgembedding
  • pgvecto_rs
  • pgvector
  • pinecone
  • qdrant
  • redis (package)
  • rocksetdb
  • scann
  • semadb
  • singlestoredb
  • sklearn
  • sqlitevss
  • starrocks
  • supabase
  • tair
  • tencentvectordb
  • tigris
  • tiledb
  • timescalevector
  • typesense
  • usearch
  • utils
  • vald
  • vearch
  • vectara
  • vespa
  • weaviate
  • xata
  • yellowbrick
  • zep
  • zilliz

CLASSES

  • abc.ABC(builtins.object)
    • langchain_core.vectorstores.VectorStore

2014-03-27(三)

相关推荐
goTsHgo9 小时前
在 Spark 上实现 Graph Embedding
大数据·spark·embedding
爱学习的小道长2 天前
Python langchain ReAct 使用范例
python·ai·langchain
Elastic 中国社区官方博客3 天前
带有 Elasticsearch 和 Langchain 的 Agentic RAG
大数据·人工智能·elasticsearch·搜索引擎·ai·langchain
写编程的木木4 天前
可能是最强文生图工具:Stable Diffusion 3 超详细测试
人工智能·ai作画·stable diffusion·aigc·embedding
ai_lian_shuo5 天前
三、基于langchain使用Qwen搭建金融RAG问答机器人--检索增强生成
python·金融·langchain·aigc
ai_lian_shuo5 天前
二、基于langchain使用Qwen搭建金融RAG问答机器人--数据清洗和切片
python·金融·langchain·机器人·aigc
lzl20405 天前
【深度学习总结】使用PDF构建RAG:结合Langchain和通义千问
深度学习·langchain·通义千问·qwen·rag
OldGj_7 天前
「LangChain4j入门 — JavaAI程序」
java·ai·langchain·langchain4j
敲代码敲到头发茂密8 天前
【大语言模型】LangChain 核心模块介绍(Agents)
人工智能·语言模型·自然语言处理·langchain