id
stringlengths
14
16
text
stringlengths
13
2.7k
source
stringlengths
57
178
7ddb0f2dd656-1
classmethod from_language(language: Language, **kwargs: Any) → RecursiveCharacterTextSplitter¶ 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...
lang/api.python.langchain.com/en/latest/text_splitter/langchain.text_splitter.LatexTextSplitter.html
07cd57351492-0
langchain.text_splitter.Tokenizer¶ class langchain.text_splitter.Tokenizer(chunk_overlap: int, tokens_per_chunk: int, decode: Callable[[List[int]], str], encode: Callable[[str], List[int]])[source]¶ Tokenizer data class. Attributes chunk_overlap Overlap in tokens between chunks tokens_per_chunk Maximum number of tokens...
lang/api.python.langchain.com/en/latest/text_splitter/langchain.text_splitter.Tokenizer.html
ac102e292f04-0
langchain.text_splitter.TokenTextSplitter¶ class langchain.text_splitter.TokenTextSplitter(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)[source]¶ Splitting t...
lang/api.python.langchain.com/en/latest/text_splitter/langchain.text_splitter.TokenTextSplitter.html
ac102e292f04-1
Create documents from a list of texts. classmethod from_huggingface_tokenizer(tokenizer: Any, **kwargs: Any) → TextSplitter¶ Text splitter that uses HuggingFace tokenizer to count length. classmethod from_tiktoken_encoder(encoding_name: str = 'gpt2', model_name: Optional[str] = None, allowed_special: Union[Literal['all...
lang/api.python.langchain.com/en/latest/text_splitter/langchain.text_splitter.TokenTextSplitter.html
9fbbb3514599-0
langchain.text_splitter.ElementType¶ class langchain.text_splitter.ElementType[source]¶ Element type as typed dict. url: str¶ xpath: str¶ content: str¶ metadata: Dict[str, str]¶
lang/api.python.langchain.com/en/latest/text_splitter/langchain.text_splitter.ElementType.html
8e0c909da5fb-0
langchain.text_splitter.HeaderType¶ class langchain.text_splitter.HeaderType[source]¶ Header type as typed dict. level: int¶ name: str¶ data: str¶
lang/api.python.langchain.com/en/latest/text_splitter/langchain.text_splitter.HeaderType.html
102b9a581418-0
langchain.text_splitter.split_text_on_tokens¶ langchain.text_splitter.split_text_on_tokens(*, text: str, tokenizer: Tokenizer) → List[str][source]¶ Split incoming text and return chunks using tokenizer.
lang/api.python.langchain.com/en/latest/text_splitter/langchain.text_splitter.split_text_on_tokens.html
bc4fa8ec001f-0
langchain.text_splitter.CharacterTextSplitter¶ class langchain.text_splitter.CharacterTextSplitter(separator: str = '\n\n', is_separator_regex: bool = False, **kwargs: Any)[source]¶ Splitting text that looks at characters. Create a new TextSplitter. Methods __init__([separator, is_separator_regex]) Create a new TextSpl...
lang/api.python.langchain.com/en/latest/text_splitter/langchain.text_splitter.CharacterTextSplitter.html
bc4fa8ec001f-1
Text splitter that uses HuggingFace tokenizer to count length. 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 spl...
lang/api.python.langchain.com/en/latest/text_splitter/langchain.text_splitter.CharacterTextSplitter.html
bc4fa8ec001f-2
MongoDB Atlas Meilisearch Figma Psychic Manifest LLM Caching integrations Set env var OPENAI_API_KEY or load from a .env file Conversational Retrieval Agent Retrieve from vector stores directly Improve document indexing with HyDE Analysis of Twitter the-algorithm source code with LangChain, GPT4 and Activeloop’s Deep L...
lang/api.python.langchain.com/en/latest/text_splitter/langchain.text_splitter.CharacterTextSplitter.html
4f5a09aef4b4-0
langchain.hub.pull¶ langchain.hub.pull(owner_repo_commit: str, *, api_url: Optional[str] = None, api_key: Optional[str] = None) → Any[source]¶ Pulls an object from the hub and returns it as a LangChain object. Parameters owner_repo_commit – The full name of the repo to pull from in the format of owner/repo:commit_hash....
lang/api.python.langchain.com/en/latest/hub/langchain.hub.pull.html
884cb0457d4d-0
langchain.hub.push¶ langchain.hub.push(repo_full_name: str, object: Any, *, api_url: Optional[str] = None, api_key: Optional[str] = None, parent_commit_hash: Optional[str] = 'latest', new_repo_is_public: bool = True, new_repo_description: str = '') → str[source]¶ Pushes an object to the hub and returns the URL it can b...
lang/api.python.langchain.com/en/latest/hub/langchain.hub.push.html
f5f8e22590b4-0
langchain.smith.evaluation.runner_utils.TestResult¶ class langchain.smith.evaluation.runner_utils.TestResult[source]¶ A dictionary of the results of a single test run. Methods __init__(*args, **kwargs) clear() copy() fromkeys([value]) Create a new dictionary with keys from iterable and values set to value. get(key[, de...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.runner_utils.TestResult.html
f5f8e22590b4-1
Return the value for key if key is in the dictionary, else default. get_aggregate_feedback(quantiles: Optional[Sequence[float]] = None) → pd.DataFrame[source]¶ Return quantiles for the feedback scores. This method calculates and prints the quantiles for the feedback scores across all feedback keys. Returns A DataFrame ...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.runner_utils.TestResult.html
b7b6d8b0c672-0
langchain.smith.evaluation.config.EvalConfig¶ class langchain.smith.evaluation.config.EvalConfig[source]¶ Bases: BaseModel Configuration for a given run evaluator. Parameters evaluator_type (EvaluatorType) – The type of evaluator to use. get_kwargs()[source]¶ Get the keyword arguments for the evaluator configuration. C...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.EvalConfig.html
b7b6d8b0c672-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/smith/langchain.smith.evaluation.config.EvalConfig.html
b7b6d8b0c672-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/smith/langchain.smith.evaluation.config.EvalConfig.html
c6bee0e41e99-0
langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain¶ class langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain[source]¶ Bases: Chain, RunEvaluator Evaluate Run and optional examples. Create a new model by parsing and validating input data from keyword arguments. Raises Validation...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-1
The name of the evaluation metric. param run_mapper: StringRunMapper [Required]¶ Maps the Run to a dictionary with ‘input’ and ‘prediction’ strings. param string_evaluator: StringEvaluator [Required]¶ The evaluation chain. param tags: Optional[List[str]] = None¶ Optional list of tags associated with the chain. Defaults...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-2
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/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-3
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 addition to callbacks passed to the chain during construction, but only ...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-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/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-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/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-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/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-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/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-8
input_key (str, optional) – The key used to map the input from the run. prediction_key (str, optional) – The key used to map the prediction from the run. reference_key (str, optional) – The key used to map the reference from the dataset. tags (List[str], optional) – List of tags to attach to the evaluation chain. Retur...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-9
This method allows to get an output 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 output. invoke(input: Dict[str, Any], config: Optional[RunnableConfig] = None, **kwargs: Any) → Dict[str, Any]¶ Transform a singl...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-10
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 each input. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool =...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-11
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 chain. The main difference between this method...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-12
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.yaml") classmethod schema(by_alias: bool = True, ref_template: unicode = '#/definiti...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-13
Add fallbacks to a runnable, returning a new Runnable. Parameters fallbacks – A sequence of runnables to try if the original runnable fails. exceptions_to_handle – A tuple of exception types to handle. Returns A new Runnable that will try the original runnable, and then each fallback in order, upon failures. with_liste...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
c6bee0e41e99-14
Bind input and output types to a Runnable, returning a new Runnable. property InputType: Type[langchain.schema.runnable.utils.Input]¶ The type of input this runnable accepts specified as a type annotation. property OutputType: Type[langchain.schema.runnable.utils.Output]¶ The type of output this runnable produces speci...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunEvaluatorChain.html
d878661438b2-0
langchain.smith.evaluation.string_run_evaluator.ChainStringRunMapper¶ class langchain.smith.evaluation.string_run_evaluator.ChainStringRunMapper[source]¶ Bases: StringRunMapper Extract items to evaluate from the run object from a chain. Create a new model by parsing and validating input data from keyword arguments. Rai...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.ChainStringRunMapper.html
d878661438b2-1
exclude – fields to exclude from new model, as with values this takes precedence over include update – values to change/add in the new model. Note: the data is not validated before creating the new model: you should trust this data deep – set to True to make a deep copy of the model Returns new model instance dict(*, i...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.ChainStringRunMapper.html
d878661438b2-2
Generate a JSON representation of the model, include and exclude arguments as per dict(). encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps(). classmethod lc_id() → List[str]¶ A unique identifier for this class for serialization purposes. The unique identifier is a ...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.ChainStringRunMapper.html
d878661438b2-3
For example,{“openai_api_key”: “OPENAI_API_KEY”} property output_keys: List[str]¶ The keys to extract from the run.
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.ChainStringRunMapper.html
c1d39b3b03e1-0
langchain.smith.evaluation.string_run_evaluator.LLMStringRunMapper¶ class langchain.smith.evaluation.string_run_evaluator.LLMStringRunMapper[source]¶ Bases: StringRunMapper Extract items to evaluate from the run object. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationErr...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.LLMStringRunMapper.html
c1d39b3b03e1-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/smith/langchain.smith.evaluation.string_run_evaluator.LLMStringRunMapper.html
c1d39b3b03e1-2
The unique identifier is a list of strings that describes the path to the object. map(run: Run) → Dict[str, str][source]¶ Maps the Run to a dictionary. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.LLMStringRunMapper.html
c1d39b3b03e1-3
property output_keys: List[str]¶ The keys to extract from the run.
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.LLMStringRunMapper.html
3ccdfd4e760f-0
langchain.smith.evaluation.config.RunEvalConfig¶ class langchain.smith.evaluation.config.RunEvalConfig[source]¶ Bases: BaseModel Configuration for a run evaluation. Parameters evaluators (List[Union[EvaluatorType, EvalConfig]]) – Configurations for which evaluators to apply to the dataset run. Each can be the string of...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-1
The language model to pass to any evaluators that require one. param evaluators: List[Union[langchain.evaluation.schema.EvaluatorType, str, langchain.smith.evaluation.config.EvalConfig]] [Optional]¶ Configurations for which evaluators to apply to the dataset run. Each can be the string of an EvaluatorType, such as Eval...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-2
input. If not provided, it will be inferred automatically. param llm: Optional[langchain.schema.language_model.BaseLanguageModel] = None¶ param prediction_key: Optional[str] = None¶ The key from the traced run’s outputs dictionary to use to represent the prediction. If not provided, it will be inferred automatically. p...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-3
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/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-4
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/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-5
param prompt: Optional[langchain.schema.prompt_template.BasePromptTemplate] = None¶ param reference_key: Optional[str] = None¶ The key in the dataset run to use as the reference string. If not provided, we will attempt to infer automatically. classmethod construct(_fields_set: Optional[SetStr] = None, **values: Any) → ...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-6
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]...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-7
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 Criteria[source]¶ Bases: SingleKeyEvalConfig Configuration for a reference-free criteria evaluator. Parameters criteria (Optional[CRITERI...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-8
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/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-9
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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-10
Bases: SingleKeyEvalConfig Configuration for an embedding distance evaluator. Parameters embeddings (Optional[Embeddings]) – The embeddings to use for computing the distance. distance_metric (Optional[EmbeddingDistanceEnum]) – The distance metric to use for computing the distance. Create a new model by parsing and vali...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-11
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/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-12
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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-13
Bases: SingleKeyEvalConfig Configuration for an exact match string evaluator. Parameters ignore_case (bool) – Whether to ignore case when comparing strings. ignore_punctuation (bool) – Whether to ignore punctuation when comparing strings. ignore_numbers (bool) – Whether to ignore numbers when comparing strings. Create ...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-14
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/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-15
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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-16
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/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-17
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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-18
Bases: SingleKeyEvalConfig Configuration for a json validity evaluator. 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 evaluator_type: langchain.evaluation.schema.EvaluatorType = EvaluatorType.JSON_VA...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-19
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/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-20
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/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-21
param prediction_key: Optional[str] = None¶ The key from the traced run’s outputs dictionary to use to represent the prediction. If not provided, it will be inferred automatically. param reference_key: Optional[str] = None¶ The key in the dataset run to use as the reference string. If not provided, we will attempt to i...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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]...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
3ccdfd4e760f-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...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.RunEvalConfig.html
766d1815d98c-0
langchain.smith.evaluation.name_generation.random_name¶ langchain.smith.evaluation.name_generation.random_name(prefix: str = 'test') → str[source]¶ Generate a random name.
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.name_generation.random_name.html
1a27feef601f-0
langchain.smith.evaluation.runner_utils.InputFormatError¶ class langchain.smith.evaluation.runner_utils.InputFormatError[source]¶ Raised when the input format is invalid.
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.runner_utils.InputFormatError.html
79ac78b174f0-0
langchain.smith.evaluation.string_run_evaluator.ToolStringRunMapper¶ class langchain.smith.evaluation.string_run_evaluator.ToolStringRunMapper[source]¶ Bases: StringRunMapper Map an input to the tool. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the input dat...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.ToolStringRunMapper.html
79ac78b174f0-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/smith/langchain.smith.evaluation.string_run_evaluator.ToolStringRunMapper.html
79ac78b174f0-2
The unique identifier is a list of strings that describes the path to the object. map(run: Run) → Dict[str, str][source]¶ Maps the Run to a dictionary. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False) → Model¶...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.ToolStringRunMapper.html
b6d03b595ad1-0
langchain.smith.evaluation.runner_utils.run_on_dataset¶ langchain.smith.evaluation.runner_utils.run_on_dataset(client: Optional[Client], dataset_name: str, llm_or_chain_factory: Union[Callable[[], Union[Chain, Runnable]], BaseLanguageModel, Callable[[dict], Any], Runnable, Chain], *, evaluation: Optional[RunEvalConfig]...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.runner_utils.run_on_dataset.html
b6d03b595ad1-1
Examples from langsmith import Client from langchain.chat_models import ChatOpenAI from langchain.chains import LLMChain from langchain.smith import smith_eval.RunEvalConfig, run_on_dataset # Chains may have memory. Passing in a constructor function lets the # evaluation framework avoid cross-contamination between runs...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.runner_utils.run_on_dataset.html
b6d03b595ad1-2
return {"score": prediction == reference} evaluation_config = smith_eval.RunEvalConfig( custom_evaluators = [MyStringEvaluator()], ) run_on_dataset( client, "<my_dataset_name>", construct_chain, evaluation=evaluation_config, ) Examples using run_on_dataset¶ LangSmith Walkthrough
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.runner_utils.run_on_dataset.html
059b12f8d400-0
langchain.smith.evaluation.runner_utils.arun_on_dataset¶ async langchain.smith.evaluation.runner_utils.arun_on_dataset(client: Optional[Client], dataset_name: str, llm_or_chain_factory: Union[Callable[[], Union[Chain, Runnable]], BaseLanguageModel, Callable[[dict], Any], Runnable, Chain], *, evaluation: Optional[RunEva...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.runner_utils.arun_on_dataset.html
059b12f8d400-1
Examples from langsmith import Client from langchain.chat_models import ChatOpenAI from langchain.chains import LLMChain from langchain.smith import smith_eval.RunEvalConfig, run_on_dataset # Chains may have memory. Passing in a constructor function lets the # evaluation framework avoid cross-contamination between runs...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.runner_utils.arun_on_dataset.html
059b12f8d400-2
return {"score": prediction == reference} evaluation_config = smith_eval.RunEvalConfig( custom_evaluators = [MyStringEvaluator()], ) await arun_on_dataset( client, "<my_dataset_name>", construct_chain, evaluation=evaluation_config, ) Examples using arun_on_dataset¶ LangSmith Walkthrough
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.runner_utils.arun_on_dataset.html
927239efe8b0-0
langchain.smith.evaluation.string_run_evaluator.StringRunMapper¶ class langchain.smith.evaluation.string_run_evaluator.StringRunMapper[source]¶ Bases: Serializable Extract items to evaluate from the run object. Create a new model by parsing and validating input data from keyword arguments. Raises ValidationError if the...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunMapper.html
927239efe8b0-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/smith/langchain.smith.evaluation.string_run_evaluator.StringRunMapper.html
927239efe8b0-2
The unique identifier is a list of strings that describes the path to the object. abstract map(run: Run) → Dict[str, str][source]¶ Maps the Run to a dictionary. classmethod parse_file(path: Union[str, Path], *, content_type: unicode = None, encoding: unicode = 'utf8', proto: Protocol = None, allow_pickle: bool = False)...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.string_run_evaluator.StringRunMapper.html
6bf59dc7fa0b-0
langchain.smith.evaluation.progress.ProgressBarCallback¶ class langchain.smith.evaluation.progress.ProgressBarCallback(total: int, ncols: int = 50, **kwargs: Any)[source]¶ A simple progress bar for the console. Initialize the progress bar. Parameters total – int, the total number of items to be processed. ncols – int, ...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.progress.ProgressBarCallback.html
6bf59dc7fa0b-1
on_llm_new_token(token, *[, chunk, ...]) Run on new LLM token. on_llm_start(serialized, prompts, *, run_id) Run when LLM starts running. on_retriever_end(documents, *, run_id[, ...]) Run when Retriever ends running. on_retriever_error(error, *, run_id[, ...]) Run when Retriever errors. on_retriever_start(serialized, qu...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.progress.ProgressBarCallback.html
6bf59dc7fa0b-2
Run on agent end. on_chain_end(outputs: Dict[str, Any], *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any[source]¶ Run when chain ends running. on_chain_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any[source]¶ Run when chain errors. on_ch...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.progress.ProgressBarCallback.html
6bf59dc7fa0b-3
Run on new LLM token. Only available when streaming is enabled. Parameters token (str) – The new token. chunk (GenerationChunk | ChatGenerationChunk) – The new generated chunk, information. (containing content and other) – on_llm_start(serialized: Dict[str, Any], prompts: List[str], *, run_id: UUID, parent_run_id: Opt...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.progress.ProgressBarCallback.html
6bf59dc7fa0b-4
Run on arbitrary text. on_tool_end(output: str, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any[source]¶ Run when tool ends running. on_tool_error(error: BaseException, *, run_id: UUID, parent_run_id: Optional[UUID] = None, **kwargs: Any) → Any[source]¶ Run when tool errors. on_tool_start(se...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.progress.ProgressBarCallback.html
250271cdfbb1-0
langchain.smith.evaluation.config.SingleKeyEvalConfig¶ class langchain.smith.evaluation.config.SingleKeyEvalConfig[source]¶ Bases: EvalConfig 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 evaluator_t...
lang/api.python.langchain.com/en/latest/smith/langchain.smith.evaluation.config.SingleKeyEvalConfig.html