motleycrew.applications.research_agent.question_answerer

Functions

create_answer_question_langchain_tool(graph, ...)

get_subquestions(graph, question)

Classes

AnswerSubQuestionTool(graph, answer_length)

Tool to answer a question based on the notes and sub-questions.

QuestionAnswererInput(*, question)

class motleycrew.applications.research_agent.question_answerer.AnswerSubQuestionTool(graph: MotleyGraphStore, answer_length: int, prompt: str | BasePromptTemplate = None, llm: BaseLanguageModel | None = None)

Bases: MotleyTool

Tool to answer a question based on the notes and sub-questions.

__init__(graph: MotleyGraphStore, answer_length: int, prompt: str | BasePromptTemplate = None, llm: BaseLanguageModel | None = None)

Initialize the MotleyTool.

Parameters:
  • name – Name of the tool (required if tool is None).

  • description – Description of the tool (required if tool is None).

  • args_schema – Schema of the tool arguments (required if tool is None).

  • return_direct – If True, the tool’s output will be returned directly to the user.

  • handle_exceptions

    Whether to handle exceptions (return their message as output).

    If True, the tool will return any raised exception’s message as its output.

    If a list of exceptions is provided, only these exceptions will be handled.

    If False, the tool will raise the exception.

    If return_direct is True, the tool will always handle InvalidOutput exceptions, as the tool is considered an output handler.

  • retry_config – Configuration for retry behavior. If None, exceptions will not be retried.

  • tool – Langchain BaseTool to wrap. Usually not needed, as the tool is created from the run method.

class motleycrew.applications.research_agent.question_answerer.QuestionAnswererInput(*, question: Question)

Bases: BaseModel

question: Question
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

motleycrew.applications.research_agent.question_answerer.get_subquestions(graph: MotleyGraphStore, question: Question) list[Question]
motleycrew.applications.research_agent.question_answerer.create_answer_question_langchain_tool(graph: MotleyGraphStore, answer_length: int, prompt: str | BasePromptTemplate = None, llm: BaseLanguageModel | None = None) Tool