dataflow.api.routes.example_tool¶

Example tool for testing the tools API.

Classes¶

CalculatorInput

Input schema for calculator tool.

CalculatorTool

Simple calculator tool for demonstrations.

SearchToolInput

Input schema for search tool.

Functions¶

simple_search(query[, max_results])

Simple search function for testing.

Module Contents¶

class dataflow.api.routes.example_tool.CalculatorInput(/, **data)¶

Bases: pydantic.BaseModel

Input schema for calculator tool.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

class dataflow.api.routes.example_tool.CalculatorTool¶

Simple calculator tool for demonstrations.

run(expression, precision=2)¶

Evaluate a mathematical expression.

Parameters:
  • expression (str) – Mathematical expression to evaluate

  • precision (int) – Number of decimal places for the result

Returns:

Dictionary with the result and expression

Return type:

dict[str, any]

class dataflow.api.routes.example_tool.SearchToolInput(/, **data)¶

Bases: pydantic.BaseModel

Input schema for search tool.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Parameters:

data (Any)

Simple search function for testing.

Parameters:
  • query (str) – Search query string

  • max_results (int) – Maximum number of results to return

Returns:

List of mock search results

Return type:

list[str]