MCPcopy Create free account

hub / github.com/langchain-ai/langchain / functions

Functions15,261 in github.com/langchain-ai/langchain

↓ 844 callersFunctioncreate_importer
Create a function that helps retrieve objects from their new locations. The goal of this function is to help users transition from deprecated
libs/langchain/langchain_classic/_api/module_import.py:16
↓ 718 callersMethodappend
Append a message to the end of the chat template. Args: message: representation of a message to append.
libs/core/langchain_core/prompts/chat.py:1265
↓ 454 callersMethodget
Gets the collection. Args: ids: The ids of the embeddings to get. Optional. where: A Where type dict used to filter r
libs/partners/chroma/langchain_chroma/vectorstores.py:1137
↓ 438 callersFunctioncreate_agent
( model: str | BaseChatModel, tools: Sequence[BaseTool | Callable[..., Any] | dict[str, Any]] | None =
libs/langchain_v1/langchain/agents/factory.py:824
↓ 387 callersMethodget
Get documents by id. Fewer documents may be returned than requested if some IDs are not found or if there are duplicated IDs.
libs/core/langchain_core/indexing/base.py:605
↓ 341 callersMethodinvoke
Classify one request synchronously. Args: input: Complete request containing the state and typed questions. config: O
libs/partners/typesafe/langchain_typesafe/classifier.py:292
↓ 258 callersMethodinvoke
( self, input: LanguageModelInput, config: RunnableConfig | None = None,
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_summarization.py:224
↓ 233 callersFunctionhandler
(request: ToolCallRequest)
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_tool_retry.py:1129
↓ 205 callersMethodget
Get entity value from store.
libs/langchain/langchain_classic/memory/entity.py:45
↓ 160 callersMethodstream
Default implementation of `stream`, which calls `invoke`. Subclasses must override this method if they support streaming output. Arg
libs/core/langchain_core/runnables/base.py:1195
↓ 153 callersMethodinvoke
( self, input: str, config: RunnableConfig | None = None, **kwargs: Any, )
libs/core/tests/unit_tests/runnables/test_runnable.py:213
↓ 125 callersFunction_make_model
Create a `ChatOpenRouter` with sane defaults for unit tests.
libs/partners/openrouter/tests/unit_tests/test_chat_models.py:40
↓ 117 callersMethodfrom_template
Load a prompt template from a template. !!! warning "Security" Prefer using `template_format='f-string'` instead of
libs/core/langchain_core/prompts/prompt.py:257
↓ 107 callersMethodget_child
Get a child callback manager. Args: tag: The tag for the child callback manager. Returns: The child callback
libs/core/langchain_core/callbacks/manager.py:602
↓ 98 callersMethodoverride
Replace the request with a new request with the given overrides. Returns a new `ModelRequest` instance with the specified attributes replaced
libs/langchain_v1/langchain/agents/middleware/types.py:203
↓ 95 callersMethod_get_request_payload
Get the request payload for the Anthropic API.
libs/partners/anthropic/langchain_anthropic/chat_models.py:1868
↓ 90 callersMethodextend
Add all nodes and edges from another graph. Note this doesn't check for duplicates, nor does it connect the graphs. Args:
libs/core/langchain_core/runnables/graph.py:386
↓ 89 callersFunctionget_buffer_string
r"""Convert a sequence of messages to strings and concatenate them into one string. Args: messages: Messages to be converted to strings.
libs/core/langchain_core/messages/utils.py:297
↓ 87 callersMethod_get_request_payload
( self, input_: LanguageModelInput, *, stop: list[str] | None = None,
libs/partners/openai/langchain_openai/chat_models/base.py:3821
↓ 84 callersMethodastream_events
( self, input: Any, config: RunnableConfig | None = None, *, version:
libs/core/langchain_core/runnables/base.py:1344
↓ 81 callersMethodainvoke
( parent: RunnableLambda[int, int], cb: list[BaseCallbackHandler] )
libs/core/tests/unit_tests/runnables/test_tracing_interops.py:438
↓ 81 callersMethodsandbox_path
Build a path under the configured sandbox test directory.
libs/standard-tests/langchain_tests/integration_tests/sandboxes.py:93
↓ 79 callersMethodainvoke
( self, input: LanguageModelInput, config: RunnableConfig | None = None, *,
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_summarization.py:2016
↓ 78 callersFunctiondumpd
Return a dict representation of an object. Note: Plain dicts containing an `'lc'` key are automatically escaped to prevent confus
libs/core/langchain_core/load/dump.py:105
↓ 76 callersMethodstream_events
( self, input: Any, config: RunnableConfig | None = None, *, version:
libs/core/langchain_core/runnables/base.py:1675
↓ 71 callersMethodinvoke
( self, input: Any, config: RunnableConfig | None = None, **kw
libs/core/tests/unit_tests/test_tools.py:2375
↓ 70 callersMethodcopy
Return a copy of the edge with optional new source and target nodes. Args: source: The new source node id. target: Th
libs/core/langchain_core/runnables/graph.py:77
↓ 70 callersFunctionensure_config
Ensure that a config is a dict with all keys present. Args: config: The config to ensure. Returns: The ensured config.
libs/core/langchain_core/runnables/config.py:255
↓ 69 callersFunctionload
Revive a LangChain class from a JSON object. Use this if you already have a parsed JSON object, eg. from `json.load` or `orjson.loads`.
libs/core/langchain_core/load/load.py:683
↓ 68 callersMethodastream
Default implementation of `astream`, which calls `ainvoke`. Subclasses must override this method if they support streaming output. A
libs/core/langchain_core/runnables/base.py:1216
↓ 67 callersFunction_format_messages
Format messages for Anthropic's API.
libs/partners/anthropic/langchain_anthropic/chat_models.py:715
↓ 66 callersMethodbind
Bind arguments to a `Runnable`, returning a new `Runnable`. Useful when a `Runnable` in a chain requires an argument that is not in t
libs/core/langchain_core/runnables/base.py:1852
↓ 66 callersMethodformat
Format the prompt with the inputs. Args: **kwargs: Any arguments to be passed to the prompt template. Returns:
libs/core/langchain_core/prompts/prompt.py:191
↓ 64 callersFunctionrun_in_executor
Run a function in an executor. Args: executor_or_config: The executor or config to run in. func: The function. *args: The
libs/core/langchain_core/runnables/config.py:678
↓ 63 callersMethodfrom_texts
Construct Qdrant wrapper from a list of texts. Args: texts: A list of texts to be indexed in Qdrant. embedding: A sub
libs/partners/qdrant/langchain_qdrant/vectorstores.py:1193
↓ 62 callersMethodainvoke
Classify one request asynchronously. Args: input: Complete request containing the state and typed questions. config:
libs/partners/typesafe/langchain_typesafe/classifier.py:324
↓ 62 callersMethodget
Drain via `_request_more` and return the final value.
libs/core/langchain_core/language_models/chat_model_stream.py:270
↓ 60 callersMethodbind_tools
r"""Bind tool-like objects to `ChatAnthropic`. Args: tools: A list of tool definitions to bind to this chat model.
libs/partners/anthropic/langchain_anthropic/chat_models.py:2661
↓ 58 callersMethodmodel_copy
Copy the tool, clearing the schema memo if `update` affects it. `model_copy` writes `update` directly to the copy's `__dict__` without
libs/core/langchain_core/tools/base.py:645
↓ 58 callersMethodresolve
Resolve runtime detector and return an immutable rule. Returns: The resolved redaction rule.
libs/langchain_v1/langchain/agents/middleware/_redaction.py:405
↓ 56 callersMethodinvoke
( self, input: dict[str, Any], config: RunnableConfig | None = None, **kwargs:
libs/langchain/langchain_classic/chains/base.py:131
↓ 56 callersMethodstream
( self, input: Any, config: RunnableConfig | None = None, **kwargs: Any | None
libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py:2147
↓ 55 callersMethodfrom_messages
Create a chat prompt template from a variety of message formats. Examples: Instantiation from a list of message templates:
libs/core/langchain_core/prompts/chat.py:1124
↓ 54 callersMethodget_name
Get the name of the `Runnable`. Args: suffix: An optional suffix to append to the name. name: An optional name to use
libs/core/langchain_core/runnables/base.py:271
↓ 54 callersMethodmodel_dump
Dictionary representation of chain. Expects `Chain._chain_type` property to be implemented and for memory to be null. Ar
libs/langchain/langchain_classic/chains/base.py:735
↓ 54 callersMethodrun
Run the tool. Args: tool_input: The input to the tool. verbose: Whether to log the tool's progress. start
libs/core/langchain_core/tools/base.py:1009
↓ 54 callersMethodrun
Convenience method for executing chain. The main difference between this method and `Chain.__call__` is that this method expects inpu
libs/langchain/langchain_classic/chains/base.py:580
↓ 52 callersMethodnow
(cls, tz: datetime.tzinfo | None = None)
libs/core/langchain_core/utils/utils.py:95
↓ 50 callersMethodastream
( self, input: Any, config: RunnableConfig | None = None, **kwargs: Any | None
libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py:2156
↓ 48 callersMethodconfigure
Configure the callback manager. Args: inheritable_callbacks: The inheritable callbacks. local_callbacks: The local ca
libs/core/langchain_core/callbacks/manager.py:1683
↓ 48 callersMethodexecute
Figure out next browser command to run. Args: url: URL of the site currently on. browser_content: Content of the page
libs/langchain/langchain_classic/chains/natbot/base.py:129
↓ 46 callersFunctiondumps
Return a JSON string representation of an object. Note: Plain dicts containing an `'lc'` key are automatically escaped to prevent
libs/core/langchain_core/load/dump.py:70
↓ 45 callersFunctionpatch_config
Patch a config with new values. Args: config: The config to patch. callbacks: The callbacks to set. recursion_limit: The
libs/core/langchain_core/runnables/config.py:357
↓ 45 callersMethodupdate
Upsert records into the database. Args: keys: A list of record keys to upsert. group_ids: A list of group IDs corresp
libs/core/langchain_core/indexing/base.py:99
↓ 44 callersFunction_assert_events_equal_allow_superset_metadata
Assert that the events are equal.
libs/core/tests/unit_tests/runnables/test_runnable_events_v1.py:66
↓ 44 callersMethodsearch
Return docs most similar to query using a specified search type. Args: query: Input text. search_type: Type of search
libs/core/langchain_core/vectorstores/base.py:293
↓ 41 callersMethodmodel_dump
Convert to dictionary, ensuring `reasoning_content` is included.
libs/partners/deepseek/tests/unit_tests/test_chat_models.py:32
↓ 41 callersMethodparse
(self, *args: Any, **kwargs: Any)
libs/langchain/tests/unit_tests/output_parsers/test_fix.py:26
↓ 40 callersMethodbind_tools
Bind tool-like objects to this chat model. Assumes model is compatible with OpenAI tool-calling API. Args: tools: A list
libs/partners/openai/langchain_openai/chat_models/base.py:2494
↓ 39 callersMethoddelete_collection
Delete the collection.
libs/partners/chroma/langchain_chroma/vectorstores.py:1124
↓ 38 callersFunction_make_model
(**kwargs: Any)
libs/partners/fireworks/tests/unit_tests/test_chat_models.py:67
↓ 38 callersFunctionconvert_to_openai_tool
Convert a tool-like object to an OpenAI tool schema. [OpenAI tool schema reference](https://platform.openai.com/docs/api-reference/chat/create#ch
libs/core/langchain_core/utils/function_calling.py:515
↓ 38 callersMethodlist_tools
Discover and adapt MCP tools for use with LangChain. Args: cache_mode: How discovery interacts with the client-side response
libs/langchain_v1/langchain/mcp/adapter.py:221
↓ 38 callersMethodwith_config
Bind config to a `Runnable`, returning a new `Runnable`. Args: config: The config to bind to the `Runnable`. **kwargs
libs/core/langchain_core/runnables/base.py:1886
↓ 37 callersFunctionconvert_to_openai_function
Convert a raw function/class to an OpenAI function. Args: function: A dictionary, Pydantic `BaseModel` class, `TypedDict` class, a
libs/core/langchain_core/utils/function_calling.py:377
↓ 37 callersMethodexists
Check if the provided keys exist in the database. Args: keys: A list of keys to check. Returns: A list of bo
libs/core/langchain_core/indexing/base.py:155
↓ 36 callersFunction_build_model
(**overrides: Any)
libs/partners/openai/tests/unit_tests/chat_models/test_codex.py:80
↓ 36 callersMethodget_noop_manager
Return a manager that doesn't perform any operations. Returns: The noop manager.
libs/core/langchain_core/callbacks/manager.py:528
↓ 36 callersFunctionindex
Index data from the loader into the vector store. Indexing functionality uses a manager to keep track of which documents are in the vector st
libs/core/langchain_core/indexing/api.py:296
↓ 35 callersFunction_quote
(path: str)
libs/standard-tests/langchain_tests/integration_tests/sandboxes.py:66
↓ 35 callersMethodinvoke
( self, input: str | dict[str, Any] | ToolCall, config: RunnableConfig | None = None,
libs/core/langchain_core/tools/base.py:757
↓ 33 callersMethodfrom_llm
Creates a FlareChain from a language model. Args: llm: Language model to use. max_generation_len: Maximum length of t
libs/langchain/langchain_classic/chains/flare/base.py:250
↓ 33 callersMethodsplit_text
Split text into multiple components. Args: text: The text to split. Returns: A list of text chunks.
libs/text-splitters/langchain_text_splitters/base.py:108
↓ 32 callersMethodfrom_function
Initialize tool from a function. Args: func: The function to create the tool from. name: The name of the tool.
libs/core/langchain_core/tools/simple.py:169
↓ 32 callersMethodupdate
Update cache based on `prompt` and `llm_string`. The `prompt` and `llm_string` are used to generate a key for the cache. The key shou
libs/core/langchain_core/caches.py:73
↓ 32 callersMethodupdate
Upsert records into the SQLite database.
libs/langchain/langchain_classic/indexes/_sql_record_manager.py:253
↓ 31 callersFunction_make_llm
(max_retries: int | None = 2)
libs/partners/fireworks/tests/unit_tests/test_chat_models.py:755
↓ 31 callersMethodassign
Assigns new fields to the `dict` output of this `Runnable`. ```python from langchain_core.language_models.fake import FakeStreamingLi
libs/core/langchain_core/runnables/base.py:837
↓ 31 callersMethodclose
Close the underlying sync HTTP client. After calling, sync invocations on this model will raise. Async invocations remain available u
libs/partners/fireworks/langchain_fireworks/chat_models.py:1180
↓ 30 callersMethoddispatch
Route a protocol event to the appropriate internal handler. Public entry point for feeding events into the stream. Called by the stre
libs/core/langchain_core/language_models/chat_model_stream.py:663
↓ 30 callersMethodformat_messages
Format the chat template into a list of finalized messages. Args: **kwargs: Keyword arguments to use for filling in template vari
libs/core/langchain_core/prompts/chat.py:1174
↓ 30 callersMethodfunc
( value: Input, run_manager: AsyncCallbackManagerForChainRun,
libs/core/langchain_core/runnables/base.py:5214
↓ 29 callersFunctionaindex
Async index data from the loader into the vector store. Indexing functionality uses a manager to keep track of which documents are in the vec
libs/core/langchain_core/indexing/api.py:635
↓ 28 callersFunction_create_tracer_with_mocked_client
( project_name: str | None = None, tags: list[str] | None = None, metadata: Mapping[str, str] | No
libs/core/tests/unit_tests/runnables/test_tracing_interops.py:48
↓ 28 callersMethodafter_model
Trigger interrupt flows for relevant tool calls after an `AIMessage`. Args: state: The current agent state. runtime:
libs/langchain_v1/langchain/agents/middleware/human_in_the_loop.py:427
↓ 28 callersMethodfrom_language
Return an instance of this class based on a specific language. This method initializes the text splitter with language-specific separators.
libs/text-splitters/langchain_text_splitters/character.py:165
↓ 28 callersMethodsearch
Search for a term in the docstore, and if found save.
libs/langchain/langchain_classic/agents/react/base.py:99
↓ 27 callersFunction_make_sdk_response
Build a MagicMock that behaves like an SDK ChatResponse.
libs/partners/openrouter/tests/unit_tests/test_chat_models.py:183
↓ 27 callersMethodbefore_model
Check user messages and tool results for PII before model invocation. Args: state: The current agent state. runtime:
libs/langchain_v1/langchain/agents/middleware/pii.py:699
↓ 27 callersFunctionsecret_from_env
(key: str | Sequence[str], /)
libs/core/langchain_core/utils/utils.py:425
↓ 26 callersFunction_collect_events
Collect the events and remove the run ids.
libs/core/tests/unit_tests/runnables/test_runnable_events_v2.py:86
↓ 26 callersFunctioncount_tokens_approximately
Approximate the total number of tokens in messages. The token count includes stringified message content, role, and (optionally) name. - For
libs/core/langchain_core/messages/utils.py:2257
↓ 26 callersMethoddict
Return dictionary representation of agent.
libs/langchain/langchain_classic/agents/agent.py:720
↓ 26 callersMethodget_input_jsonschema
( self, config: RunnableConfig | None = None )
libs/core/tests/unit_tests/test_tools.py:1841
↓ 25 callersFunctionconvert_to_openai_messages
( messages: _SingleMessage, *, text_format: Literal["string", "block"] = "string", include_id:
libs/core/langchain_core/messages/utils.py:1543
↓ 25 callersFunctionhandle_event
Generic event handler for `CallbackManager`. Args: handlers: The list of handlers that will handle the event. event_name: The nam
libs/core/langchain_core/callbacks/manager.py:285
↓ 25 callersMethodset
Set entity value in store.
libs/langchain/langchain_classic/memory/entity.py:49
↓ 24 callersMethodabatch
( self, inputs: list[str], config: RunnableConfig | list[RunnableConfig] |
libs/core/tests/unit_tests/runnables/test_runnable.py:4428
↓ 24 callersMethodfrom_texts
Create a Chroma vectorstore from a raw documents. If a persist_directory is specified, the collection will be persisted there. Otherw
libs/partners/chroma/langchain_chroma/vectorstores.py:1273
↓ 24 callersFunctionparse_url_with_auth
Parse URL and extract `userinfo` credentials for headers. Handles URLs of the form: `https://user:password@host:port/path` Scheme-less URLs
libs/partners/ollama/langchain_ollama/_utils.py:77
next →1–100 of 15,261, ranked by callers