Choose documents, a template ontology, and a prompt
An induction has three inputs. You must provide at least one document. A template ontology and a prompt are optional. This topic explains what each input does and how to choose it. For information about the limits on each input, see Input limits.
Choose documents
AWS Context drafts the ontology from the text in your documents. Choose documents that describe your business, such as policies, specifications, glossaries, or process descriptions.
You provide the documents when you start the induction. An induction doesn’t read documents from a connection.
Each document needs a content type (contentType). It tells AWS Context what kind of document it is:
-
PDF -
A PDF document.
-
TXT -
Plain text.
-
MARKDOWN -
A Markdown document.
-
CSV -
Comma-separated values.
-
JSON -
A JSON document.
-
YAML -
A YAML document.
-
DOC -
A Word 97–2003 document or template (
.docor.dot). -
DOCX -
A Word document saved as
.docx, without macros. -
HTML -
An HTML document. This includes XHTML documents.
StartOntologyInduction checks that each document’s bytes match its content type. If they don’t, the request fails with a ValidationException, and no induction starts. The main checks are as follows:
-
A PDF document must be a whole PDF file, not one that was cut short.
-
TXT,MARKDOWN,CSV,JSON, andYAMLdocuments must be UTF-8 text with no NUL characters. -
A CSV document must quote its fields as RFC 4180 does, but its rows can have different numbers of fields.
-
A JSON document must hold exactly one JSON value.
-
A Word document must open without a password and without information rights management (IRM).
-
A
DOCXdocument must be a.docxfile without macros, not a Word template (.dotx) or a document with macros (.docmor.dotm). -
An HTML document must contain HTML markup and no NUL bytes.
-
An HTML document must be UTF-8, or its first meta tag that declares a character set must declare one that AWS Context can read.
To use a valid YAML document that AWS Context can’t read, send it as TXT. To use an HTML document that AWS Context refuses for its character set, save the document as UTF-8.
AWS Context reads TXT, MARKDOWN, CSV, JSON, and YAML documents as they are, markup included. It gets the text of a PDF, DOC, DOCX, or HTML document with the reader for that type.
AWS Context skips a document that it can’t read, such as a damaged one. The induction continues with the other documents. When two documents have the same bytes and AWS Context reads them the same way, it uses only the first one.
A document’s name only identifies the document. The end of the name, such as .pdf, doesn’t set the document’s type.
AWS Context reads only the text that a document stores as text. It doesn’t read the following:
-
Text in images. There is no optical character recognition (OCR), so a scanned page gives no text.
-
Embedded documents and attachments.
-
Text after the first 2,000,000 characters of a document.
If AWS Context can’t read any of the documents and you didn’t give a template ontology, the induction fails with FRAGMENT_EMPTY. If you gave one, the draft contains only the template ontology. For information about failure codes, see Failure codes.
AWS Context doesn’t report which documents it skipped or shortened. If a draft has fewer classes than you expect, check that each document has the right content type. Also check that each document stores its text as text, not as images.
On the AWS Context console, you can upload files whose names end in .pdf, .txt, .md, .markdown, .csv, .json, .yaml, .yml, .doc, .dot, .docx, .html, .htm, .xhtml, or .xht. The console sends each file with the content type for the end of its name. For example, it sends a .md file as MARKDOWN, a .dot file as DOC, and an .xhtml file as HTML. It doesn’t accept a Word document with macros (.docm). Before it sends a plain text, Markdown, CSV, JSON, or YAML file, the console checks that the file is UTF-8 text with no NUL characters.
Choose a template ontology (optional)
A template ontology is an ontology that you already published and that the induction extends. Use a template ontology when you want the new ontology to build on concepts that you already defined.
The draft starts from the template ontology and keeps all of it:
-
Every statement in the template ontology stays as it is.
-
An induced term that has the same name as a term in the template ontology becomes that term.
-
When AWS Context removes terms to keep the draft within its size limits, it never removes a term from the template ontology. For information about the size limits, see Size limits and removed terms.
The template ontology must be a custom ontology in your account that has the status PUBLISHED. It must come from a source in Turtle, a text format for RDF data. A built-in (system) ontology can’t be a template ontology. For information about the errors that an unusable template ontology causes, see Template ontology errors.
On the console, this field is Template ontology. In the API, it is seedOntologyId. The console list shows your published custom ontologies.
Write a prompt (optional)
A prompt is free text that AWS Context sends to the language model that drafts the ontology. Use it to say what the ontology is for, which concepts to focus on, or which terms to use. For example: "Focus on claims, policies, and the parties to a claim."
On the console, the prompt is the Requirements field.
Input limits
The following table lists the limits on the inputs of one induction.
| Input | Limit |
|---|---|
|
Number of documents |
1 to 100 |
|
Size of one document |
Up to 10 MiB (10,485,760 bytes) |
|
Size of all documents together |
Up to 10 MiB (10,485,760 bytes) |
|
Document name |
1 to 255 characters |
|
Text read from one document |
The first 2,000,000 characters. A character with a code point higher than U+FFFF, such as most emoji, counts as two characters. |
|
DOCX parts that |
Up to 8 MiB (8,388,608 bytes), decompressed, for all |
|
JSON and YAML nesting |
Up to 1,000 levels of nested collections |
|
Prompt |
1 to 8,000 characters |
|
Template ontology source |
Up to 400,000 bytes |
|
Files uploaded on the console |
Up to 100 files and 10 MiB in total |
Template ontology errors
The following table lists what happens when AWS Context can’t use the template ontology.
| Situation | Result |
|---|---|
|
The template ontology doesn’t exist in your account. A bare ID always names an ontology in your account, so a built-in ontology that you name by its ID also gives this result. |
|
|
AWS Context can’t use the template ontology. For example, it isn’t published, or it’s larger than the size limits for a draft. A built-in ontology that you name by its ARN also gives this result. |
|
|
You don’t have permission to read the template ontology. |
|
|
While the induction runs, the template ontology’s source no longer exists or is larger than 400,000 bytes, or AWS Context can’t parse it. |
The induction fails with the code |
|
The template ontology alone is too large to fit in the new ontology. |
The induction fails with the code |