Skip to content

archaeo_super_prompt.modeling.struct_extract.extractors.comune

source package archaeo_super_prompt.modeling.struct_extract.extractors.comune

Comune LLM extractor.

Classes

  • Comune Questo elemento fornisce informazioni su un comune. È possibile trovare questo tipo di informazioni nel testo.

  • IdentificaComune Identifica il unico comune in cui si sono svolti i lavori archeologici descritti in questi frammenti di relazione. I comuni possibili sono indicati.

  • ComuneInputData Chunks of reports of an archaeological intervention with supposed information about the comune where the operations took place.

  • ComuneOutputData A predicted comune where the intervention took place, with its provincia.

  • FindComune DSPy model for the extraction of the comune.

  • ComuneFeatSchema Extracted data about the Comune.

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

source class Comune(**data: Any)

Bases : pydantic.BaseModel

Questo elemento fornisce informazioni su un comune. È possibile trovare questo tipo di informazioni nel testo.

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 IdentificaComune(**data: Any)

Bases : dspy.Signature

Identifica il unico comune in cui si sono svolti i lavori archeologici descritti in questi frammenti di relazione. I comuni possibili sono indicati.

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 ComuneInputData(**data: Any)

Bases : pydantic.BaseModel

Chunks of reports of an archaeological intervention with supposed information about the comune where the operations took place.

Identified likely comuni with their province are also provided to help in the extraction.

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 ComuneOutputData(**data: Any)

Bases : pydantic.BaseModel

A predicted comune where the intervention took place, with its provincia.

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 FindComune()

Bases : dspy.Module

DSPy model for the extraction of the comune.

Initialize only a chain of thought.

Methods

source method FindComune.forward(fragmenti_relazione: str, possibili_comuni: list[Comune])dspy.Prediction

Direct forward.

source class ComuneFeatSchema()

Bases : BasePerInterventionFeatureSchema

Extracted data about the Comune.

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

Bases : FieldExtractor[ComuneInputData, ComuneOutputData, InputForExtractionWithSuggestedThesauri, InputForExtractionWithSuggestedThesauriRowSchema, ComuneFeatSchema]

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 ComuneExtractor.filter_training_dataset(y: MagohDataset, ids: set[InterventionId])set[InterventionId]

source staticmethod ComuneExtractor.field_to_be_extracted()