ModelLaboratory#
- class langchain.model_laboratory.ModelLaboratory(chains: Sequence[Chain], names: List[str] | None = None)[source]#
Experiment with different models.
Initialize with chains to experiment with.
- Parameters:
chains (Sequence[Chain]) β list of chains to experiment with.
names (Optional[List[str]]) β
Methods
__init__
(chains[,Β names])Initialize with chains to experiment with.
compare
(text)Compare model outputs on an input text.
from_llms
(llms[,Β prompt])Initialize with LLMs to experiment with and optional prompt.
- __init__(chains: Sequence[Chain], names: List[str] | None = None)[source]#
Initialize with chains to experiment with.
- Parameters:
chains (Sequence[Chain]) β list of chains to experiment with.
names (List[str] | None) β
- compare(text: str) None [source]#
Compare model outputs on an input text.
If a prompt was provided with starting the laboratory, then this text will be fed into the prompt. If no prompt was provided, then the input text is the entire prompt.
- Parameters:
text (str) β input text to run all models on.
- Return type:
None
- classmethod from_llms(llms: List[BaseLLM], prompt: PromptTemplate | None = None) ModelLaboratory [source]#
Initialize with LLMs to experiment with and optional prompt.
- Parameters:
llms (List[BaseLLM]) β list of LLMs to experiment with
prompt (PromptTemplate | None) β Optional prompt to use to prompt the LLMs. Defaults to None. If a prompt was provided, it should only have one input variable.
- Return type:
Examples using ModelLaboratory