Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãOPromptsPrompt templatesExample selectorsCustom example selectorSelect by lengthSelect by maximal marginal relevance (MMR)Select by n-gram overlapSelect by similarityLanguage modelsOutput parsersRetrievalChainsMemoryAgentsCallbacksModulesSecurityGuidesMoreModulesModel I/‚ÄãOPromptsExample selectorsCustom example selectorOn this pageCustom example selectorIn this tutorial, we'll create a custom example selector that selects examples randomly from a given list of examples.An ExampleSelector must implement two methods:An add_example method which takes in an example and adds it into the ExampleSelectorA select_examples method which takes in input variables (which are meant to be user input) and returns a list of examples to use in the few-shot prompt.Let's implement a custom ExampleSelector that just selects two examples at random.Note:
In this tutorial, we'll create a custom example selector that selects examples randomly from a given list of examples.
In this tutorial, we'll create a custom example selector that selects examples randomly from a given list of examples. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãOPromptsPrompt templatesExample selectorsCustom example selectorSelect by lengthSelect by maximal marginal relevance (MMR)Select by n-gram overlapSelect by similarityLanguage modelsOutput parsersRetrievalChainsMemoryAgentsCallbacksModulesSecurityGuidesMoreModulesModel I/‚ÄãOPromptsExample selectorsCustom example selectorOn this pageCustom example selectorIn this tutorial, we'll create a custom example selector that selects examples randomly from a given list of examples.An ExampleSelector must implement two methods:An add_example method which takes in an example and adds it into the ExampleSelectorA select_examples method which takes in input variables (which are meant to be user input) and returns a list of examples to use in the few-shot prompt.Let's implement a custom ExampleSelector that just selects two examples at random.Note: