id
stringlengths
14
16
text
stringlengths
4
1.28k
source
stringlengths
54
121
0e0436a883fe-611
property lc_secrets: Dict[str, str] Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_KEY”} property lc_serializable: bool Return whether or not the class is serializable.
https://api.python.langchain.com/en/latest/modules/llms.html
f325f365341c-0
Base classes Common schema objects. langchain.schema.get_buffer_string(messages, human_prefix='Human', ai_prefix='AI')[source] Get buffer string of messages. Parameters messages (List[langchain.schema.BaseMessage]) – human_prefix (str) – ai_prefix (str) – Return type str class langchain.schema.AgentAction(tool, to...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-1
Alias for field number 0 log: str Alias for field number 1 count(value, /) Return number of occurrences of value. index(value, start=0, stop=9223372036854775807, /) Return first index of value. Raises ValueError if the value is not present. class langchain.schema.Generation(*, text, generation_info=None)[source] Ba...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-2
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = β€˜allow’ was set since it adds all passed values Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-3
the new model: you should trust this data deep (bool) – set to True to make a deep copy of the model self (Model) – Returns new model instance Return type Model dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False) Generate a dictionar...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-4
Return type DictStrAny json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an opti...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-5
models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters localns (Any) – Return type None property lc_attributes: Dict Return a list of attribute names that should be include...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-6
This class is LangChain serializable. class langchain.schema.BaseMessage(*, content, additional_kwargs=None)[source] Bases: langchain.load.serializable.Serializable Message object. Parameters content (str) – additional_kwargs (dict) – Return type None classmethod construct(_fields_set=None, **values) Creates a new ...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-7
Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include update (Optional[DictStrAny]) – values to change/add in the new ...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-8
Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – Return type DictStrAny json(*, include=None, exclu...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-9
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – encoder (Optional[Callable[[Any], Any]]) – models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode classmethod upda...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-10
Return the namespace of the langchain object. eg. [β€œlangchain”, β€œllms”, β€œopenai”] property lc_secrets: Dict[str, str] Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_KEY”} property lc_serializable: bool This class is LangChain serializable. abstract property type: str Typ...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-11
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = β€˜allow’ was set since it adds all passed values Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-12
the new model: you should trust this data deep (bool) – set to True to make a deep copy of the model self (Model) – Returns new model instance Return type Model dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False) Generate a dictionar...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-13
Return type DictStrAny json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an opti...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-14
models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters localns (Any) – Return type None property lc_attributes: Dict Return a list of attribute names that should be include...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-15
This class is LangChain serializable. property type: str Type of the message, used for serialization. class langchain.schema.AIMessage(*, content, additional_kwargs=None, example=False)[source] Bases: langchain.schema.BaseMessage Type of message that is spoken by the AI. Parameters content (str) – additional_kwargs ...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-16
Return type Model copy(*, include=None, exclude=None, update=None, deep=False) Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model exclude (Optional[Union[AbstractSetIntStr, MappingI...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-17
new model instance Return type Model dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False) Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. Parameters include (Optional[Union[A...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-18
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – exclude (Optional[Union[AbstractSetIntStr, Map...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-19
Return type None property lc_attributes: Dict Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor. property lc_namespace: List[str] Return the namespace of the langchain object. eg. [β€œlangchain”, β€œllms”, β€œopenai”] property lc_secrets:...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-20
Parameters content (str) – additional_kwargs (dict) – Return type None classmethod construct(_fields_set=None, **values) Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = β€˜allow’...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-21
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep (bool...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-22
by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – Return type DictStrAny json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-23
exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – encoder (Optional[Callable[[Any], Any]]) – models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters l...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-24
Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_KEY”} property lc_serializable: bool This class is LangChain serializable. property type: str Type of the message, used for serialization. class langchain.schema.FunctionMessage(*, content, additional_kwargs=None, name)[sourc...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-25
Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy(*, include=None, exclude=None, update=None, deep=False) Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in ...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-26
new model instance Return type Model dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False) Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. Parameters include (Optional[Union[A...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-27
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – exclude (Optional[Union[AbstractSetIntStr, Map...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-28
Return type None property lc_attributes: Dict Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor. property lc_namespace: List[str] Return the namespace of the langchain object. eg. [β€œlangchain”, β€œllms”, β€œopenai”] property lc_secrets:...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-29
Type of message with arbitrary speaker. Parameters content (str) – additional_kwargs (dict) – role (str) – Return type None classmethod construct(_fields_set=None, **values) Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validat...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-30
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep (bool...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-31
by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – Return type DictStrAny json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-32
exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – encoder (Optional[Callable[[Any], Any]]) – models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters l...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-33
Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_KEY”} property lc_serializable: bool This class is LangChain serializable. property type: str Type of the message, used for serialization. langchain.schema.messages_to_dict(messages)[source] Convert messages to dict. Paramet...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-34
Bases: langchain.schema.Generation Output of a single generation. Parameters text (str) – generation_info (Optional[Dict[str, Any]]) – message (langchain.schema.BaseMessage) – Return type None attribute generation_info: Optional[Dict[str, Any]] = None Raw generation info response from the provider attribute text: s...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-35
Return type Model copy(*, include=None, exclude=None, update=None, deep=False) Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model exclude (Optional[Union[AbstractSetIntStr, MappingI...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-36
new model instance Return type Model dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False) Generate a dictionary representation of the model, optionally specifying which fields to include or exclude. Parameters include (Optional[Union[A...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-37
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – exclude (Optional[Union[AbstractSetIntStr, Map...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-38
Return type None property lc_attributes: Dict Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor. property lc_namespace: List[str] Return the namespace of the langchain object. eg. [β€œlangchain”, β€œllms”, β€œopenai”] property lc_secrets:...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-39
Return type None classmethod construct(_fields_set=None, **values) Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = β€˜allow’ was set since it adds all passed values Parameters _fie...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-40
update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep (bool) – set to True to make a deep copy of the model self (Model) – Returns new model instance Return type Model dict(*, include=None, exclude=None, by_...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-41
exclude_defaults (bool) – exclude_none (bool) – Return type DictStrAny json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representation of the model, include and e...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-42
exclude_none (bool) – encoder (Optional[Callable[[Any], Any]]) – models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters localns (Any) – Return type None class langchain.sc...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-43
List of the things generated. attribute llm_output: Optional[dict] = None For arbitrary LLM provider specific output. classmethod construct(_fields_set=None, **values) Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is p...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-44
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep (bool...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-45
by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – Return type DictStrAny json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-46
exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – encoder (Optional[Callable[[Any], Any]]) – models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters l...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-47
Return type None attribute generations: List[List[langchain.schema.Generation]] [Required] List of the things generated. This is List[List[]] because each input could have multiple generations. attribute llm_output: Optional[dict] = None For arbitrary LLM provider specific output. attribute run: Optional[List[langcha...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-48
Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in new model exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes preced...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-49
Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – Return type DictStrAny flatten()[source] Flatten ...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-50
encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bo...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-51
Bases: langchain.load.serializable.Serializable, abc.ABC Return type None classmethod construct(_fields_set=None, **values) Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behaves as if Config.extra = β€˜allow...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-52
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep (bool...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-53
by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – Return type DictStrAny json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-54
exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – encoder (Optional[Callable[[Any], Any]]) – models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode abstract to_messages()[source] Return prompt as messages. Return type List[langchain.schema.BaseMessage] abstract to_string()[source]...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-55
property lc_namespace: List[str] Return the namespace of the langchain object. eg. [β€œlangchain”, β€œllms”, β€œopenai”] property lc_secrets: Dict[str, str] Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_KEY”} property lc_serializable: bool Return whether or not the class is s...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-56
Default values are respected, but no other validation is performed. Behaves as if Config.extra = β€˜allow’ was set since it adds all passed values Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy(*, include=None, exclude=None, update=None, deep=False) Duplicate a model, optionally choo...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-57
the new model: you should trust this data deep (bool) – set to True to make a deep copy of the model self (Model) – Returns new model instance Return type Model dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False) Generate a dictionar...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-58
Return type DictStrAny json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an opti...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-59
models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode abstract load_memory_variables(inputs)[source] Return key-value pairs given the text input to the chain. If None, return all memories Parameters inputs (Dict[str, Any]) – Return type Dict[str, Any] abstract save_context(inputs, outputs)[source] Save ...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-60
serialized kwargs. These attributes must be accepted by the constructor. property lc_namespace: List[str] Return the namespace of the langchain object. eg. [β€œlangchain”, β€œllms”, β€œopenai”] property lc_secrets: Dict[str, str] Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_K...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-61
message (str) – Return type None add_ai_message(message)[source] Add an AI message to the store Parameters message (str) – Return type None add_message(message)[source] Add a self-created message to the store Parameters message (langchain.schema.BaseMessage) – Return type None abstract clear()[source] Remove all ...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-62
Default values are respected, but no other validation is performed. Behaves as if Config.extra = β€˜allow’ was set since it adds all passed values Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy(*, include=None, exclude=None, update=None, deep=False) Duplicate a model, optionally choo...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-63
the new model: you should trust this data deep (bool) – set to True to make a deep copy of the model self (Model) – Returns new model instance Return type Model dict(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False) Generate a dictionar...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-64
Return type DictStrAny json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True, **dumps_kwargs) Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an opti...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-65
models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode classmethod update_forward_refs(**localns) Try to update ForwardRefs on fields based on this Model, globalns and localns. Parameters localns (Any) – Return type None property lc_attributes: Dict Return a list of attribute names that should be include...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-66
property lc_serializable: bool Return whether or not the class is serializable. class langchain.schema.BaseRetriever[source] Bases: abc.ABC Base interface for retrievers. abstract get_relevant_documents(query)[source] Get documents relevant for a query. Parameters query (str) – string to find relevant documents for ...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-67
Bases: langchain.load.serializable.Serializable, abc.ABC, Generic[langchain.schema.T] Return type None classmethod construct(_fields_set=None, **values) Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. Behave...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-68
exclude (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to exclude from new model, as with values this takes precedence over include update (Optional[DictStrAny]) – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep (bool...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-69
by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – Return type DictStrAny json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_defaults=False, exclude_none=False, encoder=None, models_as_dict=True...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-70
exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – encoder (Optional[Callable[[Any], Any]]) – models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode abstract parse_result(result)[source] Parse LLM Result. Parameters result (List[langchain.schema.Generation]) – Return type langchain...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-71
Return the namespace of the langchain object. eg. [β€œlangchain”, β€œllms”, β€œopenai”] property lc_secrets: Dict[str, str] Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_KEY”} property lc_serializable: bool Return whether or not the class is serializable. class langchain.schem...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-72
Behaves as if Config.extra = β€˜allow’ was set since it adds all passed values Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy(*, include=None, exclude=None, update=None, deep=False) Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include (...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-73
self (Model) – Returns new model instance Return type Model dict(**kwargs)[source] Return dictionary representation of output parser. Parameters kwargs (Any) – Return type Dict get_format_instructions()[source] Instructions on how the LLM output should be formatted. Return type str json(*, include=None, exclude=Non...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-74
by_alias (bool) – skip_defaults (Optional[bool]) – exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – encoder (Optional[Callable[[Any], Any]]) – models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode abstract parse(text)[source] Parse the output of an LLM call. A method which take...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-75
Optional method to parse the output of an LLM call with a prompt. The prompt is largely provided in the event the OutputParser wants to retry or fix the output in some way, and needs information from the prompt to do so. Parameters completion (str) – output of language model prompt (langchain.schema.PromptValue) – prom...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-76
Return the namespace of the langchain object. eg. [β€œlangchain”, β€œllms”, β€œopenai”] property lc_secrets: Dict[str, str] Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_KEY”} property lc_serializable: bool Return whether or not the class is serializable. class langchain.schem...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-77
Parameters _fields_set (Optional[SetStr]) – values (Any) – Return type Model copy(*, include=None, exclude=None, update=None, deep=False) Duplicate a model, optionally choose which fields to include, exclude and change. Parameters include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) – fields to include in ...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-78
Model dict(**kwargs) Return dictionary representation of output parser. Parameters kwargs (Any) – Return type Dict get_format_instructions() Instructions on how the LLM output should be formatted. Return type str json(*, include=None, exclude=None, by_alias=False, skip_defaults=None, exclude_unset=False, exclude_def...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-79
skip_defaults (Optional[bool]) – exclude_unset (bool) – exclude_defaults (bool) – exclude_none (bool) – encoder (Optional[Callable[[Any], Any]]) – models_as_dict (bool) – dumps_kwargs (Any) – Return type unicode parse(text)[source] Parse the output of an LLM call. A method which takes in a string (assumed outpu...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-80
The prompt is largely provided in the event the OutputParser wants to retry or fix the output in some way, and needs information from the prompt to do so. Parameters completion (str) – output of language model prompt (langchain.schema.PromptValue) – prompt value Returns structured output Return type Any classmethod upd...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-81
Return a map of constructor argument names to secret ids. eg. {β€œopenai_api_key”: β€œOPENAI_API_KEY”} property lc_serializable: bool Return whether or not the class is serializable. exception langchain.schema.OutputParserException(error, observation=None, llm_output=None, send_to_llm=False)[source] Bases: ValueError Exc...
https://api.python.langchain.com/en/latest/modules/base_classes.html
f325f365341c-82
Exception.add_note(note) – add a note to the exception with_traceback() Exception.with_traceback(tb) – set self.__traceback__ to tb and return self. class langchain.schema.BaseDocumentTransformer[source] Bases: abc.ABC Base interface for transforming documents. abstract transform_documents(documents, **kwargs)[source...
https://api.python.langchain.com/en/latest/modules/base_classes.html
07ceff43f477-0
Chains Chains are easily reusable components which can be linked together. class langchain.chains.APIChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, api_request_chain, api_answer_chain, requests_wrapper, api_docs, question_key='question', output_key='output')[source] Bases: langc...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-1
api_answer_chain (langchain.chains.llm.LLMChain) – requests_wrapper (langchain.requests.TextRequestsWrapper) – api_docs (str) – question_key (str) – output_key (str) – Return type None attribute api_answer_chain: LLMChain [Required] attribute api_docs: str [Required] attribute api_request_chain: LLMChain [Requir...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-2
for full details. attribute memory: Optional[BaseMemory] = None Optional memory object. Defaults to None. Memory is a class that gets called at the start and at the end of every chain. At the start, memory loads variables and passes them along in the chain. At the end, it saves any returned variables. There are many d...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-3
will be printed to the console. Defaults to langchain.verbose value. async acall(inputs, return_only_outputs=False, callbacks=None, *, tags=None, include_run_info=False) Run the logic of this chain and add to output if desired. Parameters inputs (Union[Dict[str, Any], Any]) – Dictionary of inputs, or single input if c...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-4
use the callbacks provided to the chain. include_run_info (bool) – Whether to include run info in the response. Defaults to False. tags (Optional[List[str]]) – Return type Dict[str, Any] apply(input_list, callbacks=None) Call the chain on all inputs in the list. Parameters input_list (List[Dict[str, Any]]) – callbac...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-5
tags (Optional[List[str]]) – kwargs (Any) – Return type str dict(**kwargs) Return dictionary representation of chain. Parameters kwargs (Any) – Return type Dict
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-6
classmethod from_llm_and_api_docs(llm, api_docs, headers=None, api_url_prompt=PromptTemplate(input_variables=['api_docs', 'question'], output_parser=None, partial_variables={}, template='You are given the below API Documentation:\n{api_docs}\nUsing this documentation, generate the full API url to call for answering the...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-7
the full API url to call for answering the user question.\nYou should build the API url in order to get a response that is as short as possible, while still getting the necessary information to answer the question. Pay attention to deliberately exclude any unnecessary pieces of data in the API call.\n\nQuestion:{questi...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-8
Load chain from just an LLM and the api docs. Parameters llm (langchain.base_language.BaseLanguageModel) – api_docs (str) – headers (Optional[dict]) – api_url_prompt (langchain.prompts.base.BasePromptTemplate) – api_response_prompt (langchain.prompts.base.BasePromptTemplate) – kwargs (Any) – Return type langchain...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-9
Return type Dict[str, str] run(*args, callbacks=None, tags=None, **kwargs) Run the chain as text in, text out or multiple variables, text out. Parameters args (Any) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – tags (Optional[List[st...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-10
to_json_not_implemented() Return type langchain.load.serializable.SerializedNotImplemented property lc_attributes: Dict Return a list of attribute names that should be included in the serialized kwargs. These attributes must be accepted by the constructor. property lc_namespace: List[str] Return the namespace of the...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-11
class langchain.chains.AnalyzeDocumentChain(*, memory=None, callbacks=None, callback_manager=None, verbose=None, tags=None, input_key='input_document', text_splitter=None, combine_docs_chain)[source] Bases: langchain.chains.base.Chain Chain that splits documents, then analyzes it in pieces. Parameters memory (Optional...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-12
Return type None attribute callback_manager: Optional[BaseCallbackManager] = None Deprecated, use callbacks instead. attribute callbacks: Callbacks = None Optional list of callback handlers (or callback manager). Defaults to None. Callback handlers are called throughout the lifecycle of a call to a chain, starting wi...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-13
There are many different types of memory - please see memory docs for the full catalog. attribute tags: Optional[List[str]] = None Optional list of tags associated with the chain. Defaults to None These tags will be associated with each call to this chain, and passed as arguments to the handlers defined in callbacks. ...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-14
Parameters inputs (Union[Dict[str, Any], Any]) – Dictionary of inputs, or single input if chain expects only one param. return_only_outputs (bool) – boolean for whether to return only outputs in the response. If True, only new keys generated by this chain will be returned. If False, both input keys and new keys generat...
https://api.python.langchain.com/en/latest/modules/chains.html
07ceff43f477-15
Parameters input_list (List[Dict[str, Any]]) – callbacks (Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]) – Return type List[Dict[str, str]] async arun(*args, callbacks=None, tags=None, **kwargs) Run the chain as text in, text out or multiple variabl...
https://api.python.langchain.com/en/latest/modules/chains.html