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

[Feature]: Add full type annotations for the library #825

Open
ishaan-jaff opened this issue Nov 15, 2023 · 7 comments · May be fixed by #3284
Open

[Feature]: Add full type annotations for the library #825

ishaan-jaff opened this issue Nov 15, 2023 · 7 comments · May be fixed by #3284
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@ishaan-jaff
Copy link
Contributor

ishaan-jaff commented Nov 15, 2023

The Feature

Screenshot 2023-11-15 at 12 44 30 PM

you have some basic typing but I mean actually having models or even TypedDicts for all the parameters.
Here is the current completion signature attached, where "messages" and "functions" are just typed as "List".
My type checker shows an issue because it's unknown what's in the list

Motivation, pitch

user request

Twitter / LinkedIn details

No response

@ishaan-jaff ishaan-jaff added the enhancement New feature or request label Nov 15, 2023
@ishaan-jaff
Copy link
Contributor Author

ishaan-jaff commented Nov 15, 2023

ideally those properties are in the code as models.

So you would have something like:
messages: list[MessageModel],
functions: list[FunctionModel]

And the MessageModel could look like:

class MessageModel(TypedDict):
role: str
content: str | None
name: string | None
function_call: FunctionCall | None

@JamesHutchison
Copy link

Is this completed? Is it just missing the py.typed marker?

@ishaan-jaff
Copy link
Contributor Author

Nope - open to contributions on this @JamesHutchison

@krrishdholakia krrishdholakia added good first issue Good for newcomers help wanted Extra attention is needed labels Mar 19, 2024
@krrishdholakia
Copy link
Contributor

this contribution would be very appreciated @JamesHutchison

@edwinjosegeorge
Copy link
Contributor

@ishaan-jaff could you have a look at the PR. Did you meant annotating with the TypedDict? I referenced the OpenAI spec to replicate the type check.

@edwinjosegeorge
Copy link
Contributor

I find couple of existing issues that have similar objective, Improving code quality by adding type annotations.

I am interested to work on it. See #3291

@krrishdholakia
Copy link
Contributor

please help here - this would be very useful @edwinjosegeorge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants