from_examples(
cls,
examples: list[dict],
embeddings: Embeddings,
vectorstore_cls: | Name | Type | Description |
|---|---|---|
examples* | list[dict] | List of examples to use in the prompt. |
embeddings* | Embeddings | An initialized embedding API interface, e.g. OpenAIEmbeddings(). |
vectorstore_cls* | type[VectorStore] | A vector store DB interface class, e.g. FAISS. |
k | int | Default: 4 |
fetch_k | int | Default: 20 |
input_keys | list[str] | None | Default: None |
example_keys | list[str] | None | Default: None |
vectorstore_kwargs | dict | None | Default: None |
vectorstore_cls_kwargs | Any | Default: {} |
Create k-shot example selector using example list and embeddings.
Reshuffles examples dynamically based on Max Marginal Relevance.
Number of examples to select.
Number of Document objects to fetch to pass to MMR algorithm.
If provided, the search is based on the input variables instead of all variables.
If provided, keys to filter examples to.
Extra arguments passed to similarity_search function
of the VectorStore.
optional kwargs containing url for vector store