When you are working with the CLI or the Sieve python client, you will work with Sieve’s input and output objects. This section explains more about the schema of the input and output types, and how they related to the functions and models that you define.

The input object of a function is an array that follows the order of the function argument definition.

The output object follows a similar pattern, where it will be an array of your return values.

Use this function as an example:

@sieve.function(
    name="fn",
)
def fn(a: sieve.Video, b: str) -> sieve.Image:
    return sieve.Image(path='path/to/your.mp4') 

The corresponding input object would be:

"inputs": [
  "a": {
    "data": {
      "url": "https://storage.googleapis.com/sieve-public-data/assets/nature.mp4"
    },
  },
  "b": {
    "data": "test",
  }
]

Use the same function as an example, for an iterator output:

@sieve.function(
    name="fn",
)
def fn(a: sieve.Video, b: str) -> sieve.Image:
    for i in range(3): 
        yield sieve.Image(path="image.png")

The output would be:

"outputs": [
  {
    "type": "sieve.Image",
    "name": "",
    "data": {
      "url": "https://storage.googleapis.com/sieve-public-data/assets/frog.jpeg"
    },
    "description": null
  },
  {
    "type": "sieve.Image",
    "name": "",
    "data": {
      "url": "https://storage.googleapis.com/sieve-public-data/assets/frog.jpeg"
    },
    "description": null
  },
  {
    "type": "sieve.Image",
    "name": "",
    "data": {
      "url": "https://storage.googleapis.com/sieve-public-data/assets/frog.jpeg"
    },
    "description": null
  }
]