# Enabling both "Assign relations" and "Select spans" in custom relations recipe

**URL:** <https://support.prodi.gy/t/enabling-both-assign-relations-and-select-spans-in-custom-relations-recipe/3647>\
**Category:** Uncategorized\
**Tags:** solved, front-end, usage, relations\
**Created:** [November 20, 2020, 11:10am UTC](https://support.prodi.gy/t/enabling-both-assign-relations-and-select-spans-in-custom-relations-recipe/3647 "2020-11-20T11:10:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomvars](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/tomvars/32/1760_2.png) [@tomvars](https://support.prodi.gy/u/tomvars)\
**Post date:** [November 20, 2020, 11:10am UTC](https://support.prodi.gy/t/enabling-both-assign-relations-and-select-spans-in-custom-relations-recipe/3647/1 "2020-11-20T11:10:24Z")

</div>

Hi!

I've written a custom recipe with the blocks API to do relation extraction. It works well and serves the results of a separately trained NER model as spans. However I'd like the ability for the user to "select spans" to correct mistakes in the NER model as seen in the "Relations & Spans" live demo.

What I want:

 ![Screenshot 2020-11-20 at 11.05.24](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/b/bf0264523e5322922493e09f5d756ffb7f930cc8.png)

What I have:

 ![Screenshot 2020-11-20 at 11.07.29](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/3/3ca431ec185dea371e2114b65603ce65559027d3.png)

I've tried passing a `span-labels` argument to the config (see below) but that didn't work.

```
blocks = [
    {"view_id": "relations", "labels": ["Within the", "Near the"], "wrap": True, 
     "span-labels": ["PATHOLOGY", "DESCRIPTOR", "LOCATION"]}
]
return {
    "view_id": "blocks",
    "dataset": dataset, # Name of dataset to save annotations
    "stream": get_stream(), # Incoming stream of examples
    "config": { "blocks": blocks}
}

```

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [November 20, 2020, 12:13pm UTC](https://support.prodi.gy/t/enabling-both-assign-relations-and-select-spans-in-custom-relations-recipe/3647/2 "2020-11-20T12:13:00Z")

</div>

Hi! I think you just have a small typo in your config: the setting is called `relations_span_labels`. Also see here for the available configuration options for the relations UI: [https://prodi.gy/docs/api-interfaces#relations-settings](https://prodi.gy/docs/api-interfaces#relations-settings)

---

<div class="post-metadata">

**Author:** ![tomvars](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/tomvars/32/1760_2.png) [@tomvars](https://support.prodi.gy/u/tomvars)\
**Post date:** [November 23, 2020, 10:58am UTC](https://support.prodi.gy/t/enabling-both-assign-relations-and-select-spans-in-custom-relations-recipe/3647/3 "2020-11-23T10:58:49Z")

</div>

Hi @ines, thanks for the quick reply. Changing the setting to `relations_span_labels` did not work unfortunately. Any other ideas? As feedback, maybe when using the blocks API an error should be raised when a key does not match a known setting as it does when not using the blocks API

---

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [November 23, 2020, 1:39pm UTC](https://support.prodi.gy/t/enabling-both-assign-relations-and-select-spans-in-custom-relations-recipe/3647/4 "2020-11-23T13:39:00Z")

</div>

Ah, I think you need to return the labels in the `"config"` returned by the recipe – they're currently not read from the block itself (because it's a setting that only applies to one single interface, unlike `labels`).

> [@tomvars](#):
>
> maybe when using the blocks API an error should be raised when a key does not match a known setting as it does when not using the blocks API

This makes sense – it's just a bit tricky, because each block allows you to override any arbitrary property on your task. So Prodigy can't really know what it is, because you can structure your JSON however you like.

---

<div class="post-metadata">

**Author:** ![tomvars](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/tomvars/32/1760_2.png) [@tomvars](https://support.prodi.gy/u/tomvars)\
**Post date:** [November 26, 2020, 9:02am UTC](https://support.prodi.gy/t/enabling-both-assign-relations-and-select-spans-in-custom-relations-recipe/3647/5 "2020-11-26T09:02:43Z")

</div>

Thanks! got it to work, for reference this is the code that worked

```
blocks = [
    {"view_id": "relations"}
]
return {
    "view_id": "blocks",
    "dataset": dataset, # Name of dataset to save annotations
    "stream": get_stream(), # Incoming stream of examples
    "config": {"blocks": blocks,
               "labels": ["Within the", "Near the"],
               "relations_span_labels": ["PATHOLOGY", "DESCRIPTOR", "LOCATION"]}
}
```
