Files
langchain-python/langchain/evaluation/qa/generate_chain.py
T
2022-12-26 09:16:37 -05:00

18 lines
583 B
Python

"""LLM Chain specifically for generating examples for question answering."""
from __future__ import annotations
from typing import Any
from langchain.chains.llm import LLMChain
from langchain.evaluation.qa.generate_prompt import PROMPT
from langchain.llms.base import BaseLLM
class QAGenerateChain(LLMChain):
"""LLM Chain specifically for generating examples for question answering."""
@classmethod
def from_llm(cls, llm: BaseLLM, **kwargs: Any) -> QAGenerateChain:
"""Load QA Generate Chain from LLM."""
return cls(llm=llm, prompt=PROMPT, **kwargs)