Skip to content

Convert module constants to IntEnum #4

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kilian-hu
Copy link

(Incomplete draft for now until it is decided whether this is preferrable)

This PR converts some of the module constants, which come from the C enums, to proper IntEnums. That arguably makes the API cleaner and easier to use.

Instead of

llama_cpp.Llama("model.gguf", type_k=llama_cpp.GGML_TYPE_Q8_0)

it would be

llama_cpp.Llama("model.gguf", type_k=llama_cpp.GGMLType.Q8_0)

and one gets to enjoy better code completion due to better type hints.

This is a breaking change unless we leave the module constants but set them to the values of the IntEnums. Imo it's fine as long as the version is bumped accordingly so I'd like to just clean this up and not leave the module constants.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant