check_examples_and_selector() — langchain Function Reference
Architecture documentation for the check_examples_and_selector() function in few_shot.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD deccb127_18eb_192f_bd33_2fbb22993cea["check_examples_and_selector()"] 972b6cbc_5332_c857_8cbe_3487a7c6b06e["_FewShotPromptTemplateMixin"] deccb127_18eb_192f_bd33_2fbb22993cea -->|defined in| 972b6cbc_5332_c857_8cbe_3487a7c6b06e style deccb127_18eb_192f_bd33_2fbb22993cea fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/prompts/few_shot.py lines 55–79
def check_examples_and_selector(cls, values: dict) -> Any:
"""Check that one and only one of `examples`/`example_selector` are provided.
Args:
values: The values to check.
Returns:
The values if they are valid.
Raises:
ValueError: If neither or both `examples` and `example_selector` are
provided.
ValueError: If both `examples` and `example_selector` are provided.
"""
examples = values.get("examples")
example_selector = values.get("example_selector")
if examples and example_selector:
msg = "Only one of 'examples' and 'example_selector' should be provided"
raise ValueError(msg)
if examples is None and example_selector is None:
msg = "One of 'examples' and 'example_selector' should be provided"
raise ValueError(msg)
return values
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does check_examples_and_selector() do?
check_examples_and_selector() is a function in the langchain codebase, defined in libs/core/langchain_core/prompts/few_shot.py.
Where is check_examples_and_selector() defined?
check_examples_and_selector() is defined in libs/core/langchain_core/prompts/few_shot.py at line 55.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free