Skip to main content

portia.open_source_tools.llm_tool

Tool for responding to prompts and completing tasks that don't require other tools.

LLMToolSchema Objects

class LLMToolSchema(BaseModel)

Input for LLM Tool.

LLMTool Objects

class LLMTool(Tool[str])

General purpose LLM tool. Customizable to user requirements. Won't call other tools.

process_task_data

@staticmethod
def process_task_data(task_data: list[Any] | str | None) -> str

Process task_data into a string, handling different input types.

Arguments:

  • task_data - Data that can be a None, a string or a list of objects.

Returns:

A string representation of the data, with list items joined by newlines.

run

def run(ctx: ToolRunContext,
task: str,
task_data: list[Any] | str | None = None) -> str

Run the LLMTool.