diff --git a/CHANGELOG.md b/CHANGELOG.md index 0528b1a46..59947dc5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Parsing streaming response with some OpenAi compatible services. +## [0.30.1] - 2024-08-21 + +### Fixed +- `CsvExtractionEngine` not using provided `Ruleset`s. +- Docs examples for Extraction Engines not properly passing in schemas. + ## [0.30.0] - 2024-08-20 ### Added diff --git a/docs/griptape-framework/engines/src/extraction_engines_1.py b/docs/griptape-framework/engines/src/extraction_engines_1.py index c681980f2..17644ebf2 100644 --- a/docs/griptape-framework/engines/src/extraction_engines_1.py +++ b/docs/griptape-framework/engines/src/extraction_engines_1.py @@ -4,7 +4,7 @@ # Initialize the CsvExtractionEngine instance csv_engine = CsvExtractionEngine( - prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo"), + prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo"), column_names=["name", "age", "location"] ) # Define some unstructured data @@ -15,7 +15,7 @@ """ # Extract CSV rows using the engine -result = csv_engine.extract(sample_text, column_names=["name", "age", "location"]) +result = csv_engine.extract(sample_text) if isinstance(result, ListArtifact): for row in result.value: diff --git a/docs/griptape-framework/engines/src/extraction_engines_2.py b/docs/griptape-framework/engines/src/extraction_engines_2.py index d47bb48e5..a100754b3 100644 --- a/docs/griptape-framework/engines/src/extraction_engines_2.py +++ b/docs/griptape-framework/engines/src/extraction_engines_2.py @@ -4,8 +4,12 @@ from griptape.drivers import OpenAiChatPromptDriver from griptape.engines import JsonExtractionEngine +# Define a schema for extraction +user_schema = Schema({"users": [{"name": str, "age": int, "location": str}]}).json_schema("UserSchema") + + json_engine = JsonExtractionEngine( - prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo"), + prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo"), template_schema=user_schema ) # Define some unstructured data @@ -14,11 +18,8 @@ Bob (Age 35) lives in California. """ -# Define a schema for extraction -user_schema = Schema({"users": [{"name": str, "age": int, "location": str}]}).json_schema("UserSchema") - # Extract data using the engine -result = json_engine.extract(sample_json_text, template_schema=user_schema) +result = json_engine.extract(sample_json_text) if isinstance(result, ListArtifact): for artifact in result.value: diff --git a/docs/griptape-framework/structures/src/tasks_6.py b/docs/griptape-framework/structures/src/tasks_6.py index a1b84e44d..ecd6f354f 100644 --- a/docs/griptape-framework/structures/src/tasks_6.py +++ b/docs/griptape-framework/structures/src/tasks_6.py @@ -4,7 +4,9 @@ from griptape.tasks import ExtractionTask # Instantiate the CSV extraction engine -csv_extraction_engine = CsvExtractionEngine(prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo")) +csv_extraction_engine = CsvExtractionEngine( + prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo"), column_names=["Name", "Age", "Address"] +) # Define some unstructured data and columns csv_data = """ @@ -13,15 +15,12 @@ Charlie is 40 and lives in Texas. """ -columns = ["Name", "Age", "Address"] - # Create an agent and add the ExtractionTask to it agent = Agent() agent.add_task( ExtractionTask( extraction_engine=csv_extraction_engine, - args={"column_names": columns}, ) ) diff --git a/docs/griptape-framework/structures/src/tasks_7.py b/docs/griptape-framework/structures/src/tasks_7.py index 909d00084..da5deda88 100644 --- a/docs/griptape-framework/structures/src/tasks_7.py +++ b/docs/griptape-framework/structures/src/tasks_7.py @@ -8,6 +8,7 @@ # Instantiate the json extraction engine json_extraction_engine = JsonExtractionEngine( prompt_driver=OpenAiChatPromptDriver(model="gpt-3.5-turbo"), + template_schema=Schema({"users": [{"name": str, "age": int, "location": str}]}).json_schema("UserSchema"), ) # Define some unstructured data and a schema @@ -15,13 +16,11 @@ Alice (Age 28) lives in New York. Bob (Age 35) lives in California. """ -user_schema = Schema({"users": [{"name": str, "age": int, "location": str}]}).json_schema("UserSchema") agent = Agent() agent.add_task( ExtractionTask( extraction_engine=json_extraction_engine, - args={"template_schema": user_schema}, ) ) diff --git a/pyproject.toml b/pyproject.toml index e02c08b6e..2afdc5910 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "griptape" -version = "0.30.0" +version = "0.30.1" description = "Modular Python framework for LLM workflows, tools, memory, and data." authors = ["Griptape "] license = "Apache 2.0"