Extraction Engines v1.3.6 (LTS)
Adapted from the Griptape AI Framework documentation.
Overview
Extraction Engines enable the extraction of structured data from unstructured text. These Engines can be used with Structures via Extraction Tasks. As of now, Gen AI Builder supports two types of Extraction Engines: the CSV Extraction Engine and the JSON Extraction Engine.
CSV
The CSV Extraction Engine extracts comma separated values from unstructured text.
from griptape.drivers.prompt.openai import OpenAiChatPromptDriver from griptape.engines import CsvExtractionEngine # Initialize the CsvExtractionEngine instance csv_engine = CsvExtractionEngine( prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo"), column_names=["name", "age", "location"] ) # Define some unstructured data sample_text = """ Alice, 28, lives in New York. Bob, 35 lives in California Charlie is 40 Collin is 28 and lives in San Francisco """ # Extract CSV rows using the engine result = csv_engine.extract_text(sample_text) for row in result: print(row.to_text())