Skip to main content

Running a Function

run_function(self, model: str, input_data: dict)
Parameters:
  • model (str): The name of the function to run.
  • input_data (dict or Pydantic model): The input data to pass to the function. Refer to instructions from the Sutro team or your the Sutro web app for the specific input parameters required for your model.
Returns:
  • response (str|array|object): The response from the function.
  • confidence (float): The confidence score for the response.
  • predictions (list): A list of predictions from the function.
  • run_id (str): The ID of the function run.
Examples: Using a dictionary:
import sutro as so

result = so.run_function(
  model="is-hotdog", 
  input_data={"brand": "Oscar Meyer", "description": "Classic frankfurter, 8-pack"}
)
Using a Pydantic model:
import sutro as so
from pydantic import BaseModel

class HotdogModelInput(BaseModel):
  brand: str
  description: str

result = so.run_function(
  model="is-hotdog", 
  input_data=HotdogModelInput(
    brand="Oscar Meyer",
    description="Classic frankfurter, 8-pack"
  )
)