Skip to content

archaeo_super_prompt.modeling.struct_extract.extractors.intervention_date

source package archaeo_super_prompt.modeling.struct_extract.extractors.intervention_date

LLM-based extraction of the date of start of the intervention.

We expect the model to predict a window of dates for the start of the intervention. This model has a known/guessed date of archiving of the report and can output a window at least before this date.

The precision of the window is among those below

  1. Day
  2. Month
  3. Year Moreover, the earlier date in the window can be open if the information is not guessable. The most recent in the window must be by default the date of archiving if the information is unknown.

Classes

  • Data Un data. A volte, il giorno o il mese possono avere un valore artificiale quando la precisione non consente di prevedere questi campi.

  • StimareDataDellIntervento Degli framenti datti di relazione archeologiche, stima il momento di partenza dell'indagine in una finestra de due date, con un precisione al giorno, al mese o all'anno più vicino. Se non ci sono molte informazione, ritorna almeno una finestra prima di la data di archiviazone datta. La data minima può essere lasciata sconosciuta.

  • DataInterventoInputData Chunks of reports of an archaeological intervention with supposed information about the date of the intervention.

  • DataInterventoOutputData A predicted maximum date for the intervention, in un window.

  • EstimateInterventionDate DSPy model for the extraction of the date of the intervention.

  • InputForInterventionDate When indentifying the date of an intervention, we refer first to the date of protocol.

  • InputForInterventionDateRowSchema When indentifying the date of an intervention, we refer first to the date of protocol.

  • DateFeatSchema Extracted data about the intervention start date.

  • InterventionStartExtractor Dspy-LLM-based extractor of the comune data.

source class Data(**data: Any)

Bases : pydantic.BaseModel

Un data. A volte, il giorno o il mese possono avere un valore artificiale quando la precisione non consente di prevedere questi campi.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Attributes

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

  • model_extra : dict[str, Any] | None Get extra fields set during validation.

  • model_fields_set : set[str] Returns the set of fields that have been explicitly set on this model instance.

source class StimareDataDellIntervento(**data: Any)

Bases : dspy.Signature

Degli framenti datti di relazione archeologiche, stima il momento di partenza dell'indagine in una finestra de due date, con un precisione al giorno, al mese o all'anno più vicino. Se non ci sono molte informazione, ritorna almeno una finestra prima di la data di archiviazone datta. La data minima può essere lasciata sconosciuta.

  1. Innanzitutto, determina se c'è una data minima e la precisione con cui puoi approssimare la finestra.
  2. Quindi, determina la finestra, inserendo valori predefiniti (ma ben tipizzati) nei campi non coperti dalla precisione. a. Se possibile, restringi la finestra a un punto impostando le stesse date minima e massima.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Attributes

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

  • model_extra : dict[str, Any] | None Get extra fields set during validation.

  • model_fields_set : set[str] Returns the set of fields that have been explicitly set on this model instance.

source class DataInterventoInputData(**data: Any)

Bases : pydantic.BaseModel

Chunks of reports of an archaeological intervention with supposed information about the date of the intervention.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Attributes

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

  • model_extra : dict[str, Any] | None Get extra fields set during validation.

  • model_fields_set : set[str] Returns the set of fields that have been explicitly set on this model instance.

source class DataInterventoOutputData(**data: Any)

Bases : pydantic.BaseModel

A predicted maximum date for the intervention, in un window.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Attributes

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

  • model_extra : dict[str, Any] | None Get extra fields set during validation.

  • model_fields_set : set[str] Returns the set of fields that have been explicitly set on this model instance.

source class EstimateInterventionDate()

Bases : dspy.Module

DSPy model for the extraction of the date of the intervention.

Initialize only a chain of thought.

Methods

source method EstimateInterventionDate.forward(fragmenti_relazione: str, data_di_archiviazone: Data)dspy.Prediction

Simple date parsing.

source class InputForInterventionDate()

Bases : BaseInputForExtraction

When indentifying the date of an intervention, we refer first to the date of protocol.

source class InputForInterventionDateRowSchema()

Bases : BaseInputForExtractionRowSchema

When indentifying the date of an intervention, we refer first to the date of protocol.

source class DateFeatSchema()

Bases : BasePerInterventionFeatureSchema

Extracted data about the intervention start date.

source class InterventionStartExtractor(llm_model_provider: LLMProvider, llm_model_id: str, llm_temperature: float)

Bases : FieldExtractor[DataInterventoInputData, DataInterventoOutputData, InputForInterventionDate, InputForInterventionDateRowSchema, DateFeatSchema]

Dspy-LLM-based extractor of the comune data.

Initialize the extractor with providing it the llm which will be used.

Attributes

  • signature_example Return an example of input/output dict pair for the dspy model.

  • lm Return the llm model.

Methods

source classmethod InterventionStartExtractor.filter_training_dataset(y: MagohDataset, ids: set[InterventionId])set[InterventionId]

source staticmethod InterventionStartExtractor.field_to_be_extracted()