refactor: Fix type annotation errors and remove unused code#548
Open
jakekasan wants to merge 1 commit intoollama:mainfrom
Open
refactor: Fix type annotation errors and remove unused code#548jakekasan wants to merge 1 commit intoollama:mainfrom
jakekasan wants to merge 1 commit intoollama:mainfrom
Conversation
0cdaa96 to
3604002
Compare
3604002 to
57c026c
Compare
ParthSareen
reviewed
Aug 15, 2025
| def __init__( | ||
| self, | ||
| client, | ||
| client: Type[CT], |
Member
There was a problem hiding this comment.
What LSP are you using which is giving you the annotation errors?
Author
There was a problem hiding this comment.
Basedpyright with typeCheckingMode = "strict" in the settings. This specific error popped up when I had the actual ollama-python project open, not when I was just using ollama-python in another project. It caused a lot of other LSP diagnostic errors because most methods of Client and AsyncClient just wrap _client, so it being untyped meant that everything else was as well.
To be honest, there probably is a more elegant way to annotate this using ParamSpec and all that but that looked like a pretty deep rabbit hole... 😅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change fixes annoying LSP diagnostic errors when using this library and pyright/basedpyright is set to strict mode.
The main issue was that the overloads for methods with a stream option were incorrect and confused the LSP. Also removes a function that was never used.