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:

ModelLaboratory

Examples using ModelLaboratory