id stringlengths 14 16 | text stringlengths 20 3.26k | source stringlengths 65 181 |
|---|---|---|
6bd30ceb83cf-11 | some_tool
{“x”: 1, “y”: “2”}
on_retriever_start
[retriever name]
{“query”: “hello”}
on_retriever_end
[retriever name]
{“query”: “hello”}
[Document(…), ..]
on_prompt_start
[template_name]
{“question”: “hello”}
on_prompt_end
[template_name]
{“question”: “hello”}
ChatPromptValue(messages: [SystemMessage, …])
Here are decl... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-12 | "event": "on_chain_start",
"metadata": {},
"name": "reverse",
"tags": [],
},
{
"data": {"chunk": "olleh"},
"event": "on_chain_stream",
"metadata": {},
"name": "reverse",
"tags": [],
},
{
"data": {"output": "olleh"},
"event":... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-13 | of astream_events is built on top of astream_log.
Returns
An async stream of StreamEvents.
Return type
AsyncIterator[StreamEvent]
Notes
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, incl... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-14 | exclude_types (Optional[Sequence[str]]) – Exclude logs with these types.
exclude_tags (Optional[Sequence[str]]) – Exclude logs with these tags.
kwargs (Any) –
Return type
Union[AsyncIterator[RunLogPatch], AsyncIterator[RunLog]]
async atransform(input: AsyncIterator[Input], config: Optional[RunnableConfig] = None, **kw... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-15 | Run invoke in parallel on a list of inputs,
yielding results as they complete.
Parameters
inputs (Sequence[Input]) –
config (Optional[Union[RunnableConfig, Sequence[RunnableConfig]]]) –
return_exceptions (bool) –
kwargs (Optional[Any]) –
Return type
Iterator[Tuple[int, Union[Output, Exception]]]
bind(**kwargs: Any)... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-16 | Returns
A pydantic model that can be used to validate config.
Return type
Type[BaseModel]
configurable_alternatives(which: ConfigurableField, *, default_key: str = 'default', prefix_keys: bool = False, **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-17 | model = ChatOpenAI(max_tokens=20).configurable_fields(
max_tokens=ConfigurableField(
id="output_token_number",
name="Max tokens in the output",
description="The maximum number of tokens in the output",
)
)
# max_tokens = 20
print(
"max_tokens_20: ",
model.invoke("tell me somethin... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-18 | 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/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-19 | Parameters
obj (Any) –
Return type
Model
get_graph(config: Optional[RunnableConfig] = None) → Graph¶
Return a graph representation of this runnable.
Parameters
config (Optional[RunnableConfig]) –
Return type
Graph
get_input_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶
Get a pydantic model that c... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-20 | This method allows to get an output schema for a specific configuration.
Parameters
config (Optional[RunnableConfig]) – A config to use when generating the schema.
Returns
A pydantic model that can be used to validate output.
Return type
Type[BaseModel]
get_prompts(config: Optional[RunnableConfig] = None) → List[BasePr... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-21 | 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/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-22 | encoding (unicode) –
proto (Protocol) –
allow_pickle (bool) –
Return type
Model
classmethod parse_obj(obj: Any) → Model¶
Parameters
obj (Any) –
Return type
Model
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = Fals... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-23 | json=as_json,
bytes=RunnableLambda(as_bytes)
)
chain.invoke("[1, 2, 3]")
# -> {"str": "[1, 2, 3]", "json": [1, 2, 3], "bytes": b"[1, 2, 3]"}
json_and_bytes_chain = chain.pick(["json", "bytes"])
json_and_bytes_chain.invoke("[1, 2, 3]")
# -> {"json": [1, 2, 3], "bytes": b"[1, 2, 3]"}
Parameters
keys (Union[str, List[... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-24 | # -> [4, 6, 8]
Parameters
others (Union[Runnable[Any, Other], Callable[[Any], Other]]) –
name (Optional[str]) –
Return type
RunnableSerializable[Input, Other]
prep_inputs(inputs: Union[Dict[str, Any], Any]) → Dict[str, str]¶
Prepare chain inputs, including adding inputs from memory.
Parameters
inputs (Union[Dict[str,... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-25 | 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 (Any) – If the chain expects a single input, it can be passed in as the
sole positional argument.
callbacks (Optional[Union[List[Base... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-26 | Expects Chain._chain_type property to be implemented and for memory to benull.
Parameters
file_path (Union[Path, str]) – Path to file to save the chain to.
Return type
None
Example
chain.save(file_path="path/chain.yaml")
save_progress() → None¶
This function should be called to save the state of the learned policy mode... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-27 | Default implementation of transform, which buffers input and then calls stream.
Subclasses should override this method if they can start producing output while
input is still being generated.
Parameters
input (Iterator[Input]) –
config (Optional[RunnableConfig]) –
kwargs (Optional[Any]) –
Return type
Iterator[Output... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-28 | Example:
Parameters
on_start (Optional[AsyncListener]) –
on_end (Optional[AsyncListener]) –
on_error (Optional[AsyncListener]) –
Return type
Runnable[Input, Output]
with_config(config: Optional[RunnableConfig] = None, **kwargs: Any) → Runnable[Input, Output]¶
Bind config to a Runnable, returning a new Runnable.
Para... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-29 | exceptions will not be passed to fallbacks. If used, the base runnable
and its fallbacks must accept a dictionary as input.
Returns
A new Runnable that will try the original runnable, and then each
fallback in order, upon failures.
Return type
RunnableWithFallbacksT[Input, Output]
with_listeners(*, on_start: Optional[U... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-30 | on_end=fn_end
)
chain.invoke(2)
Parameters
on_start (Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]]) –
on_end (Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]]) –
on_error (Optional[Union[Callable[[Run], None], Callable[[Run, RunnableConfig], None]]]) –
Ret... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
6bd30ceb83cf-31 | Return type
Runnable[Input, Output]
with_types(*, input_type: Optional[Type[Input]] = None, output_type: Optional[Type[Output]] = None) → Runnable[Input, Output]¶
Bind input and output types to a Runnable, returning a new Runnable.
Parameters
input_type (Optional[Type[Input]]) –
output_type (Optional[Type[Output]]) – ... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBest.html |
4e29cacd82a9-0 | langchain_experimental.rl_chain.base.embed_string_type¶
langchain_experimental.rl_chain.base.embed_string_type(item: Union[str, _Embed], model: Any, namespace: Optional[str] = None) → Dict[str, Union[str, List[str]]][source]¶
Embed a string or an _Embed object.
Parameters
item (Union[str, _Embed]) –
model (Any) –
nam... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.embed_string_type.html |
c443293229c3-0 | langchain_experimental.rl_chain.metrics.MetricsTrackerAverage¶
class langchain_experimental.rl_chain.metrics.MetricsTrackerAverage(step: int)[source]¶
Metrics Tracker Average.
Attributes
score
Methods
__init__(step)
on_decision()
on_feedback(score)
to_pandas()
Parameters
step (int) –
__init__(step: int)[source]¶
Param... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.metrics.MetricsTrackerAverage.html |
fd2a11913b33-0 | langchain_experimental.rl_chain.base.SelectionScorer¶
class langchain_experimental.rl_chain.base.SelectionScorer[source]¶
Bases: Generic[TEvent], ABC, BaseModel
Abstract class to grade the chosen selection or the response of the llm.
Create a new model by parsing and validating input data from keyword arguments.
Raises... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.SelectionScorer.html |
fd2a11913b33-1 | self (Model) –
Returns
new model instance
Return type
Model
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: bo... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.SelectionScorer.html |
fd2a11913b33-2 | 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) –
encoder (Optional[Callable[[Any], Any]]) –
models... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.SelectionScorer.html |
fd2a11913b33-3 | ref_template (unicode) –
Return type
DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
Parameters
by_alias (bool) –
ref_template (unicode) –
dumps_kwargs (Any) –
Return type
unicode
abstract score_response(inputs: Dict[str, ... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.SelectionScorer.html |
2aa1e2162432-0 | langchain_experimental.rl_chain.metrics.MetricsTrackerRollingWindow¶
class langchain_experimental.rl_chain.metrics.MetricsTrackerRollingWindow(window_size: int, step: int)[source]¶
Metrics Tracker Rolling Window.
Attributes
score
Methods
__init__(window_size, step)
on_decision()
on_feedback(value)
to_pandas()
Parameter... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.metrics.MetricsTrackerRollingWindow.html |
b987494acdb0-0 | langchain_experimental.rl_chain.base.Event¶
class langchain_experimental.rl_chain.base.Event(inputs: Dict[str, Any], selected: Optional[TSelected] = None)[source]¶
Abstract class to represent an event.
Attributes
inputs
selected
Methods
__init__(inputs[, selected])
Parameters
inputs (Dict[str, Any]) –
selected (Option... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.Event.html |
bc3c5b4df8cb-0 | langchain_experimental.rl_chain.pick_best_chain.PickBestSelected¶
class langchain_experimental.rl_chain.pick_best_chain.PickBestSelected(index: Optional[int] = None, probability: Optional[float] = None, score: Optional[float] = None)[source]¶
Selected class for PickBest chain.
Attributes
index
probability
score
Methods... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBestSelected.html |
4884fc3c8042-0 | langchain_experimental.rl_chain.base.ToSelectFrom¶
langchain_experimental.rl_chain.base.ToSelectFrom(anything: Any) → _ToSelectFrom[source]¶
Wrap a value to indicate that it should be selected from.
Parameters
anything (Any) –
Return type
_ToSelectFrom | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.ToSelectFrom.html |
74432b25975f-0 | langchain_experimental.rl_chain.base.Embed¶
langchain_experimental.rl_chain.base.Embed(anything: Any, keep: bool = False) → Any[source]¶
Wrap a value to indicate that it should be embedded.
Parameters
anything (Any) –
keep (bool) –
Return type
Any | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.Embed.html |
534b6e74daa4-0 | langchain_experimental.rl_chain.vw_logger.VwLogger¶
class langchain_experimental.rl_chain.vw_logger.VwLogger(path: Optional[Union[str, PathLike]])[source]¶
Vowpal Wabbit custom logger.
Methods
__init__(path)
log(vw_ex)
logging_enabled()
Parameters
path (Optional[Union[str, PathLike]]) –
__init__(path: Optional[Union[s... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.vw_logger.VwLogger.html |
63c98970832d-0 | langchain_experimental.rl_chain.pick_best_chain.PickBestEvent¶
class langchain_experimental.rl_chain.pick_best_chain.PickBestEvent(inputs: Dict[str, Any], to_select_from: Dict[str, Any], based_on: Dict[str, Any], selected: Optional[PickBestSelected] = None)[source]¶
Event class for PickBest chain.
Attributes
Methods
__... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBestEvent.html |
1a50b4897fab-0 | langchain_experimental.rl_chain.base.EmbedAndKeep¶
langchain_experimental.rl_chain.base.EmbedAndKeep(anything: Any) → Any[source]¶
Wrap a value to indicate that it should be embedded and kept.
Parameters
anything (Any) –
Return type
Any | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.EmbedAndKeep.html |
564bc409298e-0 | langchain_experimental.rl_chain.base.prepare_inputs_for_autoembed¶
langchain_experimental.rl_chain.base.prepare_inputs_for_autoembed(inputs: Dict[str, Any]) → Dict[str, Any][source]¶
Prepare the inputs for auto embedding.
Go over all the inputs and if something is either wrapped in _ToSelectFrom or _BasedOn, and if the... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.prepare_inputs_for_autoembed.html |
7a63deb92f68-0 | langchain_experimental.rl_chain.base.parse_lines¶
langchain_experimental.rl_chain.base.parse_lines(parser: vw.TextFormatParser, input_str: str) → List['vw.Example'][source]¶
Parse the input string into a list of examples.
Parameters
parser (vw.TextFormatParser) –
input_str (str) –
Return type
List[‘vw.Example’] | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.parse_lines.html |
3c57d6d136fd-0 | langchain_experimental.rl_chain.base.get_based_on_and_to_select_from¶
langchain_experimental.rl_chain.base.get_based_on_and_to_select_from(inputs: Dict[str, Any]) → Tuple[Dict, Dict][source]¶
Get the BasedOn and ToSelectFrom from the inputs.
Parameters
inputs (Dict[str, Any]) –
Return type
Tuple[Dict, Dict] | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.get_based_on_and_to_select_from.html |
df5a858ff12f-0 | langchain_experimental.rl_chain.base.embed_dict_type¶
langchain_experimental.rl_chain.base.embed_dict_type(item: Dict, model: Any) → Dict[str, Any][source]¶
Embed a dictionary item.
Parameters
item (Dict) –
model (Any) –
Return type
Dict[str, Any] | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.embed_dict_type.html |
799ed238b877-0 | langchain_experimental.rl_chain.base.Selected¶
class langchain_experimental.rl_chain.base.Selected[source]¶
Abstract class to represent the selected item.
Methods
__init__()
__init__()¶ | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.Selected.html |
9db694f06ed3-0 | langchain_experimental.rl_chain.base.is_stringtype_instance¶
langchain_experimental.rl_chain.base.is_stringtype_instance(item: Any) → bool[source]¶
Check if an item is a string.
Parameters
item (Any) –
Return type
bool | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.base.is_stringtype_instance.html |
3215ed7c0893-0 | langchain_experimental.rl_chain.pick_best_chain.PickBestRandomPolicy¶
class langchain_experimental.rl_chain.pick_best_chain.PickBestRandomPolicy(feature_embedder: Embedder, **kwargs: Any)[source]¶
Random policy for PickBest chain.
Methods
__init__(feature_embedder, **kwargs)
learn(event)
log(event)
predict(event)
save(... | https://api.python.langchain.com/en/latest/rl_chain/langchain_experimental.rl_chain.pick_best_chain.PickBestRandomPolicy.html |
64d3e321155d-0 | langchain_prompty.langchain.create_chat_prompt¶
langchain_prompty.langchain.create_chat_prompt(path: str, input_name_agent_scratchpad: str = 'agent_scratchpad') → Runnable[Dict[str, Any], ChatPromptTemplate][source]¶
Parameters
path (str) –
input_name_agent_scratchpad (str) –
Return type
Runnable[Dict[str, Any], Chat... | https://api.python.langchain.com/en/latest/langchain/langchain_prompty.langchain.create_chat_prompt.html |
f9b38c4db643-0 | langchain_core.structured_query.Visitor¶
class langchain_core.structured_query.Visitor[source]¶
Defines interface for IR translation using visitor pattern.
Attributes
allowed_comparators
allowed_operators
Methods
__init__()
visit_comparison(comparison)
Translate a Comparison.
visit_operation(operation)
Translate an Ope... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Visitor.html |
29c8d3168f87-0 | langchain_core.structured_query.FilterDirective¶
class langchain_core.structured_query.FilterDirective[source]¶
Bases: Expr, ABC
Filtering expression.
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.
accept(v... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.FilterDirective.html |
29c8d3168f87-1 | deep (bool) – set to True to make a deep copy of the model
self (Model) –
Returns
new model instance
Return type
Model
dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.FilterDirective.html |
29c8d3168f87-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().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) –
exclude (Optional[Union[AbstractSetIntStr, Map... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.FilterDirective.html |
29c8d3168f87-3 | Parameters
by_alias (bool) –
ref_template (unicode) –
Return type
DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
Parameters
by_alias (bool) –
ref_template (unicode) –
dumps_kwargs (Any) –
Return type
unicode
classmethod ... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.FilterDirective.html |
3ef26fb3cd1c-0 | langchain_core.structured_query.Operator¶
class langchain_core.structured_query.Operator(value)[source]¶
Enumerator of the operations.
AND = 'and'¶
OR = 'or'¶
NOT = 'not'¶
Examples using Operator¶
How to construct filters for query analysis | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Operator.html |
6ae9755ee958-0 | langchain_core.structured_query.Comparator¶
class langchain_core.structured_query.Comparator(value)[source]¶
Enumerator of the comparison operators.
EQ = 'eq'¶
NE = 'ne'¶
GT = 'gt'¶
GTE = 'gte'¶
LT = 'lt'¶
LTE = 'lte'¶
CONTAIN = 'contain'¶
LIKE = 'like'¶
IN = 'in'¶
NIN = 'nin'¶
Examples using Comparator¶
How to constru... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Comparator.html |
00b7611d31b5-0 | langchain_core.structured_query.Comparison¶
class langchain_core.structured_query.Comparison[source]¶
Bases: FilterDirective
Comparison to a value.
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 attri... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Comparison.html |
00b7611d31b5-1 | 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: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: ... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Comparison.html |
00b7611d31b5-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().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) –
exclude (Optional[Union[AbstractSetIntStr, Map... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Comparison.html |
00b7611d31b5-3 | Parameters
by_alias (bool) –
ref_template (unicode) –
Return type
DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
Parameters
by_alias (bool) –
ref_template (unicode) –
dumps_kwargs (Any) –
Return type
unicode
classmethod ... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Comparison.html |
0b5ca7ecf056-0 | langchain_core.structured_query.Expr¶
class langchain_core.structured_query.Expr[source]¶
Bases: BaseModel
Base class for all expressions.
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.
accept(visitor: Visi... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Expr.html |
0b5ca7ecf056-1 | deep (bool) – set to True to make a deep copy of the model
self (Model) –
Returns
new model instance
Return type
Model
dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Expr.html |
0b5ca7ecf056-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().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) –
exclude (Optional[Union[AbstractSetIntStr, Map... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Expr.html |
0b5ca7ecf056-3 | Parameters
by_alias (bool) –
ref_template (unicode) –
Return type
DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
Parameters
by_alias (bool) –
ref_template (unicode) –
dumps_kwargs (Any) –
Return type
unicode
classmethod ... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Expr.html |
759458d3563e-0 | langchain_core.structured_query.Operation¶
class langchain_core.structured_query.Operation[source]¶
Bases: FilterDirective
Llogical operation over other directives.
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 m... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Operation.html |
759458d3563e-1 | 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: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: ... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Operation.html |
759458d3563e-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().
Parameters
include (Optional[Union[AbstractSetIntStr, MappingIntStrAny]]) –
exclude (Optional[Union[AbstractSetIntStr, Map... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Operation.html |
759458d3563e-3 | Parameters
by_alias (bool) –
ref_template (unicode) –
Return type
DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
Parameters
by_alias (bool) –
ref_template (unicode) –
dumps_kwargs (Any) –
Return type
unicode
classmethod ... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.Operation.html |
0c148bf1eda6-0 | langchain_core.structured_query.StructuredQuery¶
class langchain_core.structured_query.StructuredQuery[source]¶
Bases: Expr
Structured query.
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 filter: Opt... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.StructuredQuery.html |
0c148bf1eda6-1 | 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: Optional[Union[Abstrac... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.StructuredQuery.html |
0c148bf1eda6-2 | Parameters
obj (Any) –
Return type
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... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.StructuredQuery.html |
0c148bf1eda6-3 | Parameters
obj (Any) –
Return type
Model
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
Parameters
b (Union[str, bytes]) –
content_type (unicode) –
encoding (unicode) –
proto (Protocol) –
allow_pi... | https://api.python.langchain.com/en/latest/structured_query/langchain_core.structured_query.StructuredQuery.html |
a1ca80ae05e2-0 | langchain_ai21.semantic_text_splitter.AI21SemanticTextSplitter¶
class langchain_ai21.semantic_text_splitter.AI21SemanticTextSplitter(chunk_size: int = 0, chunk_overlap: int = 0, client: Optional[Any] = None, api_key: Optional[SecretStr] = None, api_host: Optional[str] = None, timeout_sec: Optional[float] = None, num_re... | https://api.python.langchain.com/en/latest/semantic_text_splitter/langchain_ai21.semantic_text_splitter.AI21SemanticTextSplitter.html |
a1ca80ae05e2-1 | num_retries (Optional[int]) –
kwargs (Any) –
__init__(chunk_size: int = 0, chunk_overlap: int = 0, client: Optional[Any] = None, api_key: Optional[SecretStr] = None, api_host: Optional[str] = None, timeout_sec: Optional[float] = None, num_retries: Optional[int] = None, **kwargs: Any) → None[source]¶
Create a new Text... | https://api.python.langchain.com/en/latest/semantic_text_splitter/langchain_ai21.semantic_text_splitter.AI21SemanticTextSplitter.html |
a1ca80ae05e2-2 | kwargs (Any) –
Return type
TextSplitter
classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all'], AbstractSet[str]] = {}, disallowed_special: Union[Literal['all'], Collection[str]] = 'all', **kwargs: Any) → TS¶
Text splitter that uses tiktok... | https://api.python.langchain.com/en/latest/semantic_text_splitter/langchain_ai21.semantic_text_splitter.AI21SemanticTextSplitter.html |
a5c59f944478-0 | langchain_community.document_transformers.google_translate.GoogleTranslateTransformer¶
class langchain_community.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] ... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.google_translate.GoogleTranslateTransformer.html |
a5c59f944478-1 | Asynchronously transform a list of documents.
Parameters
documents (Sequence[Document]) – A sequence of Documents to be transformed.
kwargs (Any) –
Returns
A list of transformed Documents.
Return type
Sequence[Document]
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document][source]¶
Tra... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.google_translate.GoogleTranslateTransformer.html |
c7ef76112bb5-0 | langchain_community.document_transformers.openai_functions.create_metadata_tagger¶
langchain_community.document_transformers.openai_functions.create_metadata_tagger(metadata_schema: Union[Dict[str, Any], Type[BaseModel]], llm: BaseLanguageModel, prompt: Optional[ChatPromptTemplate] = None, *, tagging_chain_kwargs: Opti... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.openai_functions.create_metadata_tagger.html |
c7ef76112bb5-1 | "required": ["movie_title", "critic", "tone"]
}
# 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 gr... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.openai_functions.create_metadata_tagger.html |
edcbb18d1941-0 | langchain_community.document_transformers.doctran_text_translate.DoctranTextTranslator¶
class langchain_community.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 ... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.doctran_text_translate.DoctranTextTranslator.html |
edcbb18d1941-1 | kwargs (Any) –
Returns
A list of transformed Documents.
Return type
Sequence[Document]
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document][source]¶
Translates text documents using doctran.
Parameters
documents (Sequence[Document]) –
kwargs (Any) –
Return type
Sequence[Document]
Exa... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.doctran_text_translate.DoctranTextTranslator.html |
b6abeb8a170b-0 | langchain_community.document_transformers.doctran_text_qa.DoctranQATransformer¶
class langchain_community.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_... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.doctran_text_qa.DoctranQATransformer.html |
b6abeb8a170b-1 | Returns
A list of transformed Documents.
Return type
Sequence[Document]
transform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document][source]¶
Extracts QA from text documents using doctran.
Parameters
documents (Sequence[Document]) –
kwargs (Any) –
Return type
Sequence[Document]
Examples usin... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.doctran_text_qa.DoctranQATransformer.html |
f4c38ad90a5c-0 | langchain_community.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter¶
class langchain_community.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter[source]¶
Bases: BaseDocumentTransformer, BaseModel
Filter that drops redundant documents by comparing their embeddings.
C... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter.html |
f4c38ad90a5c-1 | values (Any) –
Return type
Model
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 choose which fields to include, exclude an... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter.html |
f4c38ad90a5c-2 | exclude_unset (bool) –
exclude_defaults (bool) –
exclude_none (bool) –
Return type
DictStrAny
classmethod from_orm(obj: Any) → Model¶
Parameters
obj (Any) –
Return type
Model
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] =... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter.html |
f4c38ad90a5c-3 | content_type (unicode) –
encoding (unicode) –
proto (Protocol) –
allow_pickle (bool) –
Return type
Model
classmethod parse_obj(obj: Any) → Model¶
Parameters
obj (Any) –
Return type
Model
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None,... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter.html |
f4c38ad90a5c-4 | Parameters
value (Any) –
Return type
Model
Examples using EmbeddingsRedundantFilter¶
How to do retrieval with contextual compression
LOTR (Merger Retriever) | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.embeddings_redundant_filter.EmbeddingsRedundantFilter.html |
68737773d507-0 | langchain_community.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer¶
class langchain_community.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer[source]¶
Transform HTML content by extracting specific tags and removing unwanted ones.
Example
from langchain_community.docu... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer.html |
68737773d507-1 | Extract specific tags from a given HTML content.
Parameters
html_content (str) – The original HTML content string.
tags (Union[List[str], Tuple[str, ...]]) – A list of tags to be extracted from the HTML.
remove_comments (bool) –
Returns
A string combining the content of the extracted tags.
Return type
str
static remov... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer.html |
68737773d507-2 | Returns
A cleaned HTML string with unwanted tags removed.
Return type
str
transform_documents(documents: Sequence[Document], unwanted_tags: Union[List[str], Tuple[str, ...]] = ('script', 'style'), tags_to_extract: Union[List[str], Tuple[str, ...]] = ('p', 'li', 'div', 'a'), remove_lines: bool = True, *, unwanted_classn... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.beautiful_soup_transformer.BeautifulSoupTransformer.html |
59f8fbf848e5-0 | langchain_community.document_transformers.nuclia_text_transform.NucliaTextTransformer¶
class langchain_community.document_transformers.nuclia_text_transform.NucliaTextTransformer(nua: NucliaUnderstandingAPI)[source]¶
Nuclia Text Transformer.
The Nuclia Understanding API splits into paragraphs and sentences,
identifies ... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.nuclia_text_transform.NucliaTextTransformer.html |
3306b7daa32c-0 | langchain_community.document_transformers.openai_functions.OpenAIMetadataTagger¶
class langchain_community.document_transformers.openai_functions.OpenAIMetadataTagger[source]¶
Bases: BaseDocumentTransformer, BaseModel
Extract metadata tags from document contents using OpenAI functions.
Example:from langchain_community.... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.openai_functions.OpenAIMetadataTagger.html |
3306b7daa32c-1 | Raises ValidationError if the input data cannot be parsed to form a valid model.
param tagging_chain: Any = None¶
The chain used to extract metadata from each document.
async atransform_documents(documents: Sequence[Document], **kwargs: Any) → Sequence[Document][source]¶
Asynchronously transform a list of documents.
Pa... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.openai_functions.OpenAIMetadataTagger.html |
3306b7daa32c-2 | 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: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: ... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.openai_functions.OpenAIMetadataTagger.html |
3306b7daa32c-3 | 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/document_transformers/langchain_community.document_transformers.openai_functions.OpenAIMetadataTagger.html |
3306b7daa32c-4 | Parameters
by_alias (bool) –
ref_template (unicode) –
Return type
DictStrAny
classmethod schema_json(*, by_alias: bool = True, ref_template: unicode = '#/definitions/{model}', **dumps_kwargs: Any) → unicode¶
Parameters
by_alias (bool) –
ref_template (unicode) –
dumps_kwargs (Any) –
Return type
unicode
transform_do... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.openai_functions.OpenAIMetadataTagger.html |
0fa5a3afd03d-0 | langchain_community.document_transformers.html2text.Html2TextTransformer¶
class langchain_community.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 (b... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.html2text.Html2TextTransformer.html |
02a98ba6655e-0 | langchain_community.document_transformers.markdownify.MarkdownifyTransformer¶
class langchain_community.document_transformers.markdownify.MarkdownifyTransformer(strip: Optional[Union[str, List[str]]] = None, convert: Optional[Union[str, List[str]]] = None, autolinks: bool = True, heading_style: str = 'ATX', **kwargs: A... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.markdownify.MarkdownifyTransformer.html |
02a98ba6655e-1 | transform_documents(documents, **kwargs)
Transform a list of documents.
__init__(strip: Optional[Union[str, List[str]]] = None, convert: Optional[Union[str, List[str]]] = None, autolinks: bool = True, heading_style: str = 'ATX', **kwargs: Any) → None[source]¶
Parameters
strip (Optional[Union[str, List[str]]]) –
conver... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.markdownify.MarkdownifyTransformer.html |
6cad57c84bf6-0 | langchain_community.document_transformers.embeddings_redundant_filter.get_stateful_documents¶
langchain_community.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.... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.embeddings_redundant_filter.get_stateful_documents.html |
88fc59ca292a-0 | langchain_community.document_transformers.long_context_reorder.LongContextReorder¶
class langchain_community.document_transformers.long_context_reorder.LongContextReorder[source]¶
Bases: BaseDocumentTransformer, BaseModel
Reorder long context.
Lost in the middle:
Performance degrades when models must access relevant in... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.long_context_reorder.LongContextReorder.html |
88fc59ca292a-1 | 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/document_transformers/langchain_community.document_transformers.long_context_reorder.LongContextReorder.html |
88fc59ca292a-2 | Parameters
obj (Any) –
Return type
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... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.long_context_reorder.LongContextReorder.html |
88fc59ca292a-3 | Parameters
obj (Any) –
Return type
Model
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
Parameters
b (Union[str, bytes]) –
content_type (unicode) –
encoding (unicode) –
proto (Protocol) –
allow_pi... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.long_context_reorder.LongContextReorder.html |
a120bec9ca06-0 | langchain_community.document_transformers.doctran_text_extract.DoctranPropertyExtractor¶
class langchain_community.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 te... | https://api.python.langchain.com/en/latest/document_transformers/langchain_community.document_transformers.doctran_text_extract.DoctranPropertyExtractor.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.