nemoguardrails.library.gliner.models

View as Markdown

Pydantic models for GLiNER requests and responses.

Module Contents

Classes

NameDescription
EntitySpanRepresents a detected entity with its position and metadata.
GLiNERRequestRequest model for GLiNER entity extraction.
GLiNERResponseResponse model for GLiNER entity extraction.

API

class nemoguardrails.library.gliner.models.EntitySpan()

Bases: BaseModel

Represents a detected entity with its position and metadata.

end_position
int
score
float = Field(description='Confidence score.')
start_position
int
suggested_label
str = Field(description='The entity label/type.')
value
str = Field(description='The detected entity text.')
class nemoguardrails.library.gliner.models.GLiNERRequest()

Bases: BaseModel

Request model for GLiNER entity extraction.

This model defines the parameters for making requests to a GLiNER server. Default values are centralized here to avoid duplication.

chunk_length
int
flat_ner
bool
labels
Optional[List[str]]
overlap
int
text
str
threshold
float
class nemoguardrails.library.gliner.models.GLiNERResponse()

Bases: BaseModel

Response model for GLiNER entity extraction.

entities
List[EntitySpan] = Field(description='List of detected entities.')
tagged_text
str
total_entities
int