Home / Function/ _aevaluate_agent_trajectory() — langchain Function Reference

_aevaluate_agent_trajectory() — langchain Function Reference

Architecture documentation for the _aevaluate_agent_trajectory() function in trajectory_eval_chain.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  44628635_1e0c_b92e_8aa5_3a4e76f50ba0["_aevaluate_agent_trajectory()"]
  9066f65c_c5a3_1534_5336_72609f4ff02b["TrajectoryEvalChain"]
  44628635_1e0c_b92e_8aa5_3a4e76f50ba0 -->|defined in| 9066f65c_c5a3_1534_5336_72609f4ff02b
  55207f35_65b3_64d0_f5f6_009c83675231["get_agent_trajectory()"]
  44628635_1e0c_b92e_8aa5_3a4e76f50ba0 -->|calls| 55207f35_65b3_64d0_f5f6_009c83675231
  style 44628635_1e0c_b92e_8aa5_3a4e76f50ba0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/evaluation/agents/trajectory_eval_chain.py lines 375–418

    async def _aevaluate_agent_trajectory(
        self,
        *,
        prediction: str,
        input: str,
        agent_trajectory: Sequence[tuple[AgentAction, str]],
        reference: str | None = None,
        callbacks: Callbacks = None,
        tags: list[str] | None = None,
        metadata: dict[str, Any] | None = None,
        include_run_info: bool = False,
        **kwargs: Any,
    ) -> dict:
        """Asynchronously evaluate a trajectory.

        Args:
            prediction: The final predicted response.
            input: The input to the agent.
            agent_trajectory: The intermediate steps forming the agent trajectory.
            reference: The reference answer.
            callbacks: Callbacks to use for this chain run.
            tags: The tags to apply.
            metadata: The metadata to use.
            include_run_info: Whether to include run info in the output.
            **kwargs: Additional keyword arguments.

        Returns:
            The evaluation result, which includes the score and optionally
                the reasoning for reaching that.
        """
        inputs = {
            "question": input,
            "agent_trajectory": self.get_agent_trajectory(agent_trajectory),
            "answer": prediction,
            "reference": reference,
        }
        return await self.acall(
            inputs=inputs,
            callbacks=callbacks,
            tags=tags,
            metadata=metadata,
            include_run_info=include_run_info,
            return_only_outputs=True,
        )

Domain

Subdomains

Frequently Asked Questions

What does _aevaluate_agent_trajectory() do?
_aevaluate_agent_trajectory() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/agents/trajectory_eval_chain.py.
Where is _aevaluate_agent_trajectory() defined?
_aevaluate_agent_trajectory() is defined in libs/langchain/langchain_classic/evaluation/agents/trajectory_eval_chain.py at line 375.
What does _aevaluate_agent_trajectory() call?
_aevaluate_agent_trajectory() calls 1 function(s): get_agent_trajectory.

Analyze Your Own Codebase

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

Try Supermodel Free