id stringlengths 14 15 | text stringlengths 13 2.7k | source stringlengths 60 181 |
|---|---|---|
fb03d5d36a87-22 | Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
classmethod from_orm(obj: Any) → Model¶
get_kwargs() → Dict[str, Any]¶
Get the keyword arguments for the load_evaluator call.
Returns
The keyword arguments for the load_evaluator call.
Return type
Dict[str, Any]... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-23 | classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on fields based on this Model, globalns and localns.
classmethod validate(value: Any) → Model¶
class LabeledScoreString[source]¶
Bases: ScoreString
Create a new model by parsing and validating input data from keyword arguments.
Raises Val... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-24 | 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... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-25 | The keyword arguments for the load_evaluator call.
Return type
Dict[str, Any]
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, exc... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-26 | Bases: SingleKeyEvalConfig
Configuration for a QA evaluator.
Parameters
prompt (Optional[BasePromptTemplate]) – The prompt template to use for generating the question.
llm (Optional[BaseLanguageModel]) – The language model to use for the evaluation chain.
Create a new model by parsing and validating input data from key... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-27 | 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... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-28 | The keyword arguments for the load_evaluator call.
Return type
Dict[str, Any]
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, exc... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-29 | Bases: SingleKeyEvalConfig
Configuration for a regex match string evaluator.
Parameters
flags (int) – The flags to pass to the regex. Example: re.IGNORECASE.
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.
p... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-30 | 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 creating
the new model: you should trust this data
deep – set to True to make a deep co... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-31 | 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... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-32 | Raises ValidationError if the input data cannot be parsed to form a valid model.
param criteria: Optional[Union[Mapping[str, str], langchain.evaluation.criteria.eval_chain.Criteria, langchain.chains.constitutional_ai.models.ConstitutionalPrinciple]] = None¶
param evaluator_type: langchain.evaluation.schema.EvaluatorTyp... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-33 | 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... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-34 | 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 parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-35 | jaro_winkler: The Jaro-Winkler distance.
param evaluator_type: langchain.evaluation.schema.EvaluatorType = EvaluatorType.STRING_DISTANCE¶
param input_key: Optional[str] = None¶
The key from the traced run’s inputs dictionary to use to represent the
input. If not provided, it will be inferred automatically.
param normal... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-36 | the new model: you should trust this data
deep – set to True to make a deep copy of the model
Returns
new model instance
dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[boo... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-37 | classmethod parse_obj(obj: Any) → Model¶
classmethod parse_raw(b: Union[str, bytes], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶
classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definitions/{model}') → DictStrAny¶
classmet... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-38 | deep – set to True to make a deep copy of the model
Returns
new model instance
dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
fb03d5d36a87-39 | 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¶
classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on... | https://api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html |
6a2131c8aaad-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... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-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.
... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-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... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-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... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-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... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-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... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-6 | step, and the final state of the run.
The jsonpatch ops can be applied in order to construct state.
Parameters
input – The input to the runnable.
config – The config to use for the runnable.
diff – Whether to yield diffs between each step, or the current state.
with_streamed_output_list – Whether to yield the streamed_... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-7 | To mark a field as configurable, see the configurable_fields
and configurable_alternatives methods.
Parameters
include – A list of fields to include in the config schema.
Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, *, default_key: str = 'default', pr... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-8 | new model instance
dict(**kwargs: Any) → Dict¶
Dictionary representation of chain.
Expects Chain._chain_type property to be implemented and for memory to benull.
Parameters
**kwargs – Keyword arguments passed to default pydantic.BaseModel.dict
method.
Returns
A dictionary representation of the chain.
Example
chain.dict... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-9 | For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“langchain”, “llms”, “openai”]
get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶
Get a pydantic model that can be used to validate output to the runnable.
Runnables that leverage the configurable_fields and con... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-10 | classmethod is_lc_serializable() → bool¶
Is this class serializable?
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-11 | Parameters
inputs – Dictionary of raw inputs, or single input if chain expects
only one param. Should contain all inputs specified in
Chain.input_keys except for inputs that will be set by the chain’s
memory.
Returns
A dictionary of all inputs, including those added by the chain’s memory.
prep_outputs(inputs: Dict[str,... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-12 | these runtime tags will propagate to calls to other objects.
**kwargs – If the chain expects multiple inputs, they can be passed in
directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'question' string:
chain.run("What's the temperature in Boise, Idaho?")... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-13 | 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.
classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on fields based on this Model, globalns and lo... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-14 | type, input, output, error, start_time, end_time, and any tags or metadata
added to the run.
with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_after_attempt: int = 3) → Runnable[Input, Output]¶
Create a new Runnabl... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
6a2131c8aaad-15 | A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property output_schema: Type[pydantic.main.BaseModel]¶
The type of output this runnable produces specified as a pydantic model. | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALChain.html |
f37f0bdb818c-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... | https://api.python.langchain.com/en/latest/pal_chain/langchain_experimental.pal_chain.base.PALValidation.html |
28ff2cf71a4a-0 | langchain_experimental.cpal.models.QueryModel¶
class langchain_experimental.cpal.models.QueryModel[source]¶
Bases: BaseModel
translate a question about the story outcome into a programmatic expression
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input dat... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.models.QueryModel.html |
28ff2cf71a4a-1 | deep – set to True to make a deep copy of the model
Returns
new model instance
dict(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, ex... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.models.QueryModel.html |
28ff2cf71a4a-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¶
classmethod update_forward_refs(**localns: Any) → None¶
Try to update ForwardRefs on... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.models.QueryModel.html |
76f255d949c6-0 | langchain_experimental.cpal.base.CPALChain¶
class langchain_experimental.cpal.base.CPALChain[source]¶
Bases: _BaseStoryElementChain
Causal program-aided language (CPAL) chain implementation.
Security note: The building blocks of this class include the implementationof an AI technique that generates SQL code. If those S... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-1 | and at the end of every chain. At the start, memory loads variables and passes
them along in the chain. At the end, it saves any returned variables.
There are many different types of memory - please see memory docs
for the full catalog.
param metadata: Optional[Dict[str, Any]] = None¶
Optional metadata associated with ... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-2 | only one param. Should contain all inputs specified in
Chain.input_keys except for inputs that will be set by the chain’s
memory.
return_only_outputs – Whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by thi... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-3 | e.g., if the underlying runnable uses an API which supports a batch mode.
async acall(inputs: Union[Dict[str, Any], Any], return_only_outputs: bool = False, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, *, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, ... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-4 | Default implementation of ainvoke, calls invoke from a thread.
The default implementation allows usage of async code even if
the runnable did not implement a native async version of invoke.
Subclasses should override this method if they can run asynchronously.
apply(input_list: List[Dict[str, Any]], callbacks: Optional... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-5 | # -> "The temperature in Boise is..."
# Suppose we have a multi-input chain that takes a 'question' string
# and 'context' string:
question = "What's the temperature in Boise, Idaho?"
context = "Weather report for Boise, Idaho on 07/03/23..."
await chain.arun(question=question, context=context)
# -> "The temperature in... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-6 | diff – Whether to yield diffs between each step, or the current state.
with_streamed_output_list – Whether to yield the streamed_output list.
include_names – Only include logs with these names.
include_types – Only include logs with these types.
include_tags – Only include logs with these tags.
exclude_names – Exclude ... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-7 | Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, *, default_key: str = 'default', prefix_keys: bool = False, **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶
configurable_fields(**kwar... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-8 | **kwargs – Keyword arguments passed to default pydantic.BaseModel.dict
method.
Returns
A dictionary representation of the chain.
Example
chain.dict(exclude_unset=True)
# -> {"_type": "foo", "verbose": False, ...}
draw(**kwargs: Any) → None[source]¶
CPAL chain can draw its resulting DAG.
Usage in a jupyter notebook:
>>>... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-9 | classmethod get_lc_namespace() → List[str]¶
Get the namespace of the langchain object.
For example, if the class is langchain.llms.openai.OpenAI, then the
namespace is [“langchain”, “llms”, “openai”]
get_output_schema(config: Optional[RunnableConfig] = None) → Type[BaseModel]¶
Get a pydantic model that can be used to v... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-10 | classmethod is_lc_serializable() → bool¶
Is this class serializable?
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-11 | Validate and prepare chain inputs, including adding inputs from memory.
Parameters
inputs – Dictionary of raw inputs, or single input if chain expects
only one param. Should contain all inputs specified in
Chain.input_keys except for inputs that will be set by the chain’s
memory.
Returns
A dictionary of all inputs, inc... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-12 | addition to tags passed to the chain during construction, but only
these runtime tags will propagate to calls to other objects.
**kwargs – If the chain expects multiple inputs, they can be passed in
directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'que... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-13 | to_json_not_implemented() → SerializedNotImplemented¶
transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Default implementation of transform, which buffers input and then calls stream.
Subclasses should override this method if they can start producing... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-14 | The Run object contains information about the run, including its id,
type, input, output, error, start_time, end_time, and any tags or metadata
added to the run.
with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_af... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
76f255d949c6-15 | property lc_secrets: Dict[str, str]¶
A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property output_schema: Type[pydantic.main.BaseModel]¶
The type of output this runnable produces specified as a pydantic model.
pydantic_model: ClassVar[Optional[Type[pydantic.BaseMod... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CPALChain.html |
fe8c8701ac94-0 | langchain_experimental.cpal.base.CausalChain¶
class langchain_experimental.cpal.base.CausalChain[source]¶
Bases: _BaseStoryElementChain
Translate the causal narrative into a stack of operations.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cann... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-1 | and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param verbose: bool [Optional]¶
Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to the global verbose valu... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-2 | include_run_info – Whether to include run info in the response. Defaults
to False.
Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwar... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-3 | tags – List of string tags to pass to all callbacks. These will be passed in
addition to tags passed to the chain during construction, but only
these runtime tags will propagate to calls to other objects.
metadata – Optional metadata associated with the chain. Defaults to None
include_run_info – Whether to include run ... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-4 | addition to callbacks passed to the chain during construction, but only
these runtime callbacks will propagate to calls to other objects.
tags – List of string tags to pass to all callbacks. These will be passed in
addition to tags passed to the chain during construction, but only
these runtime tags will propagate to c... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-5 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Option... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-6 | Default implementation of atransform, which buffers input and calls astream.
Subclasses should override this method if they can start producing output while
input is still being generated.
batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-7 | Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-8 | This method allows to get an input schema for a specific configuration.
Parameters
config – A config to use when generating the schema.
Returns
A pydantic model that can be used to validate input.
classmethod get_lc_namespace() → List[str]¶
Get the namespace of the langchain object.
For example, if the class is langcha... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-9 | classmethod is_lc_serializable() → bool¶
Is this class serializable?
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-10 | Validate and prepare chain inputs, including adding inputs from memory.
Parameters
inputs – Dictionary of raw inputs, or single input if chain expects
only one param. Should contain all inputs specified in
Chain.input_keys except for inputs that will be set by the chain’s
memory.
Returns
A dictionary of all inputs, inc... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-11 | addition to tags passed to the chain during construction, but only
these runtime tags will propagate to calls to other objects.
**kwargs – If the chain expects multiple inputs, they can be passed in
directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'que... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-12 | to_json_not_implemented() → SerializedNotImplemented¶
transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Default implementation of transform, which buffers input and then calls stream.
Subclasses should override this method if they can start producing... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-13 | The Run object contains information about the run, including its id,
type, input, output, error, start_time, end_time, and any tags or metadata
added to the run.
with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_af... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-14 | property lc_secrets: Dict[str, str]¶
A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property output_schema: Type[pydantic.main.BaseModel]¶
The type of output this runnable produces specified as a pydantic model. | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-15 | template: ClassVar[str] = 'Transform the math story plot into a JSON object. Don\'t guess at any of the parts.\n\n{format_instructions}\n\n\n\nStory: Boris has seven times the number of pets as Marcia. Jan has three times the number of pets as Marcia. Marcia has two more pets than Cindy.\n\n\n\n# JSON:\n\n\n\n{{\n "... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-16 | JSON:\n\n\n\n{{\n "attribute": "money",\n "entities": [\n {{\n "name": "boris",\n "value": 0,\n "depends_on": [],\n "code": "pass"\n }},\n {{\n "name": "marcia",\n "value": 0,\n "depends_on": ["boris"],\n ... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
fe8c8701ac94-17 | meta private: | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.CausalChain.html |
3af9375a0f8a-0 | langchain_experimental.cpal.base.QueryChain¶
class langchain_experimental.cpal.base.QueryChain[source]¶
Bases: _BaseStoryElementChain
Query the outcome table using SQL.
Security note: This class implements an AI technique that generates SQL code.If those SQL commands are executed, it’s critical to ensure they use crede... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-1 | Optional metadata associated with the chain. Defaults to None.
This metadata will be associated with each call to this chain,
and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param tags: Optional[List[str]] = None¶
Optional ... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-2 | callbacks – Callbacks to use for this chain run. These will be called in
addition to callbacks passed to the chain during construction, but only
these runtime callbacks will propagate to calls to other objects.
tags – List of string tags to pass to all callbacks. These will be passed in
addition to tags passed to the c... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-3 | memory.
return_only_outputs – Whether to return only outputs in the
response. If True, only new keys generated by this chain will be
returned. If False, both input keys and new keys generated by this
chain will be returned. Defaults to False.
callbacks – Callbacks to use for this chain run. These will be called in
addi... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-4 | Convenience method for executing chain.
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 expect... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-5 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Option... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-6 | Default implementation of atransform, which buffers input and calls astream.
Subclasses should override this method if they can start producing output while
input is still being generated.
batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-7 | Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-8 | This method allows to get an input schema for a specific configuration.
Parameters
config – A config to use when generating the schema.
Returns
A pydantic model that can be used to validate input.
classmethod get_lc_namespace() → List[str]¶
Get the namespace of the langchain object.
For example, if the class is langcha... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-9 | classmethod is_lc_serializable() → bool¶
Is this class serializable?
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False, skip_defaults: Optional[bool] = None, exclude_unset: bool = False, exclude_defa... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-10 | Validate and prepare chain inputs, including adding inputs from memory.
Parameters
inputs – Dictionary of raw inputs, or single input if chain expects
only one param. Should contain all inputs specified in
Chain.input_keys except for inputs that will be set by the chain’s
memory.
Returns
A dictionary of all inputs, inc... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-11 | addition to tags passed to the chain during construction, but only
these runtime tags will propagate to calls to other objects.
**kwargs – If the chain expects multiple inputs, they can be passed in
directly as keyword arguments.
Returns
The chain output.
Example
# Suppose we have a single-input chain that takes a 'que... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-12 | to_json_not_implemented() → SerializedNotImplemented¶
transform(input: Iterator[Input], config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Default implementation of transform, which buffers input and then calls stream.
Subclasses should override this method if they can start producing... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-13 | The Run object contains information about the run, including its id,
type, input, output, error, start_time, end_time, and any tags or metadata
added to the run.
with_retry(*, retry_if_exception_type: ~typing.Tuple[~typing.Type[BaseException], ...] = (<class 'Exception'>,), wait_exponential_jitter: bool = True, stop_af... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-14 | property lc_secrets: Dict[str, str]¶
A map of constructor argument names to secret ids.
For example,{“openai_api_key”: “OPENAI_API_KEY”}
property output_schema: Type[pydantic.main.BaseModel]¶
The type of output this runnable produces specified as a pydantic model. | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-15 | template: ClassVar[str] = 'Transform the narrative_input into an SQL expression. If you are\nunsure, then do not guess, instead add a llm_error_msg that explains why you are unsure.\n\n\n{format_instructions}\n\n\nnarrative_input: how much money will boris have?\n\n\n# JSON:\n\n {{\n "narrative_input": "how m... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-16 | what\'s the maximum of the pet counts for all the people?\n\n\n\n# JSON:\n\n {{\n "narrative_input": "what\'s the maximum of the pet counts for all the people?",\n "llm_error_msg": "",\n "expression": "SELECT MAX(value) FROM df"\n }}\n\n\n\n\nnarrative_input: what\'s the minimum of the pet co... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-17 | "narrative_input": "what\'s the pet count for cindy and marcia?",\n "llm_error_msg": "",\n "expression": "SELECT name, value FROM df WHERE name IN (\'cindy\', \'marcia\')"\n }}\n\n\n\n\nnarrative_input: what\'s the total pet count for cindy and marcia?\n\n\n\n# JSON:\n\n {{\n "narrative_input... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-18 | "narrative_input": "what\'s the total pet count for TED and cindy?",\n "llm_error_msg": "",\n "expression": "SELECT SUM(value) FROM df WHERE name IN (\'TED\', \'cindy\')"\n }}\n\n\n\n\nnarrative_input: what\'s the best for TED and cindy?\n\n\n\n\n# JSON:\n\n {{\n "narrative_input": "what\'s t... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
3af9375a0f8a-19 | meta private: | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
8c9a90aee296-0 | langchain_experimental.cpal.constants.Constant¶
class langchain_experimental.cpal.constants.Constant(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Enum for constants used in the CPAL.
narrative_input = 'narrative_input'¶
chain_answer = 'chain_answer'¶
chain_data = 'chain_... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.constants.Constant.html |
cee181c45d79-0 | langchain_experimental.cpal.base.InterventionChain¶
class langchain_experimental.cpal.base.InterventionChain[source]¶
Bases: _BaseStoryElementChain
Set the hypothetical conditions for the causal model.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input da... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
cee181c45d79-1 | and passed as arguments to the handlers defined in callbacks.
You can use these to eg identify a specific instance of a chain with its use case.
param verbose: bool [Optional]¶
Whether or not run in verbose mode. In verbose mode, some intermediate logs
will be printed to the console. Defaults to the global verbose valu... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
cee181c45d79-2 | include_run_info – Whether to include run info in the response. Defaults
to False.
Returns
A dict of named outputs. Should contain all outputs specified inChain.output_keys.
async abatch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwar... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
cee181c45d79-3 | tags – List of string tags to pass to all callbacks. These will be passed in
addition to tags passed to the chain during construction, but only
these runtime tags will propagate to calls to other objects.
metadata – Optional metadata associated with the chain. Defaults to None
include_run_info – Whether to include run ... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
cee181c45d79-4 | addition to callbacks passed to the chain during construction, but only
these runtime callbacks will propagate to calls to other objects.
tags – List of string tags to pass to all callbacks. These will be passed in
addition to tags passed to the chain during construction, but only
these runtime tags will propagate to c... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
cee181c45d79-5 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, with_streamed_output_list: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Option... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
cee181c45d79-6 | Default implementation of atransform, which buffers input and calls astream.
Subclasses should override this method if they can start producing output while
input is still being generated.
batch(inputs: List[Input], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False... | https://api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.