caikit.interfaces.nlp.data_model.classification
Data structures for classification representations
Attributes
Classes
Create a collection of name/value pairs. |
|
Input Warning data object, which returns a reason and message associated with warnings |
|
A classification training record consisting of a single train instance. |
|
A single classification prediction. |
|
Classification results generated from a text and consisting multiple classes. |
|
A single token classification prediction. |
|
Token classification results generated from a text and consisting multiple classes. |
|
Streaming token classification results that indicates up to where in stream is processed. |
|
Classification result on text produced by a text generation model, contains |
|
Streaming classification on generated text result that indicates up to where in stream |
Module Contents
- class caikit.interfaces.nlp.data_model.classification.InputWarningReason(*args, **kwds)[source]
Bases:
enum.EnumCreate a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- UNSUITABLE_INPUT = 0
- class caikit.interfaces.nlp.data_model.classification.InputWarning[source]
Bases:
caikit.core.DataObjectBaseInput Warning data object, which returns a reason and message associated with warnings to issue to a user that causes errors (such as failed text generation)
- id: py_to_proto.dataclass_to_proto.Annotated[InputWarningReason, FieldNumber(1)]
- message: py_to_proto.dataclass_to_proto.Annotated[str, FieldNumber(2)]
- class caikit.interfaces.nlp.data_model.classification.ClassificationTrainRecord[source]
Bases:
caikit.core.DataObjectBaseA classification training record consisting of a single train instance.
- text: py_to_proto.dataclass_to_proto.Annotated[str, FieldNumber(1)]
- labels: py_to_proto.dataclass_to_proto.Annotated[List[str], FieldNumber(2)]
- class caikit.interfaces.nlp.data_model.classification.ClassificationResult[source]
Bases:
caikit.core.DataObjectBaseA single classification prediction.
- label: py_to_proto.dataclass_to_proto.Annotated[str, FieldNumber(1)]
- score: py_to_proto.dataclass_to_proto.Annotated[float, FieldNumber(2)]
- class caikit.interfaces.nlp.data_model.classification.ClassificationResults[source]
Bases:
caikit.core.DataObjectBaseClassification results generated from a text and consisting multiple classes.
- results: py_to_proto.dataclass_to_proto.Annotated[List[ClassificationResult], FieldNumber(1)]
- class caikit.interfaces.nlp.data_model.classification.TokenClassificationResult[source]
Bases:
caikit.core.DataObjectBaseA single token classification prediction.
- start: py_to_proto.dataclass_to_proto.Annotated[int, FieldNumber(1)]
- end: py_to_proto.dataclass_to_proto.Annotated[int, FieldNumber(2)]
- word: py_to_proto.dataclass_to_proto.Annotated[str, FieldNumber(3)]
- entity: py_to_proto.dataclass_to_proto.Annotated[str, FieldNumber(4)]
- entity_group: py_to_proto.dataclass_to_proto.Annotated[str, FieldNumber(5)]
- score: py_to_proto.dataclass_to_proto.Annotated[float, FieldNumber(6)]
- token_count: py_to_proto.dataclass_to_proto.Annotated[int | None, FieldNumber(7)]
- class caikit.interfaces.nlp.data_model.classification.TokenClassificationResults[source]
Bases:
caikit.core.DataObjectBaseToken classification results generated from a text and consisting multiple classes.
- results: py_to_proto.dataclass_to_proto.Annotated[List[TokenClassificationResult], FieldNumber(1)]
- class caikit.interfaces.nlp.data_model.classification.TokenClassificationStreamResult[source]
Bases:
TokenClassificationResultsStreaming token classification results that indicates up to where in stream is processed.
- processed_index: py_to_proto.dataclass_to_proto.Annotated[int, FieldNumber(2)]
- start_index: py_to_proto.dataclass_to_proto.Annotated[int, FieldNumber(3)]
- class caikit.interfaces.nlp.data_model.classification.ClassifiedGeneratedTextResult[source]
Bases:
caikit.core.DataObjectBaseClassification result on text produced by a text generation model, contains information from the original text generation output as well as the result of classification on the generated text.
- class TextGenTokenClassificationResults[source]
Bases:
caikit.core.DataObjectBaseA DataObject is a data model class that is backed by a @dataclass.
Data model classes that use the @dataobject decorator must derive from this base class.
- input: py_to_proto.dataclass_to_proto.Annotated[List[TokenClassificationResult] | None, FieldNumber(10)]
- output: py_to_proto.dataclass_to_proto.Annotated[List[TokenClassificationResult] | None, FieldNumber(20)]
- generated_text: py_to_proto.dataclass_to_proto.Annotated[str | None, FieldNumber(1)]
- token_classification_results: py_to_proto.dataclass_to_proto.Annotated[ClassifiedGeneratedTextResult.TextGenTokenClassificationResults | None, FieldNumber(2)]
- finish_reason: py_to_proto.dataclass_to_proto.Annotated[caikit.interfaces.nlp.data_model.text_generation.FinishReason | None, FieldNumber(3)]
- generated_token_count: py_to_proto.dataclass_to_proto.Annotated[int | None, FieldNumber(4)]
- seed: py_to_proto.dataclass_to_proto.Annotated[numpy.uint64 | None, FieldNumber(5)]
- input_token_count: py_to_proto.dataclass_to_proto.Annotated[int | None, FieldNumber(6)]
- warnings: py_to_proto.dataclass_to_proto.Annotated[List[InputWarning] | None, FieldNumber(9)]
- tokens: py_to_proto.dataclass_to_proto.Annotated[List[caikit.interfaces.nlp.data_model.text_generation.GeneratedToken] | None, FieldNumber(10)]
- input_tokens: py_to_proto.dataclass_to_proto.Annotated[List[caikit.interfaces.nlp.data_model.text_generation.GeneratedToken] | None, FieldNumber(11)]
- class caikit.interfaces.nlp.data_model.classification.ClassifiedGeneratedTextStreamResult[source]
Bases:
ClassifiedGeneratedTextResultStreaming classification on generated text result that indicates up to where in stream is processed.
- processed_index: py_to_proto.dataclass_to_proto.Annotated[int | None, FieldNumber(7)]
- start_index: py_to_proto.dataclass_to_proto.Annotated[int, FieldNumber(8)]