id
stringlengths
14
15
text
stringlengths
13
2.7k
source
stringlengths
60
181
0a4186f45faa-0
langchain_core.runnables.passthrough.RunnablePassthrough¶ class langchain_core.runnables.passthrough.RunnablePassthrough[source]¶ Bases: RunnableSerializable[Other, Other] A runnable to passthrough inputs unchanged or with additional keys. This runnable behaves almost like the identity function, except that it can be c...
https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnablePassthrough.html
0a4186f45faa-1
'llm2': fake_llm, } | RunnablePassthrough.assign( total_chars=lambda inputs: len(inputs['llm1'] + inputs['llm2']) ) runnable.invoke('hello') # {'llm1': 'completion', 'llm2': 'completion', 'total_chars': 20} Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if ...
https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnablePassthrough.html
0a4186f45faa-2
The default implementation allows usage of async code even if the runnable did not implement a native async version of invoke. Subclasses should override this method if they can run asynchronously. classmethod assign(**kwargs: Union[Runnable[Dict[str, Any], Any], Callable[[Dict[str, Any]], Any], Mapping[str, Union[Runn...
https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnablePassthrough.html
0a4186f45faa-3
step, and the final state of the run. The jsonpatch ops can be applied in order to construct state. Parameters input – The input to the runnable. config – The config to use for the runnable. diff – Whether to yield diffs between each step, or the current state. with_streamed_output_list – Whether to yield the streamed_...
https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnablePassthrough.html
0a4186f45faa-4
To mark a field as configurable, see the configurable_fields and configurable_alternatives methods. Parameters include – A list of fields to include in the config schema. Returns A pydantic model that can be used to validate config. configurable_alternatives(which: ConfigurableField, *, default_key: str = 'default', pr...
https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnablePassthrough.html
0a4186f45faa-5
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex...
https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnablePassthrough.html
0a4186f45faa-6
Returns A pydantic model that can be used to validate output. invoke(input: Other, config: Optional[RunnableConfig] = None, **kwargs: Any) → Other[source]¶ Transform a single input into an output. Override to implement. Parameters input – The input to the runnable. config – A config to use when invoking the runnable. T...
https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnablePassthrough.html
0a4186f45faa-7
by calling invoke() with each input. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = No...
https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnablePassthrough.html
0a4186f45faa-8
Bind config to a Runnable, returning a new Runnable. with_fallbacks(fallbacks: Sequence[Runnable[Input, Output]], *, exceptions_to_handle: Tuple[Type[BaseException], ...] = (<class 'Exception'>,)) → RunnableWithFallbacksT[Input, Output]¶ Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A se...
https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnablePassthrough.html
0a4186f45faa-9
between retries stop_after_attempt – The maximum number of attempts to make before giving up Returns A new Runnable that retries the original runnable on exceptions. with_types(*, input_type: Optional[Type[Input]] = None, output_type: Optional[Type[Output]] = None) → Runnable[Input, Output]¶ Bind input and output types...
https://api.python.langchain.com/en/latest/runnables/langchain_core.runnables.passthrough.RunnablePassthrough.html
796543a88832-0
langchain_experimental.generative_agents.memory.GenerativeAgentMemory¶ class langchain_experimental.generative_agents.memory.GenerativeAgentMemory[source]¶ Bases: BaseMemory Memory for the generative agent. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the inp...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.memory.GenerativeAgentMemory.html
796543a88832-1
Add an observations or memories to the agent’s memory. add_memory(memory_content: str, now: Optional[datetime] = None) → List[str][source]¶ Add an observation or memory to the agent’s memory. chain(prompt: PromptTemplate) → LLMChain[source]¶ clear() → None[source]¶ Clear memory contents. classmethod construct(_fields_s...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.memory.GenerativeAgentMemory.html
796543a88832-2
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. fetch_memories(observation: str, now: Optional[datetime] = None) → List[Document][source]¶ Fetch related memories. format_memories_detail(relevant_memories: List[Document]) → str[source]¶ format_memories_simple(...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.memory.GenerativeAgentMemory.html
796543a88832-3
Return key-value pairs given the text input to the chain. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, conte...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.memory.GenerativeAgentMemory.html
88e866342d76-0
langchain_experimental.generative_agents.generative_agent.GenerativeAgent¶ class langchain_experimental.generative_agents.generative_agent.GenerativeAgent[source]¶ Bases: BaseModel An Agent as a character with memory and innate characteristics. Create a new model by parsing and validating input data from keyword argume...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.generative_agent.GenerativeAgent.html
88e866342d76-1
Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.generative_agent.GenerativeAgent.html
88e866342d76-2
Return a full header of the agent’s status, summary, and current time. get_summary(force_refresh: bool = False, now: Optional[datetime] = None) → str[source]¶ Return a descriptive summary of the agent. json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntSt...
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.generative_agent.GenerativeAgent.html
88e866342d76-3
classmethod update_forward_refs(**localns: Any) → None¶ Try to update ForwardRefs on fields based on this Model, globalns and localns. classmethod validate(value: Any) → Model¶
https://api.python.langchain.com/en/latest/generative_agents/langchain_experimental.generative_agents.generative_agent.GenerativeAgent.html
bed1393e1d96-0
langchain_experimental.open_clip.open_clip.OpenCLIPEmbeddings¶ class langchain_experimental.open_clip.open_clip.OpenCLIPEmbeddings[source]¶ Bases: BaseModel, Embeddings Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a val...
https://api.python.langchain.com/en/latest/open_clip/langchain_experimental.open_clip.open_clip.OpenCLIPEmbeddings.html
bed1393e1d96-1
the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[boo...
https://api.python.langchain.com/en/latest/open_clip/langchain_experimental.open_clip.open_clip.OpenCLIPEmbeddings.html
bed1393e1d96-2
classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶ classmet...
https://api.python.langchain.com/en/latest/open_clip/langchain_experimental.open_clip.open_clip.OpenCLIPEmbeddings.html
25c8e926bb36-0
langchain_community.docstore.arbitrary_fn.DocstoreFn¶ class langchain_community.docstore.arbitrary_fn.DocstoreFn(lookup_fn: Callable[[str], Union[Document, str]])[source]¶ Langchain Docstore via arbitrary lookup function. This is useful when: it’s expensive to construct an InMemoryDocstore/dict you retrieve documents f...
https://api.python.langchain.com/en/latest/docstore/langchain_community.docstore.arbitrary_fn.DocstoreFn.html
308c619ba6d0-0
langchain_community.docstore.base.AddableMixin¶ class langchain_community.docstore.base.AddableMixin[source]¶ Mixin class that supports adding texts. Methods __init__() add(texts) Add more documents. __init__()¶ abstract add(texts: Dict[str, Document]) → None[source]¶ Add more documents.
https://api.python.langchain.com/en/latest/docstore/langchain_community.docstore.base.AddableMixin.html
360fcb07d5ac-0
langchain_community.docstore.base.Docstore¶ class langchain_community.docstore.base.Docstore[source]¶ Interface to access to place that stores documents. Methods __init__() delete(ids) Deleting IDs from in memory dictionary. search(search) Search for document. __init__()¶ delete(ids: List) → None[source]¶ Deleting IDs ...
https://api.python.langchain.com/en/latest/docstore/langchain_community.docstore.base.Docstore.html
8d849ebd093e-0
langchain_community.docstore.in_memory.InMemoryDocstore¶ class langchain_community.docstore.in_memory.InMemoryDocstore(_dict: Optional[Dict[str, Document]] = None)[source]¶ Simple in memory docstore in the form of a dict. Initialize with dict. Methods __init__([_dict]) Initialize with dict. add(texts) Add texts to in m...
https://api.python.langchain.com/en/latest/docstore/langchain_community.docstore.in_memory.InMemoryDocstore.html
989eb4526502-0
langchain_community.docstore.wikipedia.Wikipedia¶ class langchain_community.docstore.wikipedia.Wikipedia[source]¶ Wrapper around wikipedia API. Check that wikipedia package is installed. Methods __init__() Check that wikipedia package is installed. delete(ids) Deleting IDs from in memory dictionary. search(search) Try ...
https://api.python.langchain.com/en/latest/docstore/langchain_community.docstore.wikipedia.Wikipedia.html
1e78f66b8005-0
langchain_core.chat_history.BaseChatMessageHistory¶ class langchain_core.chat_history.BaseChatMessageHistory[source]¶ Abstract base class for storing chat message history. See ChatMessageHistory for default implementation. Example class FileChatMessageHistory(BaseChatMessageHistory): storage_path: str session_...
https://api.python.langchain.com/en/latest/chat_history/langchain_core.chat_history.BaseChatMessageHistory.html
1e78f66b8005-1
Convenience method for adding a human message string to the store. Parameters message – The string contents of a human message. abstract clear() → None[source]¶ Remove all messages from the store
https://api.python.langchain.com/en/latest/chat_history/langchain_core.chat_history.BaseChatMessageHistory.html
322f61d02182-0
langchain_core.exceptions.LangChainException¶ class langchain_core.exceptions.LangChainException[source]¶ General LangChain exception.
https://api.python.langchain.com/en/latest/exceptions/langchain_core.exceptions.LangChainException.html
6bcf5289859e-0
langchain_core.exceptions.TracerException¶ class langchain_core.exceptions.TracerException[source]¶ Base class for exceptions in tracers module.
https://api.python.langchain.com/en/latest/exceptions/langchain_core.exceptions.TracerException.html
0dcc2df60c36-0
langchain_core.exceptions.OutputParserException¶ class langchain_core.exceptions.OutputParserException(error: Any, observation: Optional[str] = None, llm_output: Optional[str] = None, send_to_llm: bool = False)[source]¶ Exception that output parsers should raise to signify a parsing error. This exists to differentiate ...
https://api.python.langchain.com/en/latest/exceptions/langchain_core.exceptions.OutputParserException.html
315a9ea9d17c-0
langchain_core.beta.runnables.context.PrefixContext¶ class langchain_core.beta.runnables.context.PrefixContext(prefix: str = '')[source]¶ Attributes prefix Methods __init__([prefix]) getter(key, /) setter([_key, _value]) __init__(prefix: str = '')[source]¶ getter(key: Union[str, List[str]], /) → ContextGet[source]¶ set...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.PrefixContext.html
fc502081ab0b-0
langchain_core.beta.runnables.context.Context¶ class langchain_core.beta.runnables.context.Context[source]¶ Methods __init__() create_scope(scope, /) getter(key, /) setter([_key, _value]) __init__()¶ static create_scope(scope: str, /) → PrefixContext[source]¶ static getter(key: Union[str, List[str]], /) → ContextGet[so...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.Context.html
abde0838fceb-0
langchain_core.beta.runnables.context.ContextSet¶ class langchain_core.beta.runnables.context.ContextSet[source]¶ Bases: RunnableSerializable Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a valid model. param keys: Mappi...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextSet.html
abde0838fceb-1
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Option...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextSet.html
abde0838fceb-2
Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can start producing output while input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextSet.html
abde0838fceb-3
Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextSet.html
abde0838fceb-4
This method allows to get an input schema for a specific configuration. Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate input. classmethod get_lc_namespace() → List[str]¶ Get the namespace of the langchain object. For example, if the class is langcha...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextSet.html
abde0838fceb-5
classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextSet.html
abde0838fceb-6
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of stream, which calls invoke. Subclasses should override t...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextSet.html
abde0838fceb-7
fallback in order, upon failures. with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output]¶ Bind lifecycle listeners to a Runnable, returning a new Runnable. on_start: Called before the runnable starts running, with the Run ...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextSet.html
abde0838fceb-8
property OutputType: Type[langchain_core.runnables.utils.Output]¶ The type of output this runnable produces specified as a type annotation. property config_specs: List[langchain_core.runnables.utils.ConfigurableFieldSpec]¶ List configurable fields for this runnable. property ids: List[str]¶ property input_schema: Type[...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextSet.html
8321fdfd67b3-0
langchain_core.beta.runnables.context.config_with_context¶ langchain_core.beta.runnables.context.config_with_context(config: RunnableConfig, steps: List[Runnable]) → RunnableConfig[source]¶
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.config_with_context.html
5260e43fee7b-0
langchain_core.beta.runnables.context.ContextGet¶ class langchain_core.beta.runnables.context.ContextGet[source]¶ Bases: RunnableSerializable Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a valid model. param key: Union[...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextGet.html
5260e43fee7b-1
Subclasses should override this method if they support streaming output. async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Option...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextGet.html
5260e43fee7b-2
Default implementation of atransform, which buffers input and calls astream. Subclasses should override this method if they can start producing output while input is still being generated. batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextGet.html
5260e43fee7b-3
Default values are respected, but no other validation is performed. Behaves as if Config.extra = ‘allow’ was set since it adds all passed values copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextGet.html
5260e43fee7b-4
This method allows to get an input schema for a specific configuration. Parameters config – A config to use when generating the schema. Returns A pydantic model that can be used to validate input. classmethod get_lc_namespace() → List[str]¶ Get the namespace of the langchain object. For example, if the class is langcha...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextGet.html
5260e43fee7b-5
classmethod is_lc_serializable() → bool¶ Is this class serializable? json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextGet.html
5260e43fee7b-6
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶ stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶ Default implementation of stream, which calls invoke. Subclasses should override t...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextGet.html
5260e43fee7b-7
fallback in order, upon failures. with_listeners(*, on_start: Optional[Listener] = None, on_end: Optional[Listener] = None, on_error: Optional[Listener] = None) → Runnable[Input, Output]¶ Bind lifecycle listeners to a Runnable, returning a new Runnable. on_start: Called before the runnable starts running, with the Run ...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextGet.html
5260e43fee7b-8
property OutputType: Type[langchain_core.runnables.utils.Output]¶ The type of output this runnable produces specified as a type annotation. property config_specs: List[langchain_core.runnables.utils.ConfigurableFieldSpec]¶ List configurable fields for this runnable. property ids: List[str]¶ property input_schema: Type[...
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.ContextGet.html
e3deb6c32274-0
langchain_core.beta.runnables.context.aconfig_with_context¶ langchain_core.beta.runnables.context.aconfig_with_context(config: RunnableConfig, steps: List[Runnable]) → RunnableConfig[source]¶
https://api.python.langchain.com/en/latest/beta/langchain_core.beta.runnables.context.aconfig_with_context.html
dd71943d8153-0
langchain_core.documents.base.Document¶ class langchain_core.documents.base.Document[source]¶ Bases: Serializable Class for storing a piece of text and associated metadata. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input data cannot be parsed to form a...
https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html
dd71943d8153-1
deep – set to True to make a deep copy of the model Returns new model instance dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex...
https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html
dd71943d8153-2
The unique identifier is a list of strings that describes the path to the object. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶ classmethod parse_obj(obj: Any) → Model¶ classmethod parse_raw(b: Uni...
https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html
dd71943d8153-3
OpenAI Functions Metadata Tagger Doctran Extract Properties Doctran Interrogate Documents Doctran Translate Documents TensorFlow Datasets Airbyte Salesforce Airbyte CDK Airbyte Stripe Copy Paste Airbyte Typeform Apify Dataset Docugami Airbyte Hubspot Airbyte Gong Airbyte Shopify Airbyte Zendesk Support SageMakerEndpoin...
https://api.python.langchain.com/en/latest/documents/langchain_core.documents.base.Document.html
24f3bcb817cc-0
langchain_core.documents.transformers.BaseDocumentTransformer¶ class langchain_core.documents.transformers.BaseDocumentTransformer[source]¶ Abstract base class for document transformation systems. A document transformation system takes a sequence of Documents and returns a sequence of transformed Documents. Example cla...
https://api.python.langchain.com/en/latest/documents/langchain_core.documents.transformers.BaseDocumentTransformer.html
24f3bcb817cc-1
Transform a list of documents. Parameters documents – A sequence of Documents to be transformed. Returns A list of transformed Documents.
https://api.python.langchain.com/en/latest/documents/langchain_core.documents.transformers.BaseDocumentTransformer.html
d36829b587f9-0
langchain_core.utils.iter.Tee¶ class langchain_core.utils.iter.Tee(iterable: Iterator[T], n: int = 2, *, lock: Optional[ContextManager[Any]] = None)[source]¶ Create n separate asynchronous iterators over iterable This splits a single iterable into multiple iterators, each providing the same items in the same order. All...
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.iter.Tee.html
d36829b587f9-1
and access is automatically synchronised. Methods __init__(iterable[, n, lock]) close() __init__(iterable: Iterator[T], n: int = 2, *, lock: Optional[ContextManager[Any]] = None)[source]¶ close() → None[source]¶
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.iter.Tee.html
01a121d1b4ee-0
langchain_core.utils.aiter.tee_peer¶ async langchain_core.utils.aiter.tee_peer(iterator: AsyncIterator[T], buffer: Deque[T], peers: List[Deque[T]], lock: AsyncContextManager[Any]) → AsyncGenerator[T, None][source]¶ An individual iterator of a tee()
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.aiter.tee_peer.html
362bbffc3fde-0
langchain_core.utils.env.get_from_dict_or_env¶ langchain_core.utils.env.get_from_dict_or_env(data: Dict[str, Any], key: str, env_key: str, default: Optional[str] = None) → str[source]¶ Get a value from a dictionary or an environment variable.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.env.get_from_dict_or_env.html
4a42ae9d2993-0
langchain_community.utils.openai_functions.convert_pydantic_to_openai_tool¶ langchain_community.utils.openai_functions.convert_pydantic_to_openai_tool(model: Type[BaseModel], *, name: Optional[str] = None, description: Optional[str] = None) → ToolDescription[source]¶ Converts a Pydantic model to a function description ...
https://api.python.langchain.com/en/latest/utils/langchain_community.utils.openai_functions.convert_pydantic_to_openai_tool.html
dcd38f2972f0-0
langchain_core.utils.strings.stringify_dict¶ langchain_core.utils.strings.stringify_dict(data: dict) → str[source]¶ Stringify a dictionary. Parameters data – The dictionary to stringify. Returns The stringified dictionary. Return type str
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.strings.stringify_dict.html
9884a6c85b0f-0
langchain_community.utils.openai_functions.convert_pydantic_to_openai_function¶ langchain_community.utils.openai_functions.convert_pydantic_to_openai_function(model: Type[BaseModel], *, name: Optional[str] = None, description: Optional[str] = None) → FunctionDescription[source]¶ Converts a Pydantic model to a function ...
https://api.python.langchain.com/en/latest/utils/langchain_community.utils.openai_functions.convert_pydantic_to_openai_function.html
7d13aee641ab-0
langchain_community.utils.math.cosine_similarity¶ langchain_community.utils.math.cosine_similarity(X: Union[List[List[float]], List[ndarray], ndarray], Y: Union[List[List[float]], List[ndarray], ndarray]) → ndarray[source]¶ Row-wise cosine similarity between two equal-width matrices.
https://api.python.langchain.com/en/latest/utils/langchain_community.utils.math.cosine_similarity.html
15b17a070568-0
langchain_core.utils.iter.batch_iterate¶ langchain_core.utils.iter.batch_iterate(size: int, iterable: Iterable[T]) → Iterator[List[T]][source]¶ Utility batching function.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.iter.batch_iterate.html
75170b7571fd-0
langchain_core.utils.iter.safetee¶ langchain_core.utils.iter.safetee¶ alias of Tee
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.iter.safetee.html
eec1c9fb11ae-0
langchain_core.utils.utils.raise_for_status_with_text¶ langchain_core.utils.utils.raise_for_status_with_text(response: Response) → None[source]¶ Raise an error with the response text.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.utils.raise_for_status_with_text.html
c37340b5de79-0
langchain_core.utils.formatting.StrictFormatter¶ class langchain_core.utils.formatting.StrictFormatter[source]¶ A subclass of formatter that checks for extra keys. Methods __init__() check_unused_args(used_args, args, kwargs) Check to see if extra parameters are passed. convert_field(value, conversion) format(format_st...
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.formatting.StrictFormatter.html
1c1594b27627-0
langchain_core.utils.pydantic.get_pydantic_major_version¶ langchain_core.utils.pydantic.get_pydantic_major_version() → int[source]¶ Get the major version of Pydantic.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.pydantic.get_pydantic_major_version.html
9a8b2e0ecba6-0
langchain_core.utils.loading.try_load_from_hub¶ langchain_core.utils.loading.try_load_from_hub(path: Union[str, Path], loader: Callable[[str], T], valid_prefix: str, valid_suffixes: Set[str], **kwargs: Any) → Optional[T][source]¶ Load configuration from hub. Returns None if path is not a hub path.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.loading.try_load_from_hub.html
68758af41afb-0
langchain_core.utils.iter.tee_peer¶ langchain_core.utils.iter.tee_peer(iterator: Iterator[T], buffer: Deque[T], peers: List[Deque[T]], lock: ContextManager[Any]) → Generator[T, None, None][source]¶ An individual iterator of a tee()
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.iter.tee_peer.html
8603244f9b79-0
langchain_core.utils.input.get_colored_text¶ langchain_core.utils.input.get_colored_text(text: str, color: str) → str[source]¶ Get colored text.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.input.get_colored_text.html
b55f427d1d9f-0
langchain_core.utils.utils.mock_now¶ langchain_core.utils.utils.mock_now(dt_value)[source]¶ Context manager for mocking out datetime.now() in unit tests. Example: with mock_now(datetime.datetime(2011, 2, 3, 10, 11)): assert datetime.datetime.now() == datetime.datetime(2011, 2, 3, 10, 11)
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.utils.mock_now.html
30bd2f152b0f-0
langchain_core.utils.utils.get_pydantic_field_names¶ langchain_core.utils.utils.get_pydantic_field_names(pydantic_cls: Any) → Set[str][source]¶ Get field names, including aliases, for a pydantic class. Parameters pydantic_cls – Pydantic class.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.utils.get_pydantic_field_names.html
2d816bfc2814-0
langchain_community.utils.openai_functions.ToolDescription¶ class langchain_community.utils.openai_functions.ToolDescription[source]¶ Representation of a callable function to the OpenAI API. type: Literal['function']¶ function: langchain_community.utils.openai_functions.FunctionDescription¶
https://api.python.langchain.com/en/latest/utils/langchain_community.utils.openai_functions.ToolDescription.html
5ee7afb08e7b-0
langchain_core.utils.strings.comma_list¶ langchain_core.utils.strings.comma_list(items: List[Any]) → str[source]¶ Convert a list to a comma-separated string.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.strings.comma_list.html
ed8500b75988-0
langchain.utils.ernie_functions.convert_pydantic_to_ernie_function¶ langchain.utils.ernie_functions.convert_pydantic_to_ernie_function(model: Type[BaseModel], *, name: Optional[str] = None, description: Optional[str] = None) → FunctionDescription[source]¶ Converts a Pydantic model to a function description for the Erni...
https://api.python.langchain.com/en/latest/utils/langchain.utils.ernie_functions.convert_pydantic_to_ernie_function.html
52cf6ce9731f-0
langchain_core.utils.aiter.atee¶ langchain_core.utils.aiter.atee¶ alias of Tee
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.aiter.atee.html
ed9ec79d884a-0
langchain_core.utils.aiter.Tee¶ class langchain_core.utils.aiter.Tee(iterable: AsyncIterator[T], n: int = 2, *, lock: Optional[AsyncContextManager[Any]] = None)[source]¶ Create n separate asynchronous iterators over iterable This splits a single iterable into multiple iterators, each providing the same items in the sam...
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.aiter.Tee.html
ed9ec79d884a-1
and access is automatically synchronised. Methods __init__(iterable[, n, lock]) aclose() __init__(iterable: AsyncIterator[T], n: int = 2, *, lock: Optional[AsyncContextManager[Any]] = None)[source]¶ async aclose() → None[source]¶
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.aiter.Tee.html
420c4104a1d1-0
langchain_core.utils.utils.build_extra_kwargs¶ langchain_core.utils.utils.build_extra_kwargs(extra_kwargs: Dict[str, Any], values: Dict[str, Any], all_required_field_names: Set[str]) → Dict[str, Any][source]¶ Build extra kwargs from values and extra_kwargs. Parameters extra_kwargs – Extra kwargs passed in by user. valu...
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.utils.build_extra_kwargs.html
c75bcfede3a8-0
langchain_core.utils.json_schema.dereference_refs¶ langchain_core.utils.json_schema.dereference_refs(schema_obj: dict, *, full_schema: Optional[dict] = None, skip_keys: Optional[Sequence[str]] = None) → dict[source]¶ Try to substitute $refs in JSON Schema.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.json_schema.dereference_refs.html
ad31bda39130-0
langchain_core.utils.env.env_var_is_set¶ langchain_core.utils.env.env_var_is_set(env_var: str) → bool[source]¶ Check if an environment variable is set. Parameters env_var (str) – The name of the environment variable. Returns True if the environment variable is set, False otherwise. Return type bool
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.env.env_var_is_set.html
3f26d621df34-0
langchain_core.utils.utils.check_package_version¶ langchain_core.utils.utils.check_package_version(package: str, lt_version: Optional[str] = None, lte_version: Optional[str] = None, gt_version: Optional[str] = None, gte_version: Optional[str] = None) → None[source]¶ Check the version of a package.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.utils.check_package_version.html
924f3a769287-0
langchain_core.utils.aiter.py_anext¶ langchain_core.utils.aiter.py_anext(iterator: ~typing.AsyncIterator[~langchain_core.utils.aiter.T], default: ~typing.Union[~langchain_core.utils.aiter.T, ~typing.Any] = <object object>) → Awaitable[Union[T, None, Any]][source]¶ Pure-Python implementation of anext() for testing purpo...
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.aiter.py_anext.html
0e096f69326d-0
langchain_core.utils.utils.xor_args¶ langchain_core.utils.utils.xor_args(*arg_groups: Tuple[str, ...]) → Callable[source]¶ Validate specified keyword args are mutually exclusive.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.utils.xor_args.html
30f38f738f4b-0
langchain_community.utils.openai_functions.FunctionDescription¶ class langchain_community.utils.openai_functions.FunctionDescription[source]¶ Representation of a callable function to the OpenAI API. name: str¶ The name of the function. description: str¶ A description of the function. parameters: dict¶ The parameters of...
https://api.python.langchain.com/en/latest/utils/langchain_community.utils.openai_functions.FunctionDescription.html
d8dd6f17e436-0
langchain.utils.ernie_functions.convert_pydantic_to_ernie_tool¶ langchain.utils.ernie_functions.convert_pydantic_to_ernie_tool(model: Type[BaseModel], *, name: Optional[str] = None, description: Optional[str] = None) → ToolDescription[source]¶ Converts a Pydantic model to a function description for the Ernie API.
https://api.python.langchain.com/en/latest/utils/langchain.utils.ernie_functions.convert_pydantic_to_ernie_tool.html
bef054131439-0
langchain.utils.ernie_functions.FunctionDescription¶ class langchain.utils.ernie_functions.FunctionDescription[source]¶ Representation of a callable function to the Ernie API. name: str¶ The name of the function. description: str¶ A description of the function. parameters: dict¶ The parameters of the function.
https://api.python.langchain.com/en/latest/utils/langchain.utils.ernie_functions.FunctionDescription.html
f1d97297a437-0
langchain_core.utils.html.extract_sub_links¶ langchain_core.utils.html.extract_sub_links(raw_html: str, url: str, *, base_url: Optional[str] = None, pattern: Optional[Union[str, Pattern]] = None, prevent_outside: bool = True, exclude_prefixes: Sequence[str] = ()) → List[str][source]¶ Extract all links from a raw html s...
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.html.extract_sub_links.html
52a76989c230-0
langchain_core.utils.html.find_all_links¶ langchain_core.utils.html.find_all_links(raw_html: str, *, pattern: Optional[Union[str, Pattern]] = None) → List[str][source]¶ Extract all links from a raw html string. Parameters raw_html – original html. pattern – Regex to use for extracting links from raw html. Returns all l...
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.html.find_all_links.html
96b51f8ff640-0
langchain_core.utils.env.get_from_env¶ langchain_core.utils.env.get_from_env(key: str, env_key: str, default: Optional[str] = None) → str[source]¶ Get a value from a dictionary or an environment variable.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.env.get_from_env.html
627f83ef236a-0
langchain_core.utils.input.get_bolded_text¶ langchain_core.utils.input.get_bolded_text(text: str) → str[source]¶ Get bolded text.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.input.get_bolded_text.html
a41054bbf20c-0
langchain_community.utils.math.cosine_similarity_top_k¶ langchain_community.utils.math.cosine_similarity_top_k(X: Union[List[List[float]], List[ndarray], ndarray], Y: Union[List[List[float]], List[ndarray], ndarray], top_k: Optional[int] = 5, score_threshold: Optional[float] = None) → Tuple[List[Tuple[int, int]], List[...
https://api.python.langchain.com/en/latest/utils/langchain_community.utils.math.cosine_similarity_top_k.html
134364e5d87a-0
langchain_core.utils.aiter.NoLock¶ class langchain_core.utils.aiter.NoLock[source]¶ Dummy lock that provides the proper interface but no protection Methods __init__() __init__()¶
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.aiter.NoLock.html
5bd3d19e553f-0
langchain_core.utils.input.print_text¶ langchain_core.utils.input.print_text(text: str, color: Optional[str] = None, end: str = '', file: Optional[TextIO] = None) → None[source]¶ Print text with highlighting and no end characters.
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.input.print_text.html
0e19c97428c5-0
langchain_core.utils.strings.stringify_value¶ langchain_core.utils.strings.stringify_value(val: Any) → str[source]¶ Stringify a value. Parameters val – The value to stringify. Returns The stringified value. Return type str
https://api.python.langchain.com/en/latest/utils/langchain_core.utils.strings.stringify_value.html