LangChain - classes

2024-03-28 19:52
文章标签 langchain classes

本文主要是介绍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

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

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(三)

这篇关于LangChain - classes的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/856551

相关文章

LLM大模型教程:langchain 教程

软件安装 pip install pymupdfpip install langchainpip install langchain-cliconda install -c pytorch -c nvidia faiss-gpu=1.7.4 mkl=2021 blas=1.0=mkl 由于langchain不支持qwen模型,我们需要自定义模型 from typing import A

the following classes could not be found android.support.v7.internal.

打开XML的界面时候显示 rendering problems: the following classes could not be found android.support.v7.internal.....。 后来发现http://stackoverflow.com/questions/33742114/the-following-classes-could-not-be-fou

基于LangChain+LLM的相关技术研究及初步实践

01 概述 大模型概述 大模型是指具有大规模参数和复杂计算结构的机器学习模型。这些模型通常由深度神经网络构建而成,拥有数十亿甚至数千亿个参数。大模型的设计目的是为了提高模型的表达能力和预测性能,能够处理更加复杂的任务和数据。大模型在各种领域都有广泛的应用,包括自然语言处理、计算机视觉、语音识别和推荐系统等。大模型通过训练海量数据来学习复杂的模式和特征,具有更强大的泛化能力,可以对未见过的数据

langchain 《斗破苍穹》智谱 RAG 问题搜索

目录 代码 项目介绍 模型对比实验 分块方法对比 检索方法对比 结果 10条问题 15条问题 局限性 代码 https://github.com/5zjk5/prompt-engineering/tree/master 项目介绍 《斗破苍穹》小说 RAG 问答,爬虫爬取整部小说章节,并分别保存到不同的数据源中。 txt,pdf,markdown,word。

LangChain教程 - 系列文章

LangChain 是一个专为开发大语言模型(LLM)应用程序设计的框架。它提供了丰富的模块化工具,支持开发者轻松构建、管理和部署复杂的 LLM 应用程序。LangChain 允许将语言模型、提示模板、输出解析器等组件进行无缝集成,同时支持链式调用和复杂任务的处理,适用于对话系统、内容生成、翻译等多种场景。 系列文章索引: LangChain教程 - 介绍 LangChain教程 - 使用 LC

LangChain学习

1、LangChain主要用于开发LLM应用 chain可以理解成一个pipeline。构建各种各样的pipeline。 2、可以自动定制prompt,解析输出格式 优化prompt格式,使得输出结果更好llm本身输出的只是一个字符串,自动解析为json等格式 3、memory机制,制作聊天机器人 llm本身只有输入输出,无法对话,需要将历史对话也输入到prompt才能聊天如对话

【LangChain】深入解析LangChain:如何使用输出解析器优化结果处理

😁 作者简介:一名前端爱好者,致力学习前端开发技术 ⭐️个人主页:夜宵饽饽的主页 ❔ 系列专栏:JavaScript小贴士 👐学习格言:成功不是终点,失败也并非末日,最重要的是继续前进的勇气 ​🔥​前言: 在使用langchain的过程中,输出解析器时非常关键的,可以帮助我们将复杂的模型响应转换为结构化、易于使用的数据格式,这是我自己的学习笔记,希望可以帮助到大家,欢迎大家的

Android 解决 No static method in class La/a/a/a; or its super classes

错误堆栈: Process: com.chaozh.iReader, PID: 24217java.lang.NoSuchMethodError: No static method getDrawable(Landroid/content/Context;I)Landroid/graphics/drawable/Drawable; in class La/a/a/a; or its super

How can I change from OpenAI to ChatOpenAI in langchain and Flask?

题意:“在 LangChain 和 Flask 中,如何将 OpenAI 更改为 ChatOpenAI?” 问题背景: This is an implementation based on langchain and flask and refers to an implementation to be able to stream responses from the OpenAI

LangChain学习资料

本文提供了一个LangChain框架的综合资源库,包括低代码工具、服务、代理、模板等,还列举了知识管理和聊天机器人等开源项目,以及学习笔记、视频教程等学习资料,旨在帮助开发者更好地利用和学习LangChain。 摘要由CSDN通过智能技术生成 文章目录 一、LangChain框架二、工具 2.1 低代码2.2 服务2.3 代理2.4 模板2.5 平台三、开源项目 3.1 知识管理3.