motleycrew.utils.structured_output_with_retries

Functions

structured_output_with_retries(schema, ...)

Use MotleyCrew agent with retries to extract structured output.

motleycrew.utils.structured_output_with_retries.structured_output_with_retries(schema: Type[BaseModel], prompt: str, input_messages: List[HumanMessage] | dict, language_model: BaseLanguageModel | None = None) BaseModel

Use MotleyCrew agent with retries to extract structured output.

Parameters:
  • schema – The Pydantic model to extract

  • prompt – Instructions

  • input_messages – List of messages containing the image and text

  • language_model – The language model to use

Returns:

An instance of the schema with extracted data