Skip to content

feat: add __enter__ and __aenter__ for context manager support#642

Open
Pawansingh3889 wants to merge 1 commit intoollama:mainfrom
Pawansingh3889:feat/client-close-context-manager
Open

feat: add __enter__ and __aenter__ for context manager support#642
Pawansingh3889 wants to merge 1 commit intoollama:mainfrom
Pawansingh3889:feat/client-close-context-manager

Conversation

@Pawansingh3889
Copy link
Copy Markdown

Adds missing enter and aenter to BaseClient. close()/exit already existed but without entry methods, with Client() as c: raised TypeError.

Client and AsyncClient had __exit__/__aexit__ and close() methods
but were missing __enter__/__aenter__, so `with Client() as c:` and
`async with AsyncClient() as c:` would raise TypeError.

Closes ollama#532
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