compass.plugin.ordinance.OrdinanceParser#
- class OrdinanceParser(llm_service, usage_tracker=None, **kwargs)[source]#
Bases:
BaseLLMCaller,BaseParserBase class for parsing structured data
- Parameters:
llm_service (
Service) – LLM service used for queries.usage_tracker (
UsageTracker, optional) – Optional tracker instance to monitor token usage during LLM calls. By default,None.**kwargs –
Keyword arguments to be passed to the underlying service processing function (i.e.
llm_service.call(**kwargs)). Should not contain the following keys:usage_sub_label
messages
These arguments are provided by this caller object.
Methods
parse(text)Parse text and extract structured data
Attributes
Identifier for text ingested by this class
Identifier for final structured data output
ID to use for this extraction for linking with LLM configs
- TASK_ID = 'data_extraction'#
ID to use for this extraction for linking with LLM configs
- abstractmethod async parse(text)#
Parse text and extract structured data
- Parameters:
text (
str) – Text which may or may not contain information relevant to the current extraction.- Returns:
pandas.DataFrameorNone– DataFrame containing structured extracted data. Can also beNoneif no relevant values can be parsed from the text.