id stringlengths 14 16 | text stringlengths 13 2.7k | source stringlengths 57 178 |
|---|---|---|
d2f9ba547695-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... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.brave_search.BraveSearchWrapper.html |
d2f9ba547695-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¶
run(query: str) → str[source]¶
Query the Brave search engine and return the results as a JSON string.
Parameters
... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.brave_search.BraveSearchWrapper.html |
052815778da4-0 | langchain.utilities.spark_sql.SparkSQL¶
class langchain.utilities.spark_sql.SparkSQL(spark_session: Optional[SparkSession] = None, catalog: Optional[str] = None, schema: Optional[str] = None, ignore_tables: Optional[List[str]] = None, include_tables: Optional[List[str]] = None, sample_rows_in_table_info: int = 3)[sourc... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.spark_sql.SparkSQL.html |
052815778da4-1 | Execute a SQL command and return a string representing the results.
__init__(spark_session: Optional[SparkSession] = None, catalog: Optional[str] = None, schema: Optional[str] = None, ignore_tables: Optional[List[str]] = None, include_tables: Optional[List[str]] = None, sample_rows_in_table_info: int = 3)[source]¶
Init... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.spark_sql.SparkSQL.html |
052815778da4-2 | demonstrated in the paper.
get_usable_table_names() → Iterable[str][source]¶
Get names of tables available.
run(command: str, fetch: str = 'all') → str[source]¶
run_no_throw(command: str, fetch: str = 'all') → str[source]¶
Execute a SQL command and return a string representing the results.
If the statement returns rows... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.spark_sql.SparkSQL.html |
6ed5f724386c-0 | langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper¶
class langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper[source]¶
Bases: BaseModel
Wrapper for Metaphor Search API.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be p... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper.html |
6ed5f724386c-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... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper.html |
6ed5f724386c-2 | results(query: str, num_results: int, include_domains: Optional[List[str]] = None, exclude_domains: Optional[List[str]] = None, start_crawl_date: Optional[str] = None, end_crawl_date: Optional[str] = None, start_published_date: Optional[str] = None, end_published_date: Optional[str] = None, use_autoprompt: Optional[boo... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper.html |
6ed5f724386c-3 | Return type
A list of dictionaries with the following keys
async results_async(query: str, num_results: int, include_domains: Optional[List[str]] = None, exclude_domains: Optional[List[str]] = None, start_crawl_date: Optional[str] = None, end_crawl_date: Optional[str] = None, start_published_date: Optional[str] = None,... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.metaphor_search.MetaphorSearchAPIWrapper.html |
5e8abc1c1b08-0 | langchain.utilities.powerbi.json_to_md¶
langchain.utilities.powerbi.json_to_md(json_contents: List[Dict[str, Union[str, float, int]]], table_name: Optional[str] = None) → str[source]¶
Converts a JSON object to a markdown table. | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.powerbi.json_to_md.html |
4166258a0d9d-0 | langchain.utilities.google_serper.GoogleSerperAPIWrapper¶
class langchain.utilities.google_serper.GoogleSerperAPIWrapper[source]¶
Bases: BaseModel
Wrapper around the Serper.dev Google Search API.
You can create a free API key at https://serper.dev.
To use, you should have the environment variable SERPER_API_KEY
set wit... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.google_serper.GoogleSerperAPIWrapper.html |
4166258a0d9d-1 | 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] = None, deep: bool = False) → Model¶
Duplicate a model, optionally... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.google_serper.GoogleSerperAPIWrapper.html |
4166258a0d9d-2 | classmethod from_orm(obj: Any) → Model¶
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_defaults: bool = False, exclude_n... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.google_serper.GoogleSerperAPIWrapper.html |
4166258a0d9d-3 | Try to update ForwardRefs on fields based on this Model, globalns and localns.
classmethod validate(value: Any) → Model¶
Examples using GoogleSerperAPIWrapper¶
Google Serper
Retrieve as you generate with FLARE | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.google_serper.GoogleSerperAPIWrapper.html |
c2395a7fc578-0 | langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper¶
class langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper[source]¶
Bases: BaseModel
Wrapper for Wolfram Alpha.
Docs for using:
Go to wolfram alpha and sign up for a developer account
Create an app and get your APP ID
Save your APP ID into WOLFRAM_ALPHA_APPI... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper.html |
c2395a7fc578-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... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper.html |
c2395a7fc578-2 | run(query: str) → str[source]¶
Run query through WolframAlpha and parse result.
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
clas... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.wolfram_alpha.WolframAlphaAPIWrapper.html |
4dd5b3c06b21-0 | langchain.utilities.python.PythonREPL¶
class langchain.utilities.python.PythonREPL[source]¶
Bases: BaseModel
Simulates a standalone Python REPL.
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 globals:... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.python.PythonREPL.html |
4dd5b3c06b21-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... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.python.PythonREPL.html |
4dd5b3c06b21-2 | run(command: str, timeout: Optional[int] = None) → str[source]¶
Run command with own globals/locals and returns anything printed.
Timeout after the specified number of seconds.
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmethod schema_json(*, by_alias: b... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.python.PythonREPL.html |
6fcac1005765-0 | langchain.utilities.tensorflow_datasets.TensorflowDatasets¶
class langchain.utilities.tensorflow_datasets.TensorflowDatasets[source]¶
Bases: BaseModel
Access to the TensorFlow Datasets.
The Current implementation can work only with datasets that fit in a memory.
TensorFlow Datasets is a collection of datasets ready to ... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.tensorflow_datasets.TensorflowDatasets.html |
6fcac1005765-1 | )
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 dataset_name: str = ''¶
param load_max_docs: int = 100¶
param sample_to_document_function: Optional[Callable[[Dict], langchain.schema.document.Document... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.tensorflow_datasets.TensorflowDatasets.html |
6fcac1005765-2 | 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... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.tensorflow_datasets.TensorflowDatasets.html |
6fcac1005765-3 | 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... | lang/api.python.langchain.com/en/latest/utilities/langchain.utilities.tensorflow_datasets.TensorflowDatasets.html |
8180e0102889-0 | langchain_experimental.pal_chain.base.PALChain¶
class langchain_experimental.pal_chain.base.PALChain[source]¶
Bases: Chain
Implements Program-Aided Language Models (PAL).
This class implements the Program-Aided Language Models (PAL) for generating code
solutions. PAL is a technique described in the paper “Program-Aided... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-1 | param llm_chain: LLMChain [Required]¶
param 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.
... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-2 | will be printed to the console. Defaults to the global verbose value,
accessible via langchain.globals.get_verbose().
__call__(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, me... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-3 | Default implementation runs ainvoke in parallel using asyncio.gather.
The default implementation of batch works well for IO bound runnables.
Subclasses should override this method if they can batch more efficiently;
e.g., if the underlying runnable uses an API which supports a batch mode.
async acall(inputs: Union[Dict... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-4 | Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async ainvoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None, **kwargs: Any) → Dict[str, Any]¶
Default implementation of ainvoke, calls invoke from a thread.
The default implementation allows usage of async code e... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-5 | directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'question' string:
await chain.arun("What's the temperature in Boise, Idaho?")
# -> "The temperature in Boise is..."
# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' s... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-6 | The jsonpatch ops can be applied in order to construct state.
async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → AsyncIterator[Output]¶
Default implementation of atransform, which buffers input and calls astream.
Subclasses should override this method if th... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-7 | classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
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... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-8 | Returns
An instance of PALChain.
Return type
PALChain
classmethod from_math_prompt(llm: BaseLanguageModel, **kwargs: Any) → PALChain[source]¶
Load PAL from math prompt.
Parameters
llm (BaseLanguageModel) – The language model to use for generating code.
Returns
An instance of PALChain.
Return type
PALChain
classmethod f... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-9 | Returns
A pydantic model that can be used to validate output.
invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None, **kwargs: Any) → Dict[str, Any]¶
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 r... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-10 | 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... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-11 | The main difference between this method and Chain.__call__ is that this
method expects inputs to be passed directly in as positional arguments or
keyword arguments, whereas Chain.__call__ expects a single input dictionary
with all the inputs
Parameters
*args – If the chain expects a single input, it can be passed in as... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-12 | 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... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-13 | 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 ... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
8180e0102889-14 | The type of output this runnable produces specified as a type annotation.
property config_specs: List[langchain.schema.runnable.utils.ConfigurableFieldSpec]¶
List configurable fields for this runnable.
property input_schema: Type[pydantic.main.BaseModel]¶
The type of input this runnable accepts specified as a pydantic ... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
e878749b31ff-0 | langchain_experimental.pal_chain.base.PALValidation¶
class langchain_experimental.pal_chain.base.PALValidation(solution_expression_name: Optional[str] = None, solution_expression_type: Optional[type] = None, allow_imports: bool = False, allow_command_exec: bool = False)[source]¶
Initialize a PALValidation instance.
Par... | lang/api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALValidation.html |
7e841b2c5d42-0 | langchain.document_transformers.embeddings_redundant_filter.get_stateful_documents¶
langchain.document_transformers.embeddings_redundant_filter.get_stateful_documents(documents: Sequence[Document]) → Sequence[_DocumentWithState][source]¶
Convert a list of documents to a list of documents with state.
Parameters
document... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.get_stateful_documents.html |
0306e9b7524b-0 | langchain.document_transformers.html2text.Html2TextTransformer¶
class langchain.document_transformers.html2text.Html2TextTransformer(ignore_links: bool = True, ignore_images: bool = True)[source]¶
Replace occurrences of a particular search pattern with a replacement string
Parameters
ignore_links – Whether links should... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.html2text.Html2TextTransformer.html |
c0eb6624d515-0 | langchain.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter¶
class langchain.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter[source]¶
Bases: BaseDocumentTransformer, BaseModel
Filter that drops redundant documents by comparing their embeddings.
Create a new model by... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter.html |
c0eb6624d515-1 | Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters
include – fields to include in new model
exclude – fields to exclude from new model, as with values this takes precedence over include
update – values to change/add in the new model. Note: the data is not validated before creat... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter.html |
c0eb6624d515-2 | 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 = None, encoding: unicode = 'utf8', proto... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter.html |
f804010546c2-0 | langchain.document_transformers.openai_functions.OpenAIMetadataTagger¶
class langchain.document_transformers.openai_functions.OpenAIMetadataTagger[source]¶
Bases: BaseDocumentTransformer, BaseModel
Extract metadata tags from document contents using OpenAI functions.
Example:from langchain.chat_models import ChatOpenAI
... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.OpenAIMetadataTagger.html |
f804010546c2-1 | Raises ValidationError if the input data cannot be parsed to form a valid model.
param tagging_chain: langchain.chains.llm.LLMChain [Required]¶
The chain used to extract metadata from each document.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document][source]¶
Asynchronously tra... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.OpenAIMetadataTagger.html |
f804010546c2-2 | 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... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.OpenAIMetadataTagger.html |
f804010546c2-3 | classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Documen... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.OpenAIMetadataTagger.html |
ca0870a0ec3e-0 | langchain.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer¶
class langchain.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer[source]¶
Transform HTML content by extracting specific tags and removing unwanted ones.
Example
Initialize the transformer.
This checks if the Be... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer.html |
ca0870a0ec3e-1 | Returns
A cleaned string with unnecessary lines removed.
static remove_unwanted_tags(html_content: str, unwanted_tags: List[str]) → str[source]¶
Remove unwanted tags from a given HTML content.
Parameters
html_content – The original HTML content string.
unwanted_tags – A list of tags to be removed from the HTML.
Returns... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer.html |
a0cab05eadf7-0 | langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter¶
class langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter[source]¶
Bases: BaseDocumentTransformer, BaseModel
Perform K-means clustering on document vectors.
Returns an arbitrary number of documents... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter.html |
a0cab05eadf7-1 | documents – A sequence of Documents to be transformed.
Returns
A list of transformed Documents.
classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → Model¶
Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.
Default values are respected, but no other valid... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter.html |
a0cab05eadf7-2 | classmethod from_orm(obj: Any) → Model¶
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_defaults: bool = False, exclude_n... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter.html |
a0cab05eadf7-3 | classmethod validate(value: Any) → Model¶
Examples using EmbeddingsClusteringFilter¶
LOTR (Merger Retriever) | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.embeddings_redundant_filter.EmbeddingsClusteringFilter.html |
9ce36987d003-0 | langchain.document_transformers.beautiful_soup_transformer.get_navigable_strings¶
langchain.document_transformers.beautiful_soup_transformer.get_navigable_strings(element: Any) → Iterator[str][source]¶ | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.beautiful_soup_transformer.get_navigable_strings.html |
3b80ccfdaca3-0 | langchain.document_transformers.doctran_text_extract.DoctranPropertyExtractor¶
class langchain.document_transformers.doctran_text_extract.DoctranPropertyExtractor(properties: List[dict], openai_api_key: Optional[str] = None, openai_api_model: Optional[str] = None)[source]¶
Extract properties from text documents using d... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.doctran_text_extract.DoctranPropertyExtractor.html |
3b80ccfdaca3-1 | Methods
__init__(properties[, openai_api_key, ...])
atransform_documents(documents, **kwargs)
Extracts properties from text documents using doctran.
transform_documents(documents, **kwargs)
Transform a list of documents.
__init__(properties: List[dict], openai_api_key: Optional[str] = None, openai_api_model: Optional[s... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.doctran_text_extract.DoctranPropertyExtractor.html |
589345c8795e-0 | langchain.document_transformers.nuclia_text_transform.NucliaTextTransformer¶
class langchain.document_transformers.nuclia_text_transform.NucliaTextTransformer(nua: NucliaUnderstandingAPI)[source]¶
The Nuclia Understanding API splits into paragraphs and sentences,
identifies entities, provides a summary of the text and ... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.nuclia_text_transform.NucliaTextTransformer.html |
b0b4eada3c0e-0 | langchain.document_transformers.long_context_reorder.LongContextReorder¶
class langchain.document_transformers.long_context_reorder.LongContextReorder[source]¶
Bases: BaseDocumentTransformer, BaseModel
Lost in the middle:
Performance degrades when models must access relevant information
in the middle of long contexts.
... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.long_context_reorder.LongContextReorder.html |
b0b4eada3c0e-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... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.long_context_reorder.LongContextReorder.html |
b0b4eada3c0e-2 | classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Documen... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.long_context_reorder.LongContextReorder.html |
6efce921486c-0 | langchain.document_transformers.doctran_text_qa.DoctranQATransformer¶
class langchain.document_transformers.doctran_text_qa.DoctranQATransformer(openai_api_key: Optional[str] = None, openai_api_model: Optional[str] = None)[source]¶
Extract QA from text documents using doctran.
Parameters
openai_api_key – OpenAI API key... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.doctran_text_qa.DoctranQATransformer.html |
1e39aaf085b8-0 | langchain.document_transformers.doctran_text_translate.DoctranTextTranslator¶
class langchain.document_transformers.doctran_text_translate.DoctranTextTranslator(openai_api_key: Optional[str] = None, language: str = 'english', openai_api_model: Optional[str] = None)[source]¶
Translate text documents using doctran.
Param... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.doctran_text_translate.DoctranTextTranslator.html |
a1d795b26b6b-0 | langchain.document_transformers.openai_functions.create_metadata_tagger¶
langchain.document_transformers.openai_functions.create_metadata_tagger(metadata_schema: Union[Dict[str, Any], Type[BaseModel]], llm: BaseLanguageModel, prompt: Optional[ChatPromptTemplate] = None, *, tagging_chain_kwargs: Optional[Dict] = None) →... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.create_metadata_tagger.html |
a1d795b26b6b-1 | }
# Must be an OpenAI model that supports functions
llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo-0613")
document_transformer = create_metadata_tagger(schema, llm)
original_documents = [
Document(page_content="Review of The Bee Movie
By Roger Ebert
This is the greatest movie ever made. 4 out of 5 stars.”),Do... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.openai_functions.create_metadata_tagger.html |
0e49691eb9bc-0 | langchain.document_transformers.google_translate.GoogleTranslateTransformer¶
class langchain.document_transformers.google_translate.GoogleTranslateTransformer(project_id: str, *, location: str = 'global', model_id: Optional[str] = None, glossary_id: Optional[str] = None, api_endpoint: Optional[str] = None)[source]¶
Tra... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.google_translate.GoogleTranslateTransformer.html |
0e49691eb9bc-1 | Translate text documents using Google Translate.
Parameters
source_language_code – ISO 639 language code of the input document.
target_language_code – ISO 639 language code of the output document.
For supported languages, refer to:
https://cloud.google.com/translate/docs/languages
mime_type – (Optional) Media Type of i... | lang/api.python.langchain.com/en/latest/document_transformers/langchain.document_transformers.google_translate.GoogleTranslateTransformer.html |
d18638b0af75-0 | langchain.memory.readonly.ReadOnlySharedMemory¶
class langchain.memory.readonly.ReadOnlySharedMemory[source]¶
Bases: BaseMemory
A memory wrapper that is read-only and cannot be changed.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be par... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.readonly.ReadOnlySharedMemory.html |
d18638b0af75-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... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.readonly.ReadOnlySharedMemory.html |
d18638b0af75-2 | The unique identifier is a list of strings that describes the path
to the object.
load_memory_variables(inputs: Dict[str, Any]) → Dict[str, str][source]¶
Load memory variables from memory.
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None,... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.readonly.ReadOnlySharedMemory.html |
cfc736f8d91a-0 | langchain.memory.motorhead_memory.MotorheadMemory¶
class langchain.memory.motorhead_memory.MotorheadMemory[source]¶
Bases: BaseChatMemory
Chat message memory backed by Motorhead service.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be pa... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.motorhead_memory.MotorheadMemory.html |
cfc736f8d91a-1 | exclude – fields to exclude from new model, as with values this takes precedence over include
update – 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 – set to True to make a deep copy of the model
Returns
new model instance
delete_se... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.motorhead_memory.MotorheadMemory.html |
cfc736f8d91a-2 | 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().
classmethod lc_id() → List[str]¶
A unique identifier for this class for serialization purposes.
The unique identifier is a ... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.motorhead_memory.MotorheadMemory.html |
cfc736f8d91a-3 | These attributes must be accepted by the constructor.
property lc_secrets: Dict[str, str]¶
A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property memory_variables: List[str]¶
The string keys this memory class will add to chain inputs.
Examples using MotorheadMemory¶... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.motorhead_memory.MotorheadMemory.html |
d5e8156166b4-0 | langchain.memory.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory¶
class langchain.memory.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory(cosmos_endpoint: str, cosmos_database: str, cosmos_container: str, session_id: str, user_id: str, credential: Any = None, connection_string: Optional[str] = No... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory.html |
d5e8156166b4-1 | Convenience method for adding a human message string to the store.
clear()
Clear session memory from this memory and cosmos.
load_messages()
Retrieve the messages from Cosmos
prepare_cosmos()
Prepare the CosmosDB client.
upsert_messages()
Update the cosmosdb item.
__init__(cosmos_endpoint: str, cosmos_database: str, co... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory.html |
d5e8156166b4-2 | Convenience method for adding a human message string to the store.
Parameters
message – The string contents of a human message.
clear() → None[source]¶
Clear session memory from this memory and cosmos.
load_messages() → None[source]¶
Retrieve the messages from Cosmos
prepare_cosmos() → None[source]¶
Prepare the CosmosD... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.cosmos_db.CosmosDBChatMessageHistory.html |
bcbdad36fc58-0 | langchain.memory.buffer_window.ConversationBufferWindowMemory¶
class langchain.memory.buffer_window.ConversationBufferWindowMemory[source]¶
Bases: BaseChatMemory
Buffer for storing conversation memory inside a limited size window.
Create a new model by parsing and validating input data from keyword arguments.
Raises Va... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.buffer_window.ConversationBufferWindowMemory.html |
bcbdad36fc58-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... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.buffer_window.ConversationBufferWindowMemory.html |
bcbdad36fc58-2 | The unique identifier is a list of strings that describes the path
to the object.
load_memory_variables(inputs: Dict[str, Any]) → Dict[str, Any][source]¶
Return history buffer.
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickl... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.buffer_window.ConversationBufferWindowMemory.html |
bcbdad36fc58-3 | List of attribute names that should be included in the serialized kwargs.
These attributes must be accepted by the constructor.
property lc_secrets: Dict[str, str]¶
A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
Examples using ConversationBufferWindowMemory¶
Figma
Op... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.buffer_window.ConversationBufferWindowMemory.html |
b4ef72c35814-0 | langchain.memory.chat_message_histories.firestore.FirestoreChatMessageHistory¶
class langchain.memory.chat_message_histories.firestore.FirestoreChatMessageHistory(collection_name: str, session_id: str, user_id: str, firestore_client: Optional[Client] = None)[source]¶
Chat message history backed by Google Firestore.
Ini... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.firestore.FirestoreChatMessageHistory.html |
b4ef72c35814-1 | Add a Message object to the store.
Parameters
message – A BaseMessage object to store.
add_user_message(message: str) → None¶
Convenience method for adding a human message string to the store.
Parameters
message – The string contents of a human message.
clear() → None[source]¶
Clear session memory from this memory and ... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.firestore.FirestoreChatMessageHistory.html |
5562c58242ae-0 | langchain.memory.entity.InMemoryEntityStore¶
class langchain.memory.entity.InMemoryEntityStore[source]¶
Bases: BaseEntityStore
In-memory Entity store.
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 st... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.InMemoryEntityStore.html |
5562c58242ae-1 | delete(key: str) → None[source]¶
Delete entity value from store.
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, exclude_defaults... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.InMemoryEntityStore.html |
5562c58242ae-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... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.entity.InMemoryEntityStore.html |
103ab843c0a1-0 | langchain.memory.chat_message_histories.sql.DefaultMessageConverter¶
class langchain.memory.chat_message_histories.sql.DefaultMessageConverter(table_name: str)[source]¶
The default message converter for SQLChatMessageHistory.
Methods
__init__(table_name)
from_sql_model(sql_message)
Convert a SQLAlchemy model to a BaseM... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.sql.DefaultMessageConverter.html |
bd28147facf7-0 | langchain.memory.token_buffer.ConversationTokenBufferMemory¶
class langchain.memory.token_buffer.ConversationTokenBufferMemory[source]¶
Bases: BaseChatMemory
Conversation chat memory with token limit.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input dat... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.token_buffer.ConversationTokenBufferMemory.html |
bd28147facf7-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... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.token_buffer.ConversationTokenBufferMemory.html |
bd28147facf7-2 | A unique identifier for this class for serialization purposes.
The unique identifier is a list of strings that describes the path
to the object.
load_memory_variables(inputs: Dict[str, Any]) → Dict[str, Any][source]¶
Return history buffer.
classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, ... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.token_buffer.ConversationTokenBufferMemory.html |
bd28147facf7-3 | property lc_attributes: Dict¶
List of attribute names that should be included in the serialized kwargs.
These attributes must be accepted by the constructor.
property lc_secrets: Dict[str, str]¶
A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
Examples using Conversati... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.token_buffer.ConversationTokenBufferMemory.html |
1d0c0ff2c05d-0 | langchain.memory.chat_message_histories.momento.MomentoChatMessageHistory¶
class langchain.memory.chat_message_histories.momento.MomentoChatMessageHistory(session_id: str, cache_client: momento.CacheClient, cache_name: str, *, key_prefix: str = 'message_store:', ttl: Optional[timedelta] = None, ensure_cache_exists: boo... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.momento.MomentoChatMessageHistory.html |
1d0c0ff2c05d-1 | add_message(message)
Store a message in the cache.
add_user_message(message)
Convenience method for adding a human message string to the store.
clear()
Remove the session's messages from the cache.
from_client_params(session_id, cache_name, ...)
Construct cache from CacheClient parameters.
__init__(session_id: str, cac... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.momento.MomentoChatMessageHistory.html |
1d0c0ff2c05d-2 | Store a message in the cache.
Parameters
message (BaseMessage) – The message object to store.
Raises
SdkException – Momento service or network error.
Exception – Unexpected response.
add_user_message(message: str) → None¶
Convenience method for adding a human message string to the store.
Parameters
message – The string... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.momento.MomentoChatMessageHistory.html |
242dd485aacb-0 | langchain.memory.chat_message_histories.sql.SQLChatMessageHistory¶
class langchain.memory.chat_message_histories.sql.SQLChatMessageHistory(session_id: str, connection_string: str, table_name: str = 'message_store', session_id_field_name: str = 'session_id', custom_message_converter: Optional[BaseMessageConverter] = Non... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.sql.SQLChatMessageHistory.html |
23a4091f4d21-0 | langchain.memory.chat_message_histories.zep.ZepChatMessageHistory¶
class langchain.memory.chat_message_histories.zep.ZepChatMessageHistory(session_id: str, url: str = 'http://localhost:8000', api_key: Optional[str] = None)[source]¶
Chat message history that uses Zep as a backend.
Recommended usage:
# Set up Zep Chat Hi... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.zep.ZepChatMessageHistory.html |
23a4091f4d21-1 | Append the message to the Zep memory history
add_user_message(message[, metadata])
Convenience method for adding a human message string to the store.
clear()
Clear session memory from Zep.
search(query[, metadata, limit])
Search Zep memory for messages matching the query
__init__(session_id: str, url: str = 'http://loc... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.zep.ZepChatMessageHistory.html |
892b007925a2-0 | langchain.memory.chat_message_histories.postgres.PostgresChatMessageHistory¶
class langchain.memory.chat_message_histories.postgres.PostgresChatMessageHistory(session_id: str, connection_string: str = 'postgresql://postgres:mypassword@localhost/chat_history', table_name: str = 'message_store')[source]¶
Chat message his... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.chat_message_histories.postgres.PostgresChatMessageHistory.html |
93c753639227-0 | langchain.memory.summary_buffer.ConversationSummaryBufferMemory¶
class langchain.memory.summary_buffer.ConversationSummaryBufferMemory[source]¶
Bases: BaseChatMemory, SummarizerMixin
Buffer with summarizer for storing conversation memory.
Create a new model by parsing and validating input data from keyword arguments.
R... | lang/api.python.langchain.com/en/latest/memory/langchain.memory.summary_buffer.ConversationSummaryBufferMemory.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.