Skip to content

Commit

Permalink
typos to dev dependencies to catch typos in code/docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
collindutter committed Jul 1, 2024
1 parent f8be8ee commit baa7eae
Show file tree
Hide file tree
Showing 19 changed files with 67 additions and 19 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,16 @@ jobs:
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
spell:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.12" ]
steps:
- name: Checkout actions
uses: actions/checkout@v3
- name: Init environment
uses: ./.github/actions/init-environment
- name: Run linter
run: make check/spell
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ repos:
entry: make check/types
language: system
types: [python]
- repo: local
hooks:
- id: typos
name: Typos
entry: make check/spell
language: system
types: [python]
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `VectorStoreClient.process_query_output_fn` for custom query output processing logic.
- Parameter `fail_fast` to `Structure`.
- `BooleanArtifact` for handling boolean values.
- `typos` to dev dependencies to catch typos in code/docs.

### Changed
- **BREAKING**: `BaseVectorStoreDriver.upsert_text_artifact()` and `BaseVectorStoreDriver.upsert_text()` use artifact/string values to generate `vector_id` if it wasn't implicitly passed. This change ensures that we don't generate embeddings for the same content every time.
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ format: ## Format project.
@poetry run ruff format .

.PHONY: check
check: check/format check/lint check/types ## Run all checks.
check: check/format check/lint check/types check/spell ## Run all checks.

.PHONY: check/format
check/format:
Expand All @@ -53,6 +53,10 @@ check/lint:
.PHONY: check/types
check/types:
@poetry run pyright griptape/

.PHONY: check/spell
check/spell:
@poetry run typos

.DEFAULT_GOAL := help
.PHONY: help
Expand Down
6 changes: 6 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[default.extend-words]
# Don't correct the state ND
ND = "ND"

[files]
extend-exclude = ["docs/assets", "tests/resources/"]
2 changes: 1 addition & 1 deletion docs/griptape-framework/drivers/prompt-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ print(result.value)
Griptape offers the following Prompt Drivers for interacting with LLMs.

!!! warning
When overriding a default Prompt Driver, take care to ensure you've updated the Structure's configured Embedding Driver as well. If Task Memory isn't needed, you can avoid compatability issues by setting `task_memory=None` to disable Task Memory in your Structure.
When overriding a default Prompt Driver, take care to ensure you've updated the Structure's configured Embedding Driver as well. If Task Memory isn't needed, you can avoid compatibility issues by setting `task_memory=None` to disable Task Memory in your Structure.

### OpenAI Chat

Expand Down
2 changes: 1 addition & 1 deletion docs/griptape-framework/drivers/web-search-drivers.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Web Search Drivers can be used to search for links from a search query. They are used by [WebSearch](../../reference/griptape/tools/web_search/tool.md) to provide its functionality. All Web Search Drivers implement the following methods:

* `search()` searchs the web and returns a [ListArtifact](../../reference/griptape/artifacts/list_artifact.md) that contains JSON-serializable [TextArtifact](../../reference/griptape/artifacts/text_artifact.md)s with the search results.
* `search()` searches the web and returns a [ListArtifact](../../reference/griptape/artifacts/list_artifact.md) that contains JSON-serializable [TextArtifact](../../reference/griptape/artifacts/text_artifact.md)s with the search results.

## Google

Expand Down
2 changes: 1 addition & 1 deletion docs/griptape-framework/misc/tokenizers.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Overview

Tokenizers are used throughout Griptape to calculate the number of [tokens](https://learn.microsoft.com/en-us/semantic-kernel/prompt-engineering/tokens) in a piece of text.
They are particulary useful for ensuring that the LLM token limits are not exceeded.
They are particularly useful for ensuring that the LLM token limits are not exceeded.

Tokenizers are a low level abstraction that you will rarely interact with directly.

Expand Down
2 changes: 1 addition & 1 deletion docs/griptape-framework/structures/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pipeline.run("Write me a haiku about sailing.")
Sea whispers secrets to hull,
Horizon awaits.
[09/08/23 10:19:21] INFO PromptTask 28e36610063e4d728228a814b48296ef
Output: Yarr! Th' sails snag th' mornin' zephyr,
Output: Yarr! Th' sails snag th' morning zephyr,
Th' sea be whisperin' secrets to th' hull,
Th' horizon be awaitin', matey.
```
2 changes: 1 addition & 1 deletion docs/griptape-framework/structures/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ engine = VariationImageGenerationEngine(
with open("tests/resources/mountain.png", "rb") as f:
image_artifact = ImageLoader().load(f.read())

# Instatiate a pipeline.
# Instantiate a pipeline.
pipeline = Pipeline()

# Add a VariationImageGenerationTask to the pipeline.
Expand Down
2 changes: 1 addition & 1 deletion griptape/drivers/file_manager/base_file_manager_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BaseFileManagerDriver(ABC):
Attributes:
default_loader: The default loader to use for loading file contents into artifacts.
loaders: Dictionary of file extension specifc loaders to use for loading file contents into artifacts.
loaders: Dictionary of file extension specific loaders to use for loading file contents into artifacts.
"""

default_loader: loaders.BaseLoader = field(default=Factory(lambda: loaders.BlobLoader()), kw_only=True)
Expand Down
2 changes: 1 addition & 1 deletion griptape/drivers/prompt/base_prompt_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

@define(kw_only=True)
class BasePromptDriver(SerializableMixin, ExponentialBackoffMixin, ABC):
"""Base class for Prompt Drivers.
"""Base class for the Prompt Drivers.
Attributes:
temperature: The temperature to use for the completion.
Expand Down
25 changes: 21 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ ruff = "^0.4.6"
pyright = "^1.1.363"
pre-commit = "^3.7.1"
boto3-stubs = {extras = ["bedrock", "iam", "opensearch", "s3", "sagemaker"], version = "^1.34.105"}
typos = "^1.22.9"


[tool.poetry.group.docs]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_validate_workdir(self, workdir, session, bucket):
@pytest.mark.parametrize(
"workdir,path,expected",
[
# Valid non-empty directories (witout trailing slash)
# Valid non-empty directories (without trailing slash)
("/", "", ["foo", "foo.txt", "foo-empty", "resources"]),
("/", "foo", ["bar", "bar.txt", "bar-empty"]),
("/", "foo/bar", ["baz.txt", "baz-empty"]),
Expand All @@ -111,7 +111,7 @@ def test_validate_workdir(self, workdir, session, bucket):
("/./..", "bar/..", ["foo", "foo.txt", "foo-empty", "resources"]),
("/./..", "foo/.", ["bar", "bar.txt", "bar-empty"]),
("/./..", "foo/bar/.", ["baz.txt", "baz-empty"]),
# Empty folders (witout trailing slash)
# Empty folders (without trailing slash)
("/", "foo-empty", []),
("/", "foo/bar-empty", []),
("/", "foo/bar/baz-empty", []),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_validate_workdir(self):
@pytest.mark.parametrize(
"workdir,path,expected",
[
# Valid non-empty directories (witout trailing slash)
# Valid non-empty directories (without trailing slash)
("/", "", ["foo", "foo.txt", "foo-empty", "resources"]),
("/", "foo", ["bar", "bar.txt", "bar-empty"]),
("/", "foo/bar", ["baz.txt", "baz-empty"]),
Expand All @@ -84,7 +84,7 @@ def test_validate_workdir(self):
("/./..", "bar/..", ["foo", "foo.txt", "foo-empty", "resources"]),
("/./..", "foo/.", ["bar", "bar.txt", "bar-empty"]),
("/./..", "foo/bar/.", ["baz.txt", "baz-empty"]),
# Empty folders (witout trailing slash)
# Empty folders (without trailing slash)
("/", "foo-empty", []),
("/", "foo/bar-empty", []),
("/", "foo/bar/baz-empty", []),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

TEST_CONVERSATION = '{"type": "ConversationMemory", "runs": [{"type": "Run", "id": "729ca6be5d79433d9762eb06dfd677e2", "input": "Hi There, Hello", "output": "Hello! How can I assist you today?"}], "max_runs": 2}'
CONVERSATION_ID = "117151897f344ff684b553d0655d8f39"
INDEX = "griptape_converstaion"
INDEX = "griptape_conversation"
HOST = "127.0.0.1"
PORT = 6379
PASSWORD = ""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from unittest.mock import MagicMock
import pytest
import redis
from tests.mocks.mock_embedding_driver import MockEmbeddingDriver
from griptape.drivers import RedisVectorStoreDriver

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/structures/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ def test_output_task(self):
# task4 is the final task, but its defined at index 0
workflow = Workflow(prompt_driver=MockPromptDriver(), tasks=[task4, task1, task2, task3])

# ouput_task topologically should be task4
# output_task topologically should be task4
assert task4 == workflow.output_task

def test_to_graph(self):
Expand Down

0 comments on commit baa7eae

Please sign in to comment.