Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/structure/src/config/properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"schemaVersion": "0.0.1",
"displayName": "Structure Tool",
"functionName": "structure_tool",
"toolVersion": "0.0.101",
"toolVersion": "0.0.102",
"description": "This is a template tool which can answer set of input prompts designed in the Prompt Studio",
"input": {
"description": "File that needs to be indexed and parsed for answers"
Expand Down
1 change: 1 addition & 0 deletions tools/structure/src/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class SettingsKeys:
TOOL = "tool"
METRICS = "metrics"
INDEXING = "indexing"
EXTRACTION = "extraction"
EXECUTION_ID = "execution_id"
IS_DIRECTORY_MODE = "is_directory_mode"
LLM_PROFILE_ID = "llm_profile_id"
Expand Down
14 changes: 13 additions & 1 deletion tools/structure/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ def run(
)

extracted_text = ""
extraction_metrics = {}
usage_kwargs: dict[Any, Any] = dict()
if skip_extraction_and_indexing:
self.stream_log(
Expand All @@ -328,6 +329,7 @@ def run(
usage_kwargs[UsageKwargs.RUN_ID] = self.file_execution_id
usage_kwargs[UsageKwargs.FILE_NAME] = self.source_file_name
usage_kwargs[UsageKwargs.EXECUTION_ID] = self.execution_id
extraction_start_time = datetime.datetime.now()
extracted_text = STHelper.dynamic_extraction(
file_path=input_file,
enable_highlight=is_highlight_enabled,
Expand All @@ -338,6 +340,13 @@ def run(
tool=self,
execution_run_data_folder=str(execution_run_data_folder),
)
extraction_metrics = {
SettingsKeys.EXTRACTION: {
"time_taken(s)": STHelper.elapsed_time(
start_time=extraction_start_time
)
}
}

index_metrics = {}
if is_summarization_enabled:
Expand Down Expand Up @@ -458,7 +467,10 @@ def run(
"No text is extracted from the document to add to the metadata"
)
if merged_metrics := self._merge_metrics(
structured_output.get(SettingsKeys.METRICS, {}), index_metrics
self._merge_metrics(
structured_output.get(SettingsKeys.METRICS, {}), index_metrics
),
extraction_metrics,
):
structured_output[SettingsKeys.METRICS] = merged_metrics
# Update GUI
Expand Down
Loading