-
Notifications
You must be signed in to change notification settings - Fork 3.9k
export 'Usage' class as apart of openai.types #1135
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
Comments
1 task
aacebo
added a commit
to microsoft/teams-ai
that referenced
this issue
Feb 8, 2024
## Linked issues closes: #1070 ## Details Implemented the logic and tests for embeddings for Python, based on JS. 1. Client API calls and types are using the [OpenAI Python API library](https://github.com/openai/openai-python/tree/main) 2. I restructured the interfaces and classes for AzureOpenAI and OpenAI into its own classes. Two reasons- (a) some logic is different, and (b) this allows for better maintainability + response to bugs since they depend on different clients and configurations from the API library. 3. To replicate `setTimeout` in retries, I've used `asyncio.sleep` but open to better preferences/suggestions if any 4. Logging follows C# implementation (no colorization) 5. Had to disable 2 _pylint_ and _mypy_ type/argument checker (`unused-argument` because mock.patch requires the same method signature, and `arg-type` because openai.types doesn't yet export the Usage class- [filed a request here](openai/openai-python#1135)) ## Attestation Checklist - [x] My code follows the style guidelines of this project - I have checked for/fixed spelling, linting, and other errors - I have commented my code for clarity - I have made corresponding changes to the documentation (updating the doc strings in the code is sufficient) - My changes generate no new warnings - I have added tests that validates my changes, and provides sufficient test coverage. I have tested with: - Local testing - E2E testing in Teams - New and existing unit tests pass locally with my changes --------- Co-authored-by: Alex Acebo <[email protected]>
cc @RobertCraigie can you share how to access this? |
Hi @lilyydu, there are two ways you can access the from openai.types.create_embedding_response import Usage or from openai.types import create_embedding_response
create_embedding_response.Usage |
stainless-app bot
pushed a commit
that referenced
this issue
Mar 27, 2025
This enables audio inputs and outputs. https://platform.openai.com/docs/guides/audio
stainless-app bot
added a commit
that referenced
this issue
Mar 27, 2025
This enables audio inputs and outputs. https://platform.openai.com/docs/guides/audio
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Confirm this is a feature request for the Python library and not the underlying OpenAI API.
Describe the feature or improvement you're requesting
Hi there,
I'm using the library and writing tests to mock
CreateEmbeddingResponse
. To mock the class, I'm configuring the properties, including theusage
parameter. I'd like to instantiate a 'Usage
' object for this. Hence, requesting it to be exported withopenai.types.
Thanks!Additional context
No response
The text was updated successfully, but these errors were encountered: