Home / Class/ CotQAEvalChain Class — langchain Architecture

CotQAEvalChain Class — langchain Architecture

Architecture documentation for the CotQAEvalChain class in eval_chain.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8092ea8a_fc95_f2f7_c8e2_4595bb9d5b9e["CotQAEvalChain"]
  6b783916_2e41_8d2a_dba2_81813096b7c4["ContextQAEvalChain"]
  8092ea8a_fc95_f2f7_c8e2_4595bb9d5b9e -->|extends| 6b783916_2e41_8d2a_dba2_81813096b7c4
  514ad815_2197_8c98_58ac_640cc349a6ab["eval_chain.py"]
  8092ea8a_fc95_f2f7_c8e2_4595bb9d5b9e -->|defined in| 514ad815_2197_8c98_58ac_640cc349a6ab
  5f28ef0e_88cf_c703_bdbc_be85584de36b["is_lc_serializable()"]
  8092ea8a_fc95_f2f7_c8e2_4595bb9d5b9e -->|method| 5f28ef0e_88cf_c703_bdbc_be85584de36b
  c67decbf_1b50_ba6b_3cfd_7f71ac4b2e74["evaluation_name()"]
  8092ea8a_fc95_f2f7_c8e2_4595bb9d5b9e -->|method| c67decbf_1b50_ba6b_3cfd_7f71ac4b2e74
  80297720_85ce_00c4_c038_befbdc6c8ea0["from_llm()"]
  8092ea8a_fc95_f2f7_c8e2_4595bb9d5b9e -->|method| 80297720_85ce_00c4_c038_befbdc6c8ea0

Relationship Graph

Source Code

libs/langchain/langchain_classic/evaluation/qa/eval_chain.py lines 350–373

class CotQAEvalChain(ContextQAEvalChain):
    """LLM Chain for evaluating QA using chain of thought reasoning."""

    @classmethod
    @override
    def is_lc_serializable(cls) -> bool:
        return False

    @property
    @override
    def evaluation_name(self) -> str:
        return "COT Contextual Accuracy"

    @classmethod
    def from_llm(
        cls,
        llm: BaseLanguageModel,
        prompt: PromptTemplate | None = None,
        **kwargs: Any,
    ) -> CotQAEvalChain:
        """Load QA Eval Chain from LLM."""
        prompt = prompt or COT_PROMPT
        cls._validate_input_vars(prompt)
        return cls(llm=llm, prompt=prompt, **kwargs)

Frequently Asked Questions

What is the CotQAEvalChain class?
CotQAEvalChain is a class in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/qa/eval_chain.py.
Where is CotQAEvalChain defined?
CotQAEvalChain is defined in libs/langchain/langchain_classic/evaluation/qa/eval_chain.py at line 350.
What does CotQAEvalChain extend?
CotQAEvalChain extends ContextQAEvalChain.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free