langchain.model_laboratory
.ModelLaboratory¶
- class langchain.model_laboratory.ModelLaboratory(chains: Sequence[Chain], names: Optional[List[str]] = 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: Optional[List[str]] = None)[source]¶
Initialize with chains to experiment with.
- Parameters
chains (Sequence[Chain]) – list of chains to experiment with.
names (Optional[List[str]]) –
- 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: Optional[PromptTemplate] = None) ModelLaboratory [source]¶
Initialize with LLMs to experiment with and optional prompt.
- Parameters
llms (List[BaseLLM]) – list of LLMs to experiment with
prompt (Optional[PromptTemplate]) – 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