Extract Table Properties

class sycamore.transforms.extract_table_properties.ExtractTableProperties(child: Node, parameters: list[str | LLM], **resource_args)[source]

Bases: SingleThreadUser, NonGPUUser, Map

The ExtractTableProperties transform extracts key-value pairs from tables and adds them as properties to the table. It only processes tables that are one level deep.

Parameters:
  • child -- The source node or component that provides the hierarchical documents for extracting table property.

  • resource_args -- Additional resource-related arguments that can be passed to the extract operation.

Example

source_node = ...  # Define a source node or component that provides hierarchical documents.
llm = openAI('gpt-4o-mini')
property_extract = ExtractKeyValuePair(child=source_node, list=["property_name",llm])
property_dataset = property_extract.execute()
static extract_parent_json(input_string: str) str[source]

Extracts the top level JSONstring from input String.

static extract_table_properties(parent: Document, property_name: str, llm: LLM, prompt_find_table: str | None = None, prompt_LLM: str | None = None) Document[source]

This method is used to extract key/value pairs from tables, using the LLM, and populate them as a property of that element.