Skip to content

Commit d181ac6

Browse files
committed
feat(api)!: made universal classification endpoint multi-input only
1 parent a01aa01 commit d181ac6

File tree

1 file changed

+117
-69
lines changed

1 file changed

+117
-69
lines changed

openapi.yaml

Lines changed: 117 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
info:
22
title: Isaacus API
3-
version: 0.3.0
3+
version: 0.4.0
44
description: A RESTful API for using Isaacus legal AI models, data and other solutions.
55
termsOfService: https://isaacus.com/terms
66
contact:
@@ -19,9 +19,9 @@ paths:
1919
tags:
2020
- Classifications
2121
summary: Universal classification
22-
description: Classify the relevance of a legal document to a query with an Isaacus
22+
description: Classify the relevance of legal documents to a query with an Isaacus
2323
universal legal AI classifier.
24-
operationId: CreateUniversalClassification
24+
operationId: CreateUniversalClassifications
2525
requestBody:
2626
content:
2727
application/json:
@@ -30,7 +30,7 @@ paths:
3030
required: true
3131
responses:
3232
'200':
33-
description: The document has been successfully classified.
33+
description: The documents have been successfully classified.
3434
headers: {}
3535
content:
3636
application/json:
@@ -949,26 +949,86 @@ components:
949949
detail: The API key you provided does not exist, is expired or revoked, or
950950
is not authorized to access this resource.
951951
instance: null
952+
UniversalClassification:
953+
properties:
954+
index:
955+
type: integer
956+
exclusiveMinimum: -1.0
957+
description: The index of the text in the input array of texts, starting
958+
from `0` (and, therefore, ending at the number of texts minus `1`).
959+
examples:
960+
- 0
961+
score:
962+
type: number
963+
maximum: 1.0
964+
minimum: 0.0
965+
description: 'A score of the likelihood that the query expressed about the
966+
text is supported by the text.
967+
968+
969+
A score greater than `0.5` indicates that the text supports the query,
970+
while a score less than `0.5` indicates that the text does not support
971+
the query.'
972+
examples:
973+
- 0.8825573934438159
974+
chunks:
975+
oneOf:
976+
- items:
977+
$ref: '#/components/schemas/UniversalClassificationChunk'
978+
type: array
979+
- type: 'null'
980+
description: 'The text as broken into chunks by [semchunk](https://github.com/isaacus-dev/semchunk),
981+
each chunk with its own confidence score, ordered from highest to lowest
982+
score.
983+
984+
985+
If no chunking occurred, this will be `null`.'
986+
examples:
987+
- - index: 0
988+
start: 0
989+
end: 45
990+
score: 0.8825573934438159
991+
text: I agree not to tell anyone about the document.
992+
type: object
993+
required:
994+
- chunks
995+
- index
996+
- score
997+
title: Universal classification
998+
examples:
999+
- index: 0
1000+
score: 0.8825573934438159
1001+
chunks:
1002+
- index: 0
1003+
start: 0
1004+
end: 45
1005+
score: 0.8825573934438159
1006+
text: I agree not to tell anyone about the document.
9521007
UniversalClassificationChunk:
9531008
properties:
9541009
index:
9551010
type: integer
9561011
exclusiveMinimum: -1.0
957-
description: The index of the chunk in the list of chunks.
1012+
description: The original position of the chunk in the outputted list of
1013+
chunks before sorting, starting from `0` (and, therefore, ending at the
1014+
number of chunks minus `1`).
9581015
examples:
9591016
- 0
9601017
start:
9611018
type: integer
9621019
exclusiveMinimum: -1.0
963-
description: The start index of the chunk in the original text.
1020+
description: The index of the character in the original text where the chunk
1021+
starts, beginning from `0`.
9641022
examples:
9651023
- 0
9661024
end:
9671025
type: integer
9681026
minimum: 1.0
969-
description: The end index of the chunk in the original text.
1027+
description: The index of the character in the original text where the chunk
1028+
ends, beginning from `0` (such that, in Python, the chunk is equivalent
1029+
to `text[start:end+1]`).
9701030
examples:
971-
- 46
1031+
- 45
9721032
score:
9731033
type: number
9741034
maximum: 1.0
@@ -981,7 +1041,7 @@ components:
9811041
while a score less than `0.5` indicates that the chunk does not support
9821042
the query.'
9831043
examples:
984-
- 0.7481262778280844
1044+
- 0.8825573934438159
9851045
text:
9861046
type: string
9871047
minLength: 1
@@ -999,8 +1059,8 @@ components:
9991059
examples:
10001060
- index: 0
10011061
start: 0
1002-
end: 46
1003-
score: 0.7481262778280844
1062+
end: 45
1063+
score: 0.8825573934438159
10041064
text: I agree not to tell anyone about the document.
10051065
UniversalClassificationRequest:
10061066
properties:
@@ -1019,29 +1079,31 @@ components:
10191079
minLength: 1
10201080
pattern: \S
10211081
description: 'The [Isaacus Query Language (IQL)](https://docs.isaacus.com/iql)
1022-
query or, if IQL is disabled, the statement, to evaluate the text against.
1082+
query or, if IQL is disabled, the statement, to evaluate the texts against.
10231083
10241084
10251085
The query must contain at least one non-whitespace character.
10261086
10271087
1028-
Unlike the text being classified, the query cannot be so long that it
1088+
Unlike the texts being classified, the query cannot be so long that it
10291089
exceeds the maximum input length of the universal classifier.'
10301090
examples:
10311091
- This is a confidentiality clause.
10321092
- '{IS confidentiality clause} AND {IS clause obligating "Supplier"} AND
10331093
{IS unilateral clause}'
1034-
text:
1035-
type: string
1036-
maxLength: 10000000
1037-
minLength: 1
1038-
pattern: \S
1039-
description: 'The text to classify.
1094+
texts:
1095+
items:
1096+
type: string
1097+
title: Non-blank string
1098+
examples:
1099+
- A string.
1100+
type: array
1101+
description: 'The texts to classify.
10401102
10411103
1042-
The text must contain at least one non-whitespace character.'
1104+
The texts must contain at least one non-whitespace character.'
10431105
examples:
1044-
- I agree not to tell anyone about the document.
1106+
- - I agree not to tell anyone about the document.
10451107
is_iql:
10461108
type: boolean
10471109
description: Whether the query should be interpreted as an [IQL](https://docs.isaacus.com/iql)
@@ -1061,28 +1123,28 @@ components:
10611123
10621124
`auto` is the default scoring method and is recommended for most use cases.
10631125
Currently, it is equivalent to `chunk_max`. In the future, it will automatically
1064-
select the best method based on the model and input.
1126+
select the best method based on the model and inputs.
10651127
10661128
1067-
`chunk_max` uses the highest confidence score of all of the text''s chunks.
1129+
`chunk_max` uses the highest confidence score of all of the texts'' chunks.
10681130
10691131
1070-
`chunk_avg` averages the confidence scores of all of the text''s chunks.
1132+
`chunk_avg` averages the confidence scores of all of the texts'' chunks.
10711133
10721134
1073-
`chunk_min` uses the lowest confidence score of all of the text''s chunks.'
1135+
`chunk_min` uses the lowest confidence score of all of the texts'' chunks.'
10741136
default: auto
10751137
examples:
10761138
- auto
10771139
chunking_options:
10781140
oneOf:
10791141
- $ref: '#/components/schemas/ChunkingOptions'
10801142
- type: 'null'
1081-
description: 'Settings for how the text should be chunked into smaller segments
1082-
before classification using [semchunk](https://github.com/isaacus-dev/semchunk).
1143+
description: 'Settings for how the texts should be chunked into smaller
1144+
segments before classification using [semchunk](https://github.com/isaacus-dev/semchunk).
10831145
10841146
1085-
If `null`, the text will not be chunked and will instead be truncated
1147+
If `null`, the texts will not be chunked and will instead be truncated
10861148
to the maximum input length of the model less overhead if found to exceed
10871149
that limit.'
10881150
examples:
@@ -1093,65 +1155,51 @@ components:
10931155
required:
10941156
- model
10951157
- query
1096-
- text
1158+
- texts
10971159
title: Universal classification request
1098-
description: A request to classify the relevance of a legal document to a query
1160+
description: A request to classify the relevance of legal documents to a query
10991161
with an Isaacus universal legal AI classifier.
11001162
examples:
11011163
- model: kanon-universal-classifier
11021164
query: This is a confidentiality clause.
1103-
text: I agree not to tell anyone about the document.
1165+
texts:
1166+
- I agree not to tell anyone about the document.
11041167
UniversalClassificationResponse:
11051168
properties:
1106-
score:
1107-
type: number
1108-
maximum: 1.0
1109-
minimum: 0.0
1110-
description: 'A score of the likelihood that the query expressed about the
1111-
text is supported by the text.
1112-
1113-
1114-
A score greater than `0.5` indicates that the text supports the query,
1115-
while a score less than `0.5` indicates that the text does not support
1116-
the query.'
1117-
examples:
1118-
- 0.7481262778280844
1119-
chunks:
1120-
oneOf:
1121-
- items:
1122-
$ref: '#/components/schemas/UniversalClassificationChunk'
1123-
type: array
1124-
- type: 'null'
1125-
description: 'The text as broken into chunks by [semchunk](https://github.com/isaacus-dev/semchunk),
1126-
each chunk with its own confidence score, ordered from highest to lowest
1127-
score.
1128-
1129-
1130-
If no chunking occurred, this will be `null`.'
1169+
classifications:
1170+
items:
1171+
$ref: '#/components/schemas/UniversalClassification'
1172+
type: array
1173+
description: The classifications of the texts, by relevance to the query,
1174+
in order from highest to lowest relevance score.
11311175
examples:
11321176
- - index: 0
1133-
start: 0
1134-
end: 46
1135-
score: 0.7481262778280844
1136-
text: I agree not to tell anyone about the document.
1177+
score: 0.8825573934438159
1178+
chunks:
1179+
- index: 0
1180+
start: 0
1181+
end: 45
1182+
score: 0.8825573934438159
1183+
text: I agree not to tell anyone about the document.
11371184
usage:
11381185
$ref: '#/components/schemas/UniversalClassificationUsage'
11391186
type: object
11401187
required:
1141-
- chunks
1142-
- score
1188+
- classifications
11431189
- usage
11441190
title: Universal classification response
1145-
description: A classification of the relevance of a legal document to a query
1191+
description: Classifications of the relevance of legal documents to a query
11461192
produced by an Isaacus universal legal AI classifier.
11471193
examples:
1148-
- score: 0.7481262778280844
1149-
chunks:
1194+
- classifications:
11501195
- index: 0
1151-
start: 0
1152-
end: 46
1153-
score: 0.7481262778280844
1154-
text: I agree not to tell anyone about the document.
1196+
score: 0.8825573934438159
1197+
chunks:
1198+
- index: 0
1199+
start: 0
1200+
end: 45
1201+
score: 0.8825573934438159
1202+
text: I agree not to tell anyone about the document.
11551203
usage:
11561204
input_tokens: 19
11571205
UniversalClassificationUsage:

0 commit comments

Comments
 (0)