-
Notifications
You must be signed in to change notification settings - Fork 5
OpenAPI revisions for compatibility with Fern SDK generator #422
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
base: master
Are you sure you want to change the base?
Conversation
…to generated named Enums" This reverts commit 9d99420.
We use plural models everywhere else
We have a different name vs api_value for SerpSearchLocation
|
do we really need this huge refactor of all enums? |
|
in any case if this can be broken up between the auth header and the enum that would be greatly appreciated |
I used Where it was something else, I have used |
Do we need the enum for fern to generate the |
|
By default, Fern will generate types like CompareLLMSelectedModelsItem = typing.Union[typing.Literal[...], typing.Any]Giving an Enum type lets us customize this name because fastapi will generate an OpenAPI component with the name inferred from the Enum's name. By default, Literals will create a new OpenAPI Enum type for each input, and each will have its own different name. |
|
Separated into this and #465 |
I have tested all the affected recipes in this PR - the UX names, API names, and their use in The nice thing with the refactor is that it doesn't affect how the value is stored in state, or passed down to the |
Change Summary
authnewAPIAuthclass that inherits fromfastapi.security.base.SecurityBase(refactored into this fromapi_auth_headerto output OpenAPI with bearer scheme)renameauth_keywordtoauth_schemeget_openapi_extraclassmethod toBasePagesdk_method_nameclass attribute toBasePagex-fern-ignoreAPI endpoints that shouldn't be present in SDKText2ImgModelstoTextToImageModelsfor parity with SDK namesImg2ImgModelstoImageToImageModelsfor parity with SDK namesLipsyncModeltoLipsyncModels(plural) for consistency with rest of model classesGooeyEnumapi_enumclass property forGooeyEnumthat creates a dynamic enum mapping fromapi_value->api_value(default,name->name)api_choicesin favor ofapi_enumGooeyEnumforAnimationModelsAsrModelsTextToImageModelsImageToImageModelsSegmentationModelsUpscalerModelsControlNetModelsAsrOutputFormatCitationStylesSchedulersTextToSpeechProvidersTextToAudioModelsCombineDocumentChainTypeSerpSearchTypeSerpSearchLocationsQ/A checklist
You can visualize this using tuna:
To measure import time for a specific library:
To reduce import times, import libraries that take a long time inside the functions that use them instead of at the top of the file:
Legal Boilerplate
Look, I get it. The entity doing business as “Gooey.AI” and/or “Dara.network” was incorporated in the State of Delaware in 2020 as Dara Network Inc. and is gonna need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Dara Network Inc can use, modify, copy, and redistribute my contributions, under its choice of terms.