Types

class afterimage.types.Conversation(*, conversations: ~typing.List[~afterimage.types.ConversationEntry], metadata: dict[str, ~typing.Any] = <factory>)[source]

Bases: BaseModel

conversations: List[ConversationEntry]
metadata: dict[str, Any]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class afterimage.types.ConversationEntry(*, role: Role, content: str, reasoning_content: str | None = None)[source]

Bases: BaseModel

content: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

reasoning_content: str | None
role: Role
class afterimage.types.ConversationWithContext(*, conversations: ~typing.List[~afterimage.types.ConversationEntry], metadata: dict[str, ~typing.Any] = <factory>, instruction_context: str | None = None, response_context: str | None = None, persona: str | None = None)[source]

Bases: Conversation

instruction_context: str | None
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

persona: str | None
response_context: str | None
class afterimage.types.Document(*, id: str = <factory>, text: str | None = None, personas: list[PersonaEntry] = <factory>, metadata: dict[str, ~typing.Any]=<factory>)[source]

Bases: BaseModel

id: str
metadata: dict[str, Any]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

personas: list[PersonaEntry]
text: str | None
class afterimage.types.EvaluatedConversationWithContext(*, conversations: ~typing.List[~afterimage.types.ConversationEntry], metadata: dict[str, ~typing.Any] = <factory>, instruction_context: str | None = None, response_context: str | None = None, persona: str | None = None, evaluation: ~afterimage.types.EvaluationSchema | None = None, final_score: float | None = 0.0)[source]

Bases: ConversationWithContext

evaluation: EvaluationSchema | None
final_score: float | None
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class afterimage.types.EvaluationEntrySchema(*, feedback: str, score: float)[source]

Bases: BaseModel

feedback: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

score: float
class afterimage.types.EvaluationSchema(*, coherence: EvaluationEntrySchema, factuality: EvaluationEntrySchema, grounding: EvaluationEntrySchema, helpfulness: EvaluationEntrySchema, relevance: EvaluationEntrySchema, overall_grade: GradeSchema)[source]

Bases: BaseModel

coherence: EvaluationEntrySchema
factuality: EvaluationEntrySchema
grounding: EvaluationEntrySchema
helpfulness: EvaluationEntrySchema
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

overall_grade: GradeSchema
relevance: EvaluationEntrySchema
class afterimage.types.GeneratedResponsePrompt(*, prompt: str, context: str | None = None, metadata: dict[str, ~typing.Any]=<factory>)[source]

Bases: BaseModel

Output of RespondentPromptModifier.

context: str | None
metadata: dict[str, Any]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

prompt: str
class afterimage.types.GenerationMetadata[source]

Bases: TypedDict

Structured metadata for generation samples.

batch_id: str
context_id: str
context_ids: list[str]
instruction_index: int
persona_generation_depth: int | None
persona_name: str | None
session_id: str
class afterimage.types.GenerationState(num_generated: int = 0, num_requested: int = 0, start_time: datetime = <factory>, last_item: BaseModel | None = None, monitor: Any | None = None, metadata: Dict[str, ~typing.Any]=<factory>, stop_event: Any | None = None, context_counts: Dict[str, int]=<factory>, unique_personas: list[str] = <factory>)[source]

Bases: object

Current state of the generation process.

context_counts: Dict[str, int]
last_item: BaseModel | None = None
metadata: Dict[str, Any]
monitor: Any | None = None
num_generated: int = 0
num_requested: int = 0
start_time: datetime
stop_event: Any | None = None
unique_personas: list[str]
update(item: Any)[source]

Update state with a new generated item.

class afterimage.types.GradeSchema(value)[source]

Bases: str, Enum

BAD = 'bad'
GOOD = 'good'
NEEDS_IMPROVEMENT = 'needs_improvement'
NOT_ACCEPTABLE = 'not_acceptable'
PERFECT = 'perfect'
class afterimage.types.PersonaEntry(*, descriptions: list[str], metadata: dict = <factory>)[source]

Bases: BaseModel

Represents a set of generated personas for a source document.

descriptions: list[str]
metadata: dict
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class afterimage.types.Role(value)[source]

Bases: str, Enum

ASSISTANT = 'assistant'
USER = 'user'
class afterimage.types.StructuredGenerationRow(*, instruction: str, context: str | None = None, persona: str | None = None, output: T, metadata: Dict[str, ~typing.Any]=<factory>)[source]

Bases: BaseModel, Generic[T]

Represents a single row of structured generation, including metadata.

context: str | None
instruction: str
metadata: Dict[str, Any]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

output: T
persona: str | None