Skip to content
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

Add type overloads to methods #181

Merged
merged 7 commits into from
Jun 19, 2024
Merged

Add type overloads to methods #181

merged 7 commits into from
Jun 19, 2024

Conversation

royjhan
Copy link
Contributor

@royjhan royjhan commented Jun 5, 2024

In reference to #132

@royjhan royjhan requested a review from mxyng June 6, 2024 16:39
system: str = '',
template: str = '',
context: Optional[Sequence[int]] = None,
stream: bool = False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect since it creates an overlap between the two overloads

Suggested change
stream: bool = False,
stream: Literal[False] = False,

system: str = '',
template: str = '',
context: Optional[Sequence[int]] = None,
stream: bool = True,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
stream: bool = True,
stream: Literal[True] = True,

self,
model: str = '',
messages: Optional[Sequence[Message]] = None,
stream: Literal[False] = False,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
stream: Literal[False] = False,
stream: bool = False,

images: Optional[Sequence[AnyStr]] = None,
options: Optional[Options] = None,
keep_alive: Optional[Union[float, str]] = None,
) -> Mapping[str, Any]: ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is minor but it'd be better if ... was on a newline. it's easier to read and harder to miss

@royjhan
Copy link
Contributor Author

royjhan commented Jun 19, 2024

poetry doesn't let me move the ellipsis to a new line, lmk and I can just revert and merge

@mxyng
Copy link
Collaborator

mxyng commented Jun 19, 2024

poetry doesn't let me move the ellipsis to a new line, lmk and I can just revert and merge

ok let's go with the previous, inline style :(

@royjhan royjhan merged commit ce56f27 into main Jun 19, 2024
5 checks passed
@royjhan royjhan deleted the roy-typing branch June 19, 2024 23:10
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.

None yet

3 participants