Skip to content

Commit 3aaf7e7

Browse files
committed
Fix spelling errors; add spellcheck to precommit
1 parent defa62a commit 3aaf7e7

File tree

12 files changed

+29
-18
lines changed

12 files changed

+29
-18
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,13 @@ repos:
55
name: Run pre-commit checks (format, sort-imports, check-mypy)
66
entry: bash -c 'poetry run format && poetry run sort-imports && poetry run check-mypy'
77
language: system
8-
pass_filenames: false
8+
pass_filenames: false
9+
- repo: https://github.com/codespell-project/codespell
10+
rev: v2.2.6
11+
hooks:
12+
- id: codespell
13+
name: Check spelling
14+
args:
15+
- --write-changes
16+
- --skip=*.pyc,*.pyo,*.lock,*.git,*.mypy_cache,__pycache__,*.egg-info,.pytest_cache,docs/_build,env,venv,.venv
17+
- --ignore-words-list=enginee

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,5 @@ asyncio_mode = "auto"
123123
[tool.mypy]
124124
warn_unused_configs = true
125125
ignore_missing_imports = true
126+
exclude = ["env", "venv", ".venv"]
127+

redisvl/extensions/cache/llm/semantic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def check(
385385
.. code-block:: python
386386
387387
response = cache.check(
388-
prompt="What is the captial city of France?"
388+
prompt="What is the capital city of France?"
389389
)
390390
"""
391391
if not any([prompt, vector]):
@@ -476,7 +476,7 @@ async def acheck(
476476
.. code-block:: python
477477
478478
response = await cache.acheck(
479-
prompt="What is the captial city of France?"
479+
prompt="What is the capital city of France?"
480480
)
481481
"""
482482
aindex = await self._get_async_index()
@@ -588,7 +588,7 @@ def store(
588588
.. code-block:: python
589589
590590
key = cache.store(
591-
prompt="What is the captial city of France?",
591+
prompt="What is the capital city of France?",
592592
response="Paris",
593593
metadata={"city": "Paris", "country": "France"}
594594
)
@@ -656,7 +656,7 @@ async def astore(
656656
.. code-block:: python
657657
658658
key = await cache.astore(
659-
prompt="What is the captial city of France?",
659+
prompt="What is the capital city of France?",
660660
response="Paris",
661661
metadata={"city": "Paris", "country": "France"}
662662
)

redisvl/extensions/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
Constants used within the extension classes SemanticCache, BaseMessageHistory,
33
MessageHistory, SemanticMessageHistory and SemanticRouter.
4-
These constants are also used within theses classes corresponding schema.
4+
These constants are also used within these classes' corresponding schemas.
55
"""
66

77
# BaseMessageHistory

redisvl/extensions/message_history/base_history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def get_recent(
6060
raw: bool = False,
6161
session_tag: Optional[str] = None,
6262
) -> Union[List[str], List[Dict[str, str]]]:
63-
"""Retreive the recent conversation history in sequential order.
63+
"""Retrieve the recent conversation history in sequential order.
6464
6565
Args:
6666
top_k (int): The number of previous exchanges to return. Default is 5.

redisvl/extensions/message_history/semantic_history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def get_recent(
248248
raw: bool = False,
249249
session_tag: Optional[str] = None,
250250
) -> Union[List[str], List[Dict[str, str]]]:
251-
"""Retreive the recent message history in sequential order.
251+
"""Retrieve the recent message history in sequential order.
252252
253253
Args:
254254
top_k (int): The number of previous exchanges to return. Default is 5.

redisvl/query/filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ def __str__(self) -> str:
624624
if not self._filter and not self._operator:
625625
raise ValueError("Improperly initialized FilterExpression")
626626

627-
# if theres an operator, combine expressions accordingly
627+
# if there's an operator, combine expressions accordingly
628628
if self._operator:
629629
if not isinstance(self._left, FilterExpression) or not isinstance(
630630
self._right, FilterExpression

redisvl/utils/vectorize/text/custom.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class CustomTextVectorizer(BaseVectorizer):
4141
This vectorizer is designed to accept a provided callable text vectorizer and
4242
provides a class definition to allow for compatibility with RedisVL.
4343
The vectorizer may support both synchronous and asynchronous operations which
44-
allows for batch processing of texts, but at a minimum only syncronous embedding
44+
allows for batch processing of texts, but at a minimum only synchronous embedding
4545
is required to satisfy the 'embed()' method.
4646
4747
You can optionally enable caching to improve performance when generating
@@ -94,8 +94,8 @@ def __init__(
9494
Args:
9595
embed (Callable): a Callable function that accepts a string object and returns a list of floats.
9696
embed_many (Optional[Callable]): a Callable function that accepts a list of string objects and returns a list containing lists of floats. Defaults to None.
97-
aembed (Optional[Callable]): an asyncronous Callable function that accepts a string object and returns a lists of floats. Defaults to None.
98-
aembed_many (Optional[Callable]): an asyncronous Callable function that accepts a list of string objects and returns a list containing lists of floats. Defaults to None.
97+
aembed (Optional[Callable]): an asynchronous Callable function that accepts a string object and returns a lists of floats. Defaults to None.
98+
aembed_many (Optional[Callable]): an asynchronous Callable function that accepts a list of string objects and returns a list containing lists of floats. Defaults to None.
9999
dtype (str): the default datatype to use when embedding text as byte arrays.
100100
Used when setting `as_buffer=True` in calls to embed() and embed_many().
101101
Defaults to 'float32'.

tests/integration/test_llmcache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ def test_cache_filtering(cache_with_filters):
744744
)
745745
assert len(results) == 4
746746

747-
# test no results are returned if we pass a nonexistant tag
747+
# test no results are returned if we pass a nonexistent tag
748748
bad_filter = Tag("label") == "bad tag"
749749
results = cache_with_filters.check(
750750
"test prompt 1", filter_expression=bad_filter, num_results=5

tests/unit/test_aggregation_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_aggregate_hybrid_query():
2626

2727
assert isinstance(hybrid_query, AggregateRequest)
2828

29-
# Check defaut properties
29+
# Check default properties
3030
assert hybrid_query._text == sample_text
3131
assert hybrid_query._text_field == text_field_name
3232
assert hybrid_query._vector == sample_vector

tests/unit/test_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
(
3939
"==",
4040
["hypen-tag", "under_score", "dot.tag"],
41-
"@tag_field:{hypen\\-tag|under_score|dot\\.tag}",
41+
"@tag_field:{hyphen\\-tag|under_score|dot\\.tag}",
4242
),
4343
# ...additional unique cases as desired...
4444
],

tests/unit/test_query_types.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,9 @@ def test_string_filter_expressions(query):
367367
assert query.query_string().__contains__("hello world")
368368

369369
# Optional flag
370-
query.set_filter("~(@desciption:(hello | world))")
371-
assert query._filter_expression == "~(@desciption:(hello | world))"
372-
assert query.query_string().__contains__("~(@desciption:(hello | world))")
370+
query.set_filter("~(@description:(hello | world))")
371+
assert query._filter_expression == "~(@description:(hello | world))"
372+
assert query.query_string().__contains__("~(@description:(hello | world))")
373373

374374

375375
def test_vector_query_hybrid_policy():

0 commit comments

Comments
 (0)