Task

Subpackages

Submodules

llmsmith.task.base module

class llmsmith.task.base.Task(name: str)

Bases: Generic[T, U], ABC

Base class for all tasks. All subclasses of Task should implement the execute method. In case you are using some LLM (or DB for retrieval) which is still not supported by this library, you can write your own implementation easily by subclassing Task.

Parameters:

name (str) – The name of the task. The task name should be non-empty.

Raises:

ValueError – If task name fails validation.

abstract async execute(task_input: TaskInput[T]) TaskOutput[U]

Abstract method for executing the task.

Parameters:

task_input (TaskInput[T]) – The input to the task.

Returns:

The output of the task.

Return type:

TaskOutput[U]

name() str

Returns the name of the task.

Returns:

task name.

Return type:

str

llmsmith.task.models module

class llmsmith.task.models.ChatResponse(text: str, raw_output: Any, function_calls: dict[str, llmsmith.task.models.FunctionCall] = None)

Bases: object

function_calls: dict[str, FunctionCall] = None
raw_output: Any
text: str
class llmsmith.task.models.FunctionCall(id: str, name: str, args: dict[str, Any])

Bases: object

args: dict[str, Any]
id: str
name: str
class llmsmith.task.models.TaskInput(content: T)

Bases: Generic[T]

content: T
class llmsmith.task.models.TaskOutput(content: T, raw_output: Any)

Bases: Generic[T]

content: T
raw_output: Any

Module contents