Skip to content

Commit

Permalink
Chore/main (#1099)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew French <[email protected]>
Co-authored-by: Vasily Vasinov <[email protected]>
Co-authored-by: Matt Vallillo <[email protected]>
Co-authored-by: dylanholmes <[email protected]>
Co-authored-by: Michal <[email protected]>
Co-authored-by: Zach Giordano <[email protected]>
Co-authored-by: Ikko Eltociear Ashimine <[email protected]>
Co-authored-by: torabshaikh <[email protected]>
Co-authored-by: Aodhan Roche <[email protected]>
Co-authored-by: Kyle Roche <[email protected]>
Co-authored-by: Emily Danielson <[email protected]>
Co-authored-by: CJ Kindel <[email protected]>
Co-authored-by: hkhajgiwale <[email protected]>
Co-authored-by: Harsh Khajgiwale <[email protected]>
Co-authored-by: Anush <[email protected]>
Co-authored-by: datashaman <[email protected]>
Co-authored-by: Stefano Lottini <[email protected]>
Co-authored-by: James Clarendon <[email protected]>
  • Loading branch information
19 people authored Aug 21, 2024
1 parent e00d10e commit 489453e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/griptape-framework/engines/src/extraction_engines_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
11 changes: 6 additions & 5 deletions docs/griptape-framework/engines/src/extraction_engines_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
7 changes: 3 additions & 4 deletions docs/griptape-framework/structures/src/tasks_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand All @@ -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},
)
)

Expand Down
3 changes: 1 addition & 2 deletions docs/griptape-framework/structures/src/tasks_7.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@
# 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
json_data = """
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},
)
)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
license = "Apache 2.0"
Expand Down

0 comments on commit 489453e

Please sign in to comment.