id stringlengths 14 16 | text stringlengths 13 2.7k | source stringlengths 57 178 |
|---|---|---|
6414d1dc7ce9-0 | langchain.embeddings.mosaicml.MosaicMLInstructorEmbeddings¶
class langchain.embeddings.mosaicml.MosaicMLInstructorEmbeddings[source]¶
Bases: BaseModel, Embeddings
MosaicML embedding service.
To use, you should have the
environment variable MOSAICML_API_TOKEN set with your API token, or pass
it as a named parameter to t... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.mosaicml.MosaicMLInstructorEmbeddings.html |
6414d1dc7ce9-1 | 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
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclu... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.mosaicml.MosaicMLInstructorEmbeddings.html |
6414d1dc7ce9-2 | Embed a query using a MosaicML deployed instructor embedding model.
Parameters
text – The text to embed.
Returns
Embeddings for the text.
classmethod from_orm(obj: Any) → Model¶
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = ... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.mosaicml.MosaicMLInstructorEmbeddings.html |
6414d1dc7ce9-3 | classmethod validate(value: Any) → Model¶
Examples using MosaicMLInstructorEmbeddings¶
MosaicML | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.mosaicml.MosaicMLInstructorEmbeddings.html |
592992ced35f-0 | langchain.embeddings.llm_rails.LLMRailsEmbeddings¶
class langchain.embeddings.llm_rails.LLMRailsEmbeddings[source]¶
Bases: BaseModel, Embeddings
LLMRails embedding models.
To use, you should have the environment
variable LLM_RAILS_API_KEY set with your API key or pass it
as a named parameter to the constructor.
Model ... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.llm_rails.LLMRailsEmbeddings.html |
592992ced35f-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/embeddings/langchain.embeddings.llm_rails.LLMRailsEmbeddings.html |
592992ced35f-2 | Embeddings for the text.
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... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.llm_rails.LLMRailsEmbeddings.html |
e574a30dc35d-0 | langchain.embeddings.johnsnowlabs.JohnSnowLabsEmbeddings¶
class langchain.embeddings.johnsnowlabs.JohnSnowLabsEmbeddings[source]¶
Bases: BaseModel, Embeddings
JohnSnowLabs embedding models
To use, you should have the johnsnowlabs python package installed.
.. rubric:: Example
from langchain.embeddings.johnsnowlabs impor... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.johnsnowlabs.JohnSnowLabsEmbeddings.html |
e574a30dc35d-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/embeddings/langchain.embeddings.johnsnowlabs.JohnSnowLabsEmbeddings.html |
e574a30dc35d-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/embeddings/langchain.embeddings.johnsnowlabs.JohnSnowLabsEmbeddings.html |
2281b167db49-0 | langchain.embeddings.huggingface_hub.HuggingFaceHubEmbeddings¶
class langchain.embeddings.huggingface_hub.HuggingFaceHubEmbeddings[source]¶
Bases: BaseModel, Embeddings
HuggingFaceHub embedding models.
To use, you should have the huggingface_hub python package installed, and the
environment variable HUGGINGFACEHUB_API_... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.huggingface_hub.HuggingFaceHubEmbeddings.html |
2281b167db49-1 | Default values are respected, but no other validation is performed.
Behaves as if Config.extra = ‘allow’ was set since it adds all passed values
copy(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, update: Optional[DictStrAny... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.huggingface_hub.HuggingFaceHubEmbeddings.html |
2281b167db49-2 | Parameters
text – The text to embed.
Returns
Embeddings for the text.
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, ... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.huggingface_hub.HuggingFaceHubEmbeddings.html |
b27e45427fbf-0 | langchain.embeddings.google_palm.GooglePalmEmbeddings¶
class langchain.embeddings.google_palm.GooglePalmEmbeddings[source]¶
Bases: BaseModel, Embeddings
Google’s PaLM Embeddings APIs.
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parse... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.google_palm.GooglePalmEmbeddings.html |
b27e45427fbf-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/embeddings/langchain.embeddings.google_palm.GooglePalmEmbeddings.html |
b27e45427fbf-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/embeddings/langchain.embeddings.google_palm.GooglePalmEmbeddings.html |
f6c45b5dbd77-0 | langchain.embeddings.openai.embed_with_retry¶
langchain.embeddings.openai.embed_with_retry(embeddings: OpenAIEmbeddings, **kwargs: Any) → Any[source]¶
Use tenacity to retry the embedding call. | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.openai.embed_with_retry.html |
b0368aa9d46b-0 | langchain.embeddings.sagemaker_endpoint.EmbeddingsContentHandler¶
class langchain.embeddings.sagemaker_endpoint.EmbeddingsContentHandler[source]¶
Content handler for LLM class.
Attributes
accepts
The MIME type of the response data returned from endpoint
content_type
The MIME type of the input data passed to endpoint
Me... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.sagemaker_endpoint.EmbeddingsContentHandler.html |
7ebafe3fd2f2-0 | langchain.embeddings.tensorflow_hub.TensorflowHubEmbeddings¶
class langchain.embeddings.tensorflow_hub.TensorflowHubEmbeddings[source]¶
Bases: BaseModel, Embeddings
TensorflowHub embedding models.
To use, you should have the tensorflow_text python package installed.
Example
from langchain.embeddings import TensorflowHu... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.tensorflow_hub.TensorflowHubEmbeddings.html |
7ebafe3fd2f2-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/embeddings/langchain.embeddings.tensorflow_hub.TensorflowHubEmbeddings.html |
7ebafe3fd2f2-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/embeddings/langchain.embeddings.tensorflow_hub.TensorflowHubEmbeddings.html |
11e2698f652d-0 | langchain.embeddings.spacy_embeddings.SpacyEmbeddings¶
class langchain.embeddings.spacy_embeddings.SpacyEmbeddings[source]¶
Bases: BaseModel, Embeddings
Embeddings by SpaCy models.
It only supports the ‘en_core_web_sm’ model.
nlp¶
The Spacy model loaded into memory.
Type
Any
embed_documents(texts
List[str]) -> List[Lis... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.spacy_embeddings.SpacyEmbeddings.html |
11e2698f652d-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/embeddings/langchain.embeddings.spacy_embeddings.SpacyEmbeddings.html |
11e2698f652d-2 | The embedding for the text.
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_defau... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.spacy_embeddings.SpacyEmbeddings.html |
1b74587d3f10-0 | langchain.embeddings.gradient_ai.TinyAsyncGradientEmbeddingClient¶
class langchain.embeddings.gradient_ai.TinyAsyncGradientEmbeddingClient(access_token: Optional[str] = None, workspace_id: Optional[str] = None, host: str = 'https://api.gradient.ai/api', aiosession: Optional[ClientSession] = None)[source]¶
A helper tool... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.gradient_ai.TinyAsyncGradientEmbeddingClient.html |
1b74587d3f10-1 | texts (List[str]) – List of sentences to embed.
Returns
List of vectors for each sentence
Return type
List[List[float]]
embed(model: str, texts: List[str]) → List[List[float]][source]¶
call the embedding of model
Parameters
model (str) – to embedding model
texts (List[str]) – List of sentences to embed.
Returns
List of... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.gradient_ai.TinyAsyncGradientEmbeddingClient.html |
190ba94e020b-0 | langchain.embeddings.self_hosted.SelfHostedEmbeddings¶
class langchain.embeddings.self_hosted.SelfHostedEmbeddings[source]¶
Bases: SelfHostedPipeline, Embeddings
Custom embedding models on self-hosted remote hardware.
Supported hardware includes auto-launched instances on AWS, GCP, Azure,
and Lambda, as well as servers... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-1 | pipeline="models/pipeline.pkl",
hardware=gpu,
model_reqs=["./", "torch", "transformers"],
)
Init the pipeline with an auxiliary function.
The load function must be in global scope to be imported
and run on the server, i.e. in a module and not a REPL or closure.
Then, initialize the remote inference function.
pa... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-2 | Check Cache and run the LLM on the given prompt and input.
async abatch(inputs: List[Union[PromptValue, str, List[BaseMessage]]], config: Optional[Union[RunnableConfig, List[RunnableConfig]]] = None, *, return_exceptions: bool = False, **kwargs: Any) → List[str]¶
Default implementation runs ainvoke in parallel using as... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-3 | Asynchronously pass a sequence of prompts and return model generations.
This method should make use of batched calls for models that expose a batched
API.
Use this method when you want to:
take advantage of batched calls,
need more output from the model than just the top generated value,
are building chains that are ag... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-4 | Parameters
text – String input to pass to the model.
stop – Stop words to use when generating. Model output is cut off at the
first occurrence of any of these substrings.
**kwargs – Arbitrary additional keyword arguments. These are usually passed
to the model provider API call.
Returns
Top model prediction as a string.... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-5 | Stream all output from a runnable, as reported to the callback system.
This includes all inner runs of LLMs, Retrievers, Tools, etc.
Output is streamed as Log objects, which include a list of
jsonpatch ops that describe how the state of the run has changed in each
step, and the final state of the run.
The jsonpatch ops... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-6 | Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, default_key: str = 'default', **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶
configurable_fields(**kwargs: Union[ConfigurableField, C... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-7 | Parameters
texts – The list of texts to embed.s
Returns
List of embeddings, one for each text.
embed_query(text: str) → List[float][source]¶
Compute query embeddings using a HuggingFace transformer model.
Parameters
text – The text to embed.
Returns
Embeddings for the text.
classmethod from_orm(obj: Any) → Model¶
class... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-8 | need more output from the model than just the top generated value,
are building chains that are agnostic to the underlying language modeltype (e.g., pure text completion models vs chat models).
Parameters
prompts – List of PromptValues. A PromptValue is an object that can be
converted to match the format of any languag... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-9 | Useful for checking if an input will fit in a model’s context window.
Parameters
text – The string input to tokenize.
Returns
The integer number of tokens in the text.
get_num_tokens_from_messages(messages: List[BaseMessage]) → int¶
Get the number of tokens in the messages.
Useful for checking if an input will fit in a... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-10 | purposes, ‘max_concurrency’ for controlling how much work to do
in parallel, and other keys. Please refer to the RunnableConfig
for more details.
Returns
The output of the runnable.
classmethod is_lc_serializable() → bool¶
Is this class serializable?
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]]... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-11 | predict(text: str, *, stop: Optional[Sequence[str]] = None, **kwargs: Any) → str¶
Pass a single string input to the model and return a string prediction.
Use this method when passing in raw text. If you want to pass in specifictypes of chat messages, use predict_messages.
Parameters
text – String input to pass to the m... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-12 | stream(input: Union[PromptValue, str, List[BaseMessage]], config: Optional[RunnableConfig] = None, *, stop: Optional[List[str]] = None, **kwargs: Any) → Iterator[str]¶
Default implementation of stream, which calls invoke.
Subclasses should override this method if they support streaming output.
to_json() → Union[Seriali... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-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/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
190ba94e020b-14 | 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 model.
property lc_attributes: Dict¶
List of attribute names that should b... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.self_hosted.SelfHostedEmbeddings.html |
0c32a81a212d-0 | langchain.embeddings.fake.FakeEmbeddings¶
class langchain.embeddings.fake.FakeEmbeddings[source]¶
Bases: Embeddings, BaseModel
Fake embedding model.
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 size... | lang/api.python.langchain.com/en/latest/embeddings/langchain.embeddings.fake.FakeEmbeddings.html |
0c32a81a212d-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/embeddings/langchain.embeddings.fake.FakeEmbeddings.html |
0c32a81a212d-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/embeddings/langchain.embeddings.fake.FakeEmbeddings.html |
9f10204d99b5-0 | langchain_experimental.cpal.models.InterventionModel¶
class langchain_experimental.cpal.models.InterventionModel[source]¶
Bases: BaseModel
aka initial conditions
>>> intervention.dict()
{
entity_settings: [
{"name": "bud", "attribute": "pet_count", "value": 12},
{"name": "pat", "attribute": "pet_cou... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.models.InterventionModel.html |
9f10204d99b5-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/cpal/langchain_experimental.cpal.models.InterventionModel.html |
9f10204d99b5-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.models.InterventionModel.html |
3c42d772697c-0 | langchain_experimental.cpal.models.ResultModel¶
class langchain_experimental.cpal.models.ResultModel[source]¶
Bases: BaseModel
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 question: str [Required] (... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.models.ResultModel.html |
3c42d772697c-1 | Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
classmethod from_orm(obj: Any) → Model¶
json(*, include: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, exclude: Optional[Union[AbstractSetIntStr, MappingIntStrAny]] = None, by_alias: bool = False,... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.models.ResultModel.html |
758c3139b004-0 | langchain_experimental.cpal.models.CausalModel¶
class langchain_experimental.cpal.models.CausalModel[source]¶
Bases: BaseModel
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 attribute: str [Required]¶... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.models.CausalModel.html |
758c3139b004-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/cpal/langchain_experimental.cpal.models.CausalModel.html |
758c3139b004-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.models.CausalModel.html |
cd9b88fa0020-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_... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.constants.Constant.html |
a1935f10af0e-0 | langchain_experimental.cpal.base.NarrativeChain¶
class langchain_experimental.cpal.base.NarrativeChain[source]¶
Bases: _BaseStoryElementChain
Decompose the narrative into its story elements
causal model
query
intervention
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationE... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-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 ... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-5 | Stream all output from a runnable, as reported to the callback system.
This includes all inner runs of LLMs, Retrievers, Tools, etc.
Output is streamed as Log objects, which include a list of
jsonpatch ops that describe how the state of the run has changed in each
step, and the final state of the run.
The jsonpatch ops... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-6 | Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, default_key: str = 'default', **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶
configurable_fields(**kwargs: Union[ConfigurableField, C... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-7 | method.
Returns
A dictionary representation of the chain.
Example
chain.dict(exclude_unset=True)
# -> {"_type": "foo", "verbose": False, ...}
classmethod from_orm(obj: Any) → Model¶
classmethod from_univariate_prompt(llm: BaseLanguageModel, **kwargs: Any) → Any¶
get_input_schema(config: Optional[RunnableConfig] = None)... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-8 | Transform a single input into an output. Override to implement.
Parameters
input – The input to the runnable.
config – A config to use when invoking the runnable.
The config supports standard keys like ‘tags’, ‘metadata’ for tracing
purposes, ‘max_concurrency’ for controlling how much work to do
in parallel, and other ... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-9 | 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 parser() → PydanticOutputParser¶
Parse LLM output into a pydantic object.
prep_inputs(inputs: Union[D... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-10 | with all the inputs
Parameters
*args – If the chain expects a single input, it can be passed in as the
sole positional argument.
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 call... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-11 | stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Default implementation of stream, which calls invoke.
Subclasses should override this method if they support streaming output.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implem... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-12 | Bind lifecycle listeners to a Runnable, returning a new Runnable.
on_start: Called before the runnable starts running, with the Run object.
on_end: Called after the runnable finishes running, with the Run object.
on_error: Called if the runnable throws an error, with the Run object.
The Run object contains information ... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-13 | property input_schema: Type[pydantic.main.BaseModel]¶
The type of input this runnable accepts specified as a pydantic model.
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]¶
... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-14 | template: ClassVar[str] = 'Split the given text into three parts: the question, the story_hypothetical, and the logic. Don\'t guess at any of the parts. Write NONE if you are unsure.\n\n{format_instructions}\n\n\n\nQ: Boris has seven times the number of pets as Marcia. Jan has three times the number of pets as Marcia. ... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-15 | candy, then how many pounds of candy will andy have?\n\n\n\n\n\n# JSON\n\n\n\n\n{{\n "story_outcome_question": "how many pounds of candy will andy have?",\n "story_hypothetical": "If boris has 100 pounds of candy and marcia has 200 pounds of candy"\n "story_plot": "boris gives ten percent of his candy to marci... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
a1935f10af0e-16 | meta private: | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.NarrativeChain.html |
35cc8fe60d71-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-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 ... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-5 | Stream all output from a runnable, as reported to the callback system.
This includes all inner runs of LLMs, Retrievers, Tools, etc.
Output is streamed as Log objects, which include a list of
jsonpatch ops that describe how the state of the run has changed in each
step, and the final state of the run.
The jsonpatch ops... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-6 | Returns
A pydantic model that can be used to validate config.
configurable_alternatives(which: ConfigurableField, default_key: str = 'default', **kwargs: Union[Runnable[Input, Output], Callable[[], Runnable[Input, Output]]]) → RunnableSerializable[Input, Output]¶
configurable_fields(**kwargs: Union[ConfigurableField, C... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-7 | method.
Returns
A dictionary representation of the chain.
Example
chain.dict(exclude_unset=True)
# -> {"_type": "foo", "verbose": False, ...}
classmethod from_orm(obj: Any) → Model¶
classmethod from_univariate_prompt(llm: BaseLanguageModel, **kwargs: Any) → Any¶
get_input_schema(config: Optional[RunnableConfig] = None)... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-8 | Transform a single input into an output. Override to implement.
Parameters
input – The input to the runnable.
config – A config to use when invoking the runnable.
The config supports standard keys like ‘tags’, ‘metadata’ for tracing
purposes, ‘max_concurrency’ for controlling how much work to do
in parallel, and other ... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-9 | 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 parser() → PydanticOutputParser¶
Parse LLM output into a pydantic object.
prep_inputs(inputs: Union[D... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-10 | with all the inputs
Parameters
*args – If the chain expects a single input, it can be passed in as the
sole positional argument.
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 call... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-11 | stream(input: Input, config: Optional[RunnableConfig] = None, **kwargs: Optional[Any]) → Iterator[Output]¶
Default implementation of stream, which calls invoke.
Subclasses should override this method if they support streaming output.
to_json() → Union[SerializedConstructor, SerializedNotImplemented]¶
to_json_not_implem... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-12 | Bind lifecycle listeners to a Runnable, returning a new Runnable.
on_start: Called before the runnable starts running, with the Run object.
on_end: Called after the runnable finishes running, with the Run object.
on_error: Called if the runnable throws an error, with the Run object.
The Run object contains information ... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
35cc8fe60d71-13 | property input_schema: Type[pydantic.main.BaseModel]¶
The type of input this runnable accepts specified as a pydantic model.
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]¶
... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.InterventionChain.html |
b33b070f8c5c-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-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 ... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-5 | Subclasses should override this method if they support streaming output.
async astream_log(input: Any, config: Optional[RunnableConfig] = None, *, diff: bool = True, include_names: Optional[Sequence[str]] = None, include_types: Optional[Sequence[str]] = None, include_tags: Optional[Sequence[str]] = None, exclude_names:... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-6 | e.g., if the underlying runnable uses an API which supports a batch mode.
bind(**kwargs: Any) → Runnable[Input, Output]¶
Bind arguments to a Runnable, returning a new Runnable.
config_schema(*, include: Optional[Sequence[str]] = None) → Type[BaseModel]¶
The type of config this runnable accepts specified as a pydantic m... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-7 | 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
dict(**kw... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-8 | Get a pydantic model that can be used to validate output to the runnable.
Runnables that leverage the configurable_fields and configurable_alternatives
methods will have a dynamic output schema that depends on which
configuration the runnable is invoked with.
This method allows to get an output schema for a specific co... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-9 | classmethod lc_id() → List[str]¶
A unique identifier for this class for serialization purposes.
The unique identifier is a list of strings that describes the path
to the object.
map() → Runnable[List[Input], List[Output]]¶
Return a new Runnable that maps a list of inputs to a list of outputs,
by calling invoke() with e... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-10 | inputs are also added to the final outputs.
Returns
A dict of the final chain outputs.
run(*args: Any, callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, tags: Optional[List[str]] = None, metadata: Optional[Dict[str, Any]] = None, **kwargs: Any) → Any¶
Convenience method for executing ch... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-11 | chain.run(question=question, context=context)
# -> "The temperature in Boise is..."
save(file_path: Union[Path, str]) → None¶
Save the chain.
Expects Chain._chain_type property to be implemented and for memory to benull.
Parameters
file_path – Path to file to save the chain to.
Example
chain.save(file_path="path/chain.... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-12 | Bind config to a Runnable, returning a new Runnable.
with_fallbacks(fallbacks: Sequence[Runnable[Input, Output]], *, exceptions_to_handle: Tuple[Type[BaseException], ...] = (<class 'Exception'>,)) → RunnableWithFallbacksT[Input, Output]¶
Add fallbacks to a runnable, returning a new Runnable.
Parameters
fallbacks – A se... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-13 | between retries
stop_after_attempt – The maximum number of attempts to make before giving up
Returns
A new Runnable that retries the original runnable on exceptions.
with_types(*, input_type: Optional[Type[Input]] = None, output_type: Optional[Type[Output]] = None) → Runnable[Input, Output]¶
Bind input and output types... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-14 | 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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
b33b070f8c5c-15 | 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... | lang/api.python.langchain.com/en/latest/cpal/langchain_experimental.cpal.base.QueryChain.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.