Skip to content

Memoization destorys semchunk.chunk()'s signature #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
umarbutler opened this issue Mar 11, 2024 · 1 comment
Closed

Memoization destorys semchunk.chunk()'s signature #2

umarbutler opened this issue Mar 11, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@umarbutler
Copy link
Collaborator

umarbutler commented Mar 11, 2024

Memoization is destorying semchunk.chunk()'s signature as described in this issue. A fix is to run:

def chunk(text: str, chunk_size: int, token_counter: callable, memoize: bool=True, _recursion_depth: int = 0) -> list[str]:
    ...

chunk = functools.wraps(chunk)(functools.cache(chunk))

Instead of:

@functools.cache
def chunk(text: str, chunk_size: int, token_counter: callable, memoize: bool=True, _recursion_depth: int = 0) -> list[str]:
    ...
@umarbutler umarbutler added the bug Something isn't working label Mar 11, 2024
@umarbutler umarbutler self-assigned this Mar 11, 2024
@umarbutler
Copy link
Collaborator Author

This bug has been fixed in v0.2.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant