def from_llm_and_tools(
        cls,
        llm: BaseLanguageModel,
        tools: Optional[List[Tool]] = None,
        output_parser: Optional[ConvoJSONOutputParser] = None,
        prompt_template: str = PLANNING_PROMPT_TEMPLATE,
        input_variables: Optional[List[str]] = None,
        prompt: str = "",
        **kwargs: Any,
    ) -> ConversationalAgent:
        """Construct an agent from an LLM and tools."""
        tools = tools or []

        template = cls.get_prompt_template(
            template=prompt_template,
            input_variables=input_variables,
        )

        allowed_tools = {tool.name: tool for tool in tools}
        _output_parser = output_parser or ConvoJSONOutputParser()
        return cls(
            llm=llm,
            allowed_tools=allowed_tools,
            output_parser=_output_parser,
            prompt_template=template,
            tools=tools,
            prompt=prompt,
            **kwargs,
        )
Construct an agent from an LLM and tools.
autochain/agent/conversational_agent/conversational_agent.py