Skip to content

Commit 7184118

Browse files
authored
Workflow Endpoint: NER workflow node - guidance for providing an alternative prompt (#691)
1 parent 4dacbbd commit 7184118

File tree

1 file changed

+73
-1
lines changed

1 file changed

+73
-1
lines changed

api-reference/workflow/workflows.mdx

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,79 @@ import EnrichmentTableToHTMLHiResOnly from '/snippets/general-shared-text/enrich
17281728

17291729
Fields for settings include:
17301730

1731-
- `prompt_interface_overrides.prompt.user`: _Optional_. Any alternative prompt to use with the underlying NER model. The default is none, which means to rely on using Unstructured's internal default prompt when calling the NER model.
1731+
- `prompt_interface_overrides.prompt.user`: _Optional_. Any alternative prompt to use with the underlying NER model. The default is none, which means to rely on using Unstructured's internal default prompt when calling the NER model.
1732+
The internal default prompt is as follows, which you can override by providing an alternative prompt:
1733+
1734+
```text
1735+
Extract named entities and their relationships from the following text.
1736+
1737+
Provide the entities, their corresponding types and relationships as a structured JSON response.
1738+
1739+
Entity types:
1740+
- PERSON
1741+
- ORGANIZATION
1742+
- LOCATION
1743+
- DATE
1744+
- TIME
1745+
- EVENT
1746+
- MONEY
1747+
- PERCENT
1748+
- FACILITY
1749+
- PRODUCT
1750+
- ROLE
1751+
- DOCUMENT
1752+
- DATASET
1753+
1754+
Relationship types:
1755+
- PERSON - ORGANIZATION: works_for, affiliated_with, founded
1756+
- PERSON - LOCATION: born_in, lives_in, traveled_to
1757+
- ORGANIZATION - LOCATION: based_in, has_office_in
1758+
- Entity - DATE: occurred_on, founded_on, died_on, published_in
1759+
- PERSON - PERSON: married_to, parent_of, colleague_of
1760+
- PRODUCT - ORGANIZATION: developed_by, owned_by
1761+
- EVENT - LOCATION: held_in, occurred_in
1762+
- Entity - ROLE: has_title, acts_as, has_role
1763+
- DATASET - PERSON: mentions
1764+
- DATASET - DOCUMENT: located_in
1765+
- PERSON - DATASET: published
1766+
- DOCUMENT - DOCUMENT: referenced_in, contains
1767+
- DOCUMENT - DATE: dated
1768+
- PERSON - DOCUMENT: published
1769+
1770+
[START OF TEXT]
1771+
{{text}}
1772+
[END OF TEXT]
1773+
1774+
1775+
Response format json schema: {
1776+
"items": [
1777+
{ "entity": "Entity name", "type": "Entity type" },
1778+
{ "entity": "Entity name", "type": "Entity type" }
1779+
],
1780+
"relationships": [
1781+
{"from": "Entity name", "relationship": "Relationship type", "to": "Entity name"},
1782+
{"from": "Entity name", "relationship": "Relationship type", "to": "Entity name"}
1783+
]
1784+
}
1785+
```
1786+
1787+
If you provide an alternative prompt, you must provide the entire alternative prompt in the preceding format. For best results, Unstructured strongly recommends that you limit your changes only to certain portions of the internal default prompt, specifically:
1788+
1789+
- Adding, renaming, or deleting items in the list of predefined types (such as `PERSON`, `ORGANIZATION`, `LOCATION`, and so on).
1790+
- Adding, renaming, or deleting items in the list of predefined relationships (such as `works_for`, `based_in`, `has_role`, and so on).
1791+
- As needed, adding any clarifying instructions only between these two lines:
1792+
1793+
```text
1794+
...
1795+
Provide the entities and their corresponding types as a structured JSON response.
1796+
1797+
(Add any clarifying instructions here only.)
1798+
1799+
[START OF TEXT]
1800+
...
1801+
```
1802+
1803+
- Changing any other portions of the internal default prompt could produce unexpected results.
17321804

17331805
Allowed values for `<subtype>` include:
17341806

0 commit comments

Comments
 (0)