---
title: Function
description: API reference for a Quantum Function loaded from the Functions Catalog
source: https://quantum.cloud.ibm.com/docs/en/api/qiskit-ibm-catalog/function
---

# Function

*class* `qiskit_serverless.core.function.RunnableQiskitFunction`

A Quantum Function loaded with [`FunctionsCatalog.load()`](/docs/api/qiskit-ibm-catalog/qiskit-functions-catalog#load). Its class is `RunnableQiskitFunction`. You don't create it directly.

## Methods

### get\_default\_size

`get_default_size()`

Returns the size label used when a run doesn't pass `function_size`.

```python
print(qesem_function.get_default_size())
```

Output:

```text
None
```

**Return type**

`str | None` – `None` if the function doesn't declare a default.

### jobs

`jobs(**kwargs)`

Lists the jobs created with this function. Replaces the deprecated `get_jobs()`.

```python
for job in qesem_function.jobs():
    print(job.job_id, job.status())
```

Output:

```text
f6c29f49-4d5f-4fff-aca6-2e9a115b9763 DONE
7f08c9d5-471b-4da2-92e7-4f2cb94c23a8 ERROR
```

**Return type**

list\[[`Job`](/docs/api/qiskit-ibm-catalog/functions-job)]

### run

`run(**kwargs)`

Starts a job and returns immediately.

```python
job = qesem_function.run(
    pubs=[(circuit, observable)],
    backend_name="ibm_fez",
)
print(job.job_id)
```

Output:

```text
f6c29f49-4d5f-4fff-aca6-2e9a115b9763
```

**Parameters**

- **\*\*kwargs** – The function's inputs. See the function's [API reference](/docs/api/functions).
- **function\_size** (*str | None*) – Size label, if the function declares sizes. Reserved keyword.
- **config** (*Configuration | None*) – Job configuration. Reserved keyword.

**Return type**

[`Job`](/docs/api/qiskit-ibm-catalog/functions-job)

**Raises**

`QiskitServerlessException` – If the arguments are invalid.

### sizes

`sizes()`

Returns the size labels the function declares.

```python
print(qesem_function.sizes())
```

Output:

```text
{}
```

**Return type**

`dict[str, str]` – Empty if the function declares no sizes.

### validate\_arguments

`validate_arguments(arguments)`

Checks arguments against the function's schema without creating a job.

```python
qesem_function.validate_arguments(
    {"pubs": [(circuit, observable)], "backend_name": "ibm_fez"}
)
```

Output:

```text
{'valid': True}
```

**Parameters**

- **arguments** (*dict*) – The arguments to check.

**Return type**

`dict` – `{"valid": True}` if the arguments are valid.

**Raises**

`QiskitServerlessException` – If the arguments are invalid.
