From cfbdd492612ba7791a54075f0ba30526257967dc Mon Sep 17 00:00:00 2001
From: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
Date: Fri, 2 Aug 2024 14:05:28 +0000
Subject: [PATCH] Release 0.0.1b01
---
README.md | 133 --------------
pyproject.toml | 4 +-
reference.md | 8 +-
src/gooey/__init__.py | 42 +++--
src/gooey/ai_art_qr_code/client.py | 18 +-
.../compare_ai_image_generators/client.py | 18 +-
src/gooey/core/__init__.py | 3 +
src/gooey/core/client_wrapper.py | 4 +-
src/gooey/core/serialization.py | 167 ++++++++++++++++++
src/gooey/types/__init__.py | 42 +++--
src/gooey/types/agg_function.py | 4 +-
.../{function.py => agg_function_function.py} | 2 +-
src/gooey/types/agg_function_result.py | 4 +-
.../types/agg_function_result_function.py | 25 +++
src/gooey/types/called_function_response.py | 4 +-
.../types/called_function_response_trigger.py | 5 +
.../types/compare_text2img_page_request.py | 4 +-
...ompare_text2img_page_request_scheduler.py} | 2 +-
src/gooey/types/console_logs.py | 4 +-
.../{detail.py => console_logs_level.py} | 2 +-
src/gooey/types/conversation_entry.py | 8 +-
...ntent.py => conversation_entry_content.py} | 2 +-
.../types/conversation_entry_content_item.py | 4 +-
src/gooey/types/conversation_entry_role.py | 5 +
src/gooey/types/image_url.py | 4 +-
src/gooey/types/image_url_detail.py | 5 +
src/gooey/types/level.py | 5 -
src/gooey/types/preprocess.py | 5 -
src/gooey/types/prompt_tree_node.py | 4 +-
.../{prompt.py => prompt_tree_node_prompt.py} | 2 +-
.../types/qr_code_generator_page_request.py | 4 +-
...r_code_generator_page_request_scheduler.py | 23 +++
src/gooey/types/recipe_function.py | 4 +-
.../{role.py => recipe_function_trigger.py} | 2 +-
src/gooey/types/sad_talker_settings.py | 4 +-
.../types/sad_talker_settings_preprocess.py | 5 +
src/gooey/types/trigger.py | 5 -
src/gooey/version.py | 2 +-
tests/utils/__init__.py | 2 +
tests/utils/assets/models/__init__.py | 21 +++
tests/utils/assets/models/circle.py | 10 ++
tests/utils/assets/models/color.py | 7 +
.../assets/models/object_with_defaults.py | 15 ++
.../models/object_with_optional_field.py | 35 ++++
tests/utils/assets/models/shape.py | 27 +++
tests/utils/assets/models/square.py | 10 ++
.../assets/models/undiscriminated_shape.py | 10 ++
tests/utils/test_query_encoding.py | 5 +
tests/utils/test_serialization.py | 66 +++++++
49 files changed, 553 insertions(+), 243 deletions(-)
create mode 100644 src/gooey/core/serialization.py
rename src/gooey/types/{function.py => agg_function_function.py} (91%)
create mode 100644 src/gooey/types/agg_function_result_function.py
create mode 100644 src/gooey/types/called_function_response_trigger.py
rename src/gooey/types/{scheduler.py => compare_text2img_page_request_scheduler.py} (89%)
rename src/gooey/types/{detail.py => console_logs_level.py} (51%)
rename src/gooey/types/{content.py => conversation_entry_content.py} (63%)
create mode 100644 src/gooey/types/conversation_entry_role.py
create mode 100644 src/gooey/types/image_url_detail.py
delete mode 100644 src/gooey/types/level.py
delete mode 100644 src/gooey/types/preprocess.py
rename src/gooey/types/{prompt.py => prompt_tree_node_prompt.py} (64%)
create mode 100644 src/gooey/types/qr_code_generator_page_request_scheduler.py
rename src/gooey/types/{role.py => recipe_function_trigger.py} (50%)
create mode 100644 src/gooey/types/sad_talker_settings_preprocess.py
delete mode 100644 src/gooey/types/trigger.py
create mode 100644 tests/utils/__init__.py
create mode 100644 tests/utils/assets/models/__init__.py
create mode 100644 tests/utils/assets/models/circle.py
create mode 100644 tests/utils/assets/models/color.py
create mode 100644 tests/utils/assets/models/object_with_defaults.py
create mode 100644 tests/utils/assets/models/object_with_optional_field.py
create mode 100644 tests/utils/assets/models/shape.py
create mode 100644 tests/utils/assets/models/square.py
create mode 100644 tests/utils/assets/models/undiscriminated_shape.py
create mode 100644 tests/utils/test_serialization.py
diff --git a/README.md b/README.md
index 31889dc..e69de29 100644
--- a/README.md
+++ b/README.md
@@ -1,133 +0,0 @@
-# Gooey Python Library
-
-[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)
-[![pypi](https://img.shields.io/pypi/v/gooey)](https://pypi.python.org/pypi/gooey)
-
-The Gooey Python library provides convenient access to the Gooey API from Python.
-
-## Installation
-
-```sh
-pip install gooey
-```
-
-## Usage
-
-Instantiate and use the client with the following:
-
-```python
-from gooey import Gooey
-
-client = Gooey(
- authorization="YOUR_AUTHORIZATION",
- api_key="YOUR_API_KEY",
-)
-client.copilot_integrations.video_bots_stream_create(
- integration_id="integration_id",
-)
-```
-
-## Async Client
-
-The SDK also exports an `async` client so that you can make non-blocking calls to our API.
-
-```python
-import asyncio
-
-from gooey import AsyncGooey
-
-client = AsyncGooey(
- authorization="YOUR_AUTHORIZATION",
- api_key="YOUR_API_KEY",
-)
-
-
-async def main() -> None:
- await client.copilot_integrations.video_bots_stream_create(
- integration_id="integration_id",
- )
-
-
-asyncio.run(main())
-```
-
-## Exception Handling
-
-When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
-will be thrown.
-
-```python
-from .api_error import ApiError
-
-try:
- client.copilot_integrations.video_bots_stream_create(...)
-except ApiError as e:
- print(e.status_code)
- print(e.body)
-```
-
-## Advanced
-
-### Retries
-
-The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
-as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
-retry limit (default: 2).
-
-A request is deemed retriable when any of the following HTTP status codes is returned:
-
-- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
-- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
-- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
-
-Use the `max_retries` request option to configure this behavior.
-
-```python
-client.copilot_integrations.video_bots_stream_create(...,{
- max_retries=1
-})
-```
-
-### Timeouts
-
-The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
-
-```python
-
-from gooey import Gooey
-
-client = Gooey(..., { timeout=20.0 }, )
-
-
-# Override timeout for a specific method
-client.copilot_integrations.video_bots_stream_create(...,{
- timeout_in_seconds=1
-})
-```
-
-### Custom Client
-
-You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
-and transports.
-```python
-import httpx
-from gooey import Gooey
-
-client = Gooey(
- ...,
- http_client=httpx.Client(
- proxies="http://my.test.proxy.example.com",
- transport=httpx.HTTPTransport(local_address="0.0.0.0"),
- ),
-)
-```
-
-## Contributing
-
-While we value open-source contributions to this SDK, this library is generated programmatically.
-Additions made directly to this library would have to be moved over to our generation code,
-otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
-a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
-an issue first to discuss with us!
-
-On the other hand, contributions to the README are always very welcome!
diff --git a/pyproject.toml b/pyproject.toml
index 5da79be..4fb619e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
-name = "gooey"
-version = "0.0.1b0"
+name = "gooeyai"
+version = "0.0.1b01"
description = ""
readme = "README.md"
authors = []
diff --git a/reference.md b/reference.md
index babb7ed..c1df924 100644
--- a/reference.md
+++ b/reference.md
@@ -2403,7 +2403,7 @@ client.ai_art_qr_code.art_qr_code(
-
-**scheduler:** `typing.Optional[Scheduler]`
+**scheduler:** `typing.Optional[QrCodeGeneratorPageRequestScheduler]`
@@ -2688,7 +2688,7 @@ client.ai_art_qr_code.async_art_qr_code(
-
-**scheduler:** `typing.Optional[Scheduler]`
+**scheduler:** `typing.Optional[QrCodeGeneratorPageRequestScheduler]`
@@ -10561,7 +10561,7 @@ client.compare_ai_image_generators.compare_text2img(
-
-**scheduler:** `typing.Optional[Scheduler]`
+**scheduler:** `typing.Optional[CompareText2ImgPageRequestScheduler]`
@@ -10754,7 +10754,7 @@ client.compare_ai_image_generators.async_compare_text2img(
-
-**scheduler:** `typing.Optional[Scheduler]`
+**scheduler:** `typing.Optional[CompareText2ImgPageRequestScheduler]`
diff --git a/src/gooey/__init__.py b/src/gooey/__init__.py
index 401a38a..cf4a056 100644
--- a/src/gooey/__init__.py
+++ b/src/gooey/__init__.py
@@ -2,7 +2,9 @@
from .types import (
AggFunction,
+ AggFunctionFunction,
AggFunctionResult,
+ AggFunctionResultFunction,
AnimationPrompt,
AsrChunk,
AsrOutputJson,
@@ -28,6 +30,7 @@
BulkRunnerPageStatusResponse,
ButtonPressed,
CalledFunctionResponse,
+ CalledFunctionResponseTrigger,
ChatCompletionContentPartImageParam,
ChatCompletionContentPartTextParam,
ChyronPlantPageOutput,
@@ -42,6 +45,7 @@
CompareLlmPageStatusResponse,
CompareText2ImgPageOutput,
CompareText2ImgPageRequest,
+ CompareText2ImgPageRequestScheduler,
CompareText2ImgPageRequestSelectedModelsItem,
CompareText2ImgPageResponse,
CompareText2ImgPageStatusResponse,
@@ -51,11 +55,13 @@
CompareUpscalerPageResponse,
CompareUpscalerPageStatusResponse,
ConsoleLogs,
- Content,
+ ConsoleLogsLevel,
ConversationEntry,
+ ConversationEntryContent,
ConversationEntryContentItem,
ConversationEntryContentItem_ImageUrl,
ConversationEntryContentItem_Text,
+ ConversationEntryRole,
ConversationStart,
CreateStreamResponse,
DeforumSdPageOutput,
@@ -63,7 +69,6 @@
DeforumSdPageRequestSelectedModel,
DeforumSdPageResponse,
DeforumSdPageStatusResponse,
- Detail,
DocExtractPageOutput,
DocExtractPageRequest,
DocExtractPageRequestSelectedAsrModel,
@@ -103,7 +108,6 @@
FailedReponseModelV2,
FailedResponseDetail,
FinalResponse,
- Function,
FunctionsPageOutput,
FunctionsPageRequest,
FunctionsPageResponse,
@@ -128,6 +132,7 @@
ImageSegmentationPageResponse,
ImageSegmentationPageStatusResponse,
ImageUrl,
+ ImageUrlDetail,
Img2ImgPageOutput,
Img2ImgPageRequest,
Img2ImgPageRequestSelectedControlnetModel,
@@ -139,7 +144,6 @@
LetterWriterPageRequest,
LetterWriterPageResponse,
LetterWriterPageStatusResponse,
- Level,
LipsyncPageOutput,
LipsyncPageRequest,
LipsyncPageRequestSelectedModel,
@@ -160,17 +164,18 @@
ObjectInpaintingPageRequestSelectedModel,
ObjectInpaintingPageResponse,
ObjectInpaintingPageStatusResponse,
- Preprocess,
- Prompt,
PromptTreeNode,
+ PromptTreeNodePrompt,
QrCodeGeneratorPageOutput,
QrCodeGeneratorPageRequest,
QrCodeGeneratorPageRequestImagePromptControlnetModelsItem,
+ QrCodeGeneratorPageRequestScheduler,
QrCodeGeneratorPageRequestSelectedControlnetModelItem,
QrCodeGeneratorPageRequestSelectedModel,
QrCodeGeneratorPageResponse,
QrCodeGeneratorPageStatusResponse,
RecipeFunction,
+ RecipeFunctionTrigger,
RecipeRunState,
RelatedDocSearchResponse,
RelatedGoogleGptResponse,
@@ -192,12 +197,11 @@
ResponseModel,
ResponseModelFinalKeywordQuery,
ResponseModelFinalPrompt,
- Role,
RunSettings,
RunSettingsRetentionPolicy,
RunStart,
SadTalkerSettings,
- Scheduler,
+ SadTalkerSettingsPreprocess,
SearchReference,
SeoSummaryPageOutput,
SeoSummaryPageRequest,
@@ -234,7 +238,6 @@
TranslationPageRequestSelectedModel,
TranslationPageResponse,
TranslationPageStatusResponse,
- Trigger,
ValidationError,
ValidationErrorLocItem,
Vcard,
@@ -310,7 +313,9 @@
__all__ = [
"AggFunction",
+ "AggFunctionFunction",
"AggFunctionResult",
+ "AggFunctionResultFunction",
"AnimationPrompt",
"AsrChunk",
"AsrOutputJson",
@@ -337,6 +342,7 @@
"BulkRunnerPageStatusResponse",
"ButtonPressed",
"CalledFunctionResponse",
+ "CalledFunctionResponseTrigger",
"ChatCompletionContentPartImageParam",
"ChatCompletionContentPartTextParam",
"ChyronPlantPageOutput",
@@ -351,6 +357,7 @@
"CompareLlmPageStatusResponse",
"CompareText2ImgPageOutput",
"CompareText2ImgPageRequest",
+ "CompareText2ImgPageRequestScheduler",
"CompareText2ImgPageRequestSelectedModelsItem",
"CompareText2ImgPageResponse",
"CompareText2ImgPageStatusResponse",
@@ -360,11 +367,13 @@
"CompareUpscalerPageResponse",
"CompareUpscalerPageStatusResponse",
"ConsoleLogs",
- "Content",
+ "ConsoleLogsLevel",
"ConversationEntry",
+ "ConversationEntryContent",
"ConversationEntryContentItem",
"ConversationEntryContentItem_ImageUrl",
"ConversationEntryContentItem_Text",
+ "ConversationEntryRole",
"ConversationStart",
"CreateStreamRequestAsrModel",
"CreateStreamRequestCitationStyle",
@@ -381,7 +390,6 @@
"DeforumSdPageRequestSelectedModel",
"DeforumSdPageResponse",
"DeforumSdPageStatusResponse",
- "Detail",
"DocExtractPageOutput",
"DocExtractPageRequest",
"DocExtractPageRequestSelectedAsrModel",
@@ -421,7 +429,6 @@
"FailedReponseModelV2",
"FailedResponseDetail",
"FinalResponse",
- "Function",
"FunctionsPageOutput",
"FunctionsPageRequest",
"FunctionsPageResponse",
@@ -448,6 +455,7 @@
"ImageSegmentationPageResponse",
"ImageSegmentationPageStatusResponse",
"ImageUrl",
+ "ImageUrlDetail",
"Img2ImgPageOutput",
"Img2ImgPageRequest",
"Img2ImgPageRequestSelectedControlnetModel",
@@ -460,7 +468,6 @@
"LetterWriterPageRequest",
"LetterWriterPageResponse",
"LetterWriterPageStatusResponse",
- "Level",
"LipsyncPageOutput",
"LipsyncPageRequest",
"LipsyncPageRequestSelectedModel",
@@ -482,17 +489,18 @@
"ObjectInpaintingPageResponse",
"ObjectInpaintingPageStatusResponse",
"PaymentRequiredError",
- "Preprocess",
- "Prompt",
"PromptTreeNode",
+ "PromptTreeNodePrompt",
"QrCodeGeneratorPageOutput",
"QrCodeGeneratorPageRequest",
"QrCodeGeneratorPageRequestImagePromptControlnetModelsItem",
+ "QrCodeGeneratorPageRequestScheduler",
"QrCodeGeneratorPageRequestSelectedControlnetModelItem",
"QrCodeGeneratorPageRequestSelectedModel",
"QrCodeGeneratorPageResponse",
"QrCodeGeneratorPageStatusResponse",
"RecipeFunction",
+ "RecipeFunctionTrigger",
"RecipeRunState",
"RelatedDocSearchResponse",
"RelatedGoogleGptResponse",
@@ -514,12 +522,11 @@
"ResponseModel",
"ResponseModelFinalKeywordQuery",
"ResponseModelFinalPrompt",
- "Role",
"RunSettings",
"RunSettingsRetentionPolicy",
"RunStart",
"SadTalkerSettings",
- "Scheduler",
+ "SadTalkerSettingsPreprocess",
"SearchReference",
"SeoSummaryPageOutput",
"SeoSummaryPageRequest",
@@ -557,7 +564,6 @@
"TranslationPageRequestSelectedModel",
"TranslationPageResponse",
"TranslationPageStatusResponse",
- "Trigger",
"UnprocessableEntityError",
"ValidationError",
"ValidationErrorLocItem",
diff --git a/src/gooey/ai_art_qr_code/client.py b/src/gooey/ai_art_qr_code/client.py
index 7b55cb2..52dfbba 100644
--- a/src/gooey/ai_art_qr_code/client.py
+++ b/src/gooey/ai_art_qr_code/client.py
@@ -18,6 +18,7 @@
from ..types.qr_code_generator_page_request_image_prompt_controlnet_models_item import (
QrCodeGeneratorPageRequestImagePromptControlnetModelsItem,
)
+from ..types.qr_code_generator_page_request_scheduler import QrCodeGeneratorPageRequestScheduler
from ..types.qr_code_generator_page_request_selected_controlnet_model_item import (
QrCodeGeneratorPageRequestSelectedControlnetModelItem,
)
@@ -26,7 +27,6 @@
from ..types.qr_code_generator_page_status_response import QrCodeGeneratorPageStatusResponse
from ..types.recipe_function import RecipeFunction
from ..types.run_settings import RunSettings
-from ..types.scheduler import Scheduler
from ..types.vcard import Vcard
# this is used as the default value for optional parameters
@@ -67,7 +67,7 @@ def art_qr_code(
controlnet_conditioning_scale: typing.Optional[typing.Sequence[float]] = OMIT,
num_outputs: typing.Optional[int] = OMIT,
quality: typing.Optional[int] = OMIT,
- scheduler: typing.Optional[Scheduler] = OMIT,
+ scheduler: typing.Optional[QrCodeGeneratorPageRequestScheduler] = OMIT,
seed: typing.Optional[int] = OMIT,
obj_scale: typing.Optional[float] = OMIT,
obj_pos_x: typing.Optional[float] = OMIT,
@@ -125,7 +125,7 @@ def art_qr_code(
quality : typing.Optional[int]
- scheduler : typing.Optional[Scheduler]
+ scheduler : typing.Optional[QrCodeGeneratorPageRequestScheduler]
seed : typing.Optional[int]
@@ -248,7 +248,7 @@ def async_art_qr_code(
controlnet_conditioning_scale: typing.Optional[typing.Sequence[float]] = OMIT,
num_outputs: typing.Optional[int] = OMIT,
quality: typing.Optional[int] = OMIT,
- scheduler: typing.Optional[Scheduler] = OMIT,
+ scheduler: typing.Optional[QrCodeGeneratorPageRequestScheduler] = OMIT,
seed: typing.Optional[int] = OMIT,
obj_scale: typing.Optional[float] = OMIT,
obj_pos_x: typing.Optional[float] = OMIT,
@@ -306,7 +306,7 @@ def async_art_qr_code(
quality : typing.Optional[int]
- scheduler : typing.Optional[Scheduler]
+ scheduler : typing.Optional[QrCodeGeneratorPageRequestScheduler]
seed : typing.Optional[int]
@@ -481,7 +481,7 @@ async def art_qr_code(
controlnet_conditioning_scale: typing.Optional[typing.Sequence[float]] = OMIT,
num_outputs: typing.Optional[int] = OMIT,
quality: typing.Optional[int] = OMIT,
- scheduler: typing.Optional[Scheduler] = OMIT,
+ scheduler: typing.Optional[QrCodeGeneratorPageRequestScheduler] = OMIT,
seed: typing.Optional[int] = OMIT,
obj_scale: typing.Optional[float] = OMIT,
obj_pos_x: typing.Optional[float] = OMIT,
@@ -539,7 +539,7 @@ async def art_qr_code(
quality : typing.Optional[int]
- scheduler : typing.Optional[Scheduler]
+ scheduler : typing.Optional[QrCodeGeneratorPageRequestScheduler]
seed : typing.Optional[int]
@@ -670,7 +670,7 @@ async def async_art_qr_code(
controlnet_conditioning_scale: typing.Optional[typing.Sequence[float]] = OMIT,
num_outputs: typing.Optional[int] = OMIT,
quality: typing.Optional[int] = OMIT,
- scheduler: typing.Optional[Scheduler] = OMIT,
+ scheduler: typing.Optional[QrCodeGeneratorPageRequestScheduler] = OMIT,
seed: typing.Optional[int] = OMIT,
obj_scale: typing.Optional[float] = OMIT,
obj_pos_x: typing.Optional[float] = OMIT,
@@ -728,7 +728,7 @@ async def async_art_qr_code(
quality : typing.Optional[int]
- scheduler : typing.Optional[Scheduler]
+ scheduler : typing.Optional[QrCodeGeneratorPageRequestScheduler]
seed : typing.Optional[int]
diff --git a/src/gooey/compare_ai_image_generators/client.py b/src/gooey/compare_ai_image_generators/client.py
index e8286fc..29efb05 100644
--- a/src/gooey/compare_ai_image_generators/client.py
+++ b/src/gooey/compare_ai_image_generators/client.py
@@ -12,6 +12,7 @@
from ..errors.too_many_requests_error import TooManyRequestsError
from ..errors.unprocessable_entity_error import UnprocessableEntityError
from ..types.async_api_response_model_v3 import AsyncApiResponseModelV3
+from ..types.compare_text2img_page_request_scheduler import CompareText2ImgPageRequestScheduler
from ..types.compare_text2img_page_request_selected_models_item import CompareText2ImgPageRequestSelectedModelsItem
from ..types.compare_text2img_page_response import CompareText2ImgPageResponse
from ..types.compare_text2img_page_status_response import CompareText2ImgPageStatusResponse
@@ -20,7 +21,6 @@
from ..types.http_validation_error import HttpValidationError
from ..types.recipe_function import RecipeFunction
from ..types.run_settings import RunSettings
-from ..types.scheduler import Scheduler
# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
@@ -47,7 +47,7 @@ def compare_text2img(
seed: typing.Optional[int] = OMIT,
sd2upscaling: typing.Optional[bool] = OMIT,
selected_models: typing.Optional[typing.Sequence[CompareText2ImgPageRequestSelectedModelsItem]] = OMIT,
- scheduler: typing.Optional[Scheduler] = OMIT,
+ scheduler: typing.Optional[CompareText2ImgPageRequestScheduler] = OMIT,
edit_instruction: typing.Optional[str] = OMIT,
image_guidance_scale: typing.Optional[float] = OMIT,
settings: typing.Optional[RunSettings] = OMIT,
@@ -85,7 +85,7 @@ def compare_text2img(
selected_models : typing.Optional[typing.Sequence[CompareText2ImgPageRequestSelectedModelsItem]]
- scheduler : typing.Optional[Scheduler]
+ scheduler : typing.Optional[CompareText2ImgPageRequestScheduler]
edit_instruction : typing.Optional[str]
@@ -180,7 +180,7 @@ def async_compare_text2img(
seed: typing.Optional[int] = OMIT,
sd2upscaling: typing.Optional[bool] = OMIT,
selected_models: typing.Optional[typing.Sequence[CompareText2ImgPageRequestSelectedModelsItem]] = OMIT,
- scheduler: typing.Optional[Scheduler] = OMIT,
+ scheduler: typing.Optional[CompareText2ImgPageRequestScheduler] = OMIT,
edit_instruction: typing.Optional[str] = OMIT,
image_guidance_scale: typing.Optional[float] = OMIT,
settings: typing.Optional[RunSettings] = OMIT,
@@ -218,7 +218,7 @@ def async_compare_text2img(
selected_models : typing.Optional[typing.Sequence[CompareText2ImgPageRequestSelectedModelsItem]]
- scheduler : typing.Optional[Scheduler]
+ scheduler : typing.Optional[CompareText2ImgPageRequestScheduler]
edit_instruction : typing.Optional[str]
@@ -365,7 +365,7 @@ async def compare_text2img(
seed: typing.Optional[int] = OMIT,
sd2upscaling: typing.Optional[bool] = OMIT,
selected_models: typing.Optional[typing.Sequence[CompareText2ImgPageRequestSelectedModelsItem]] = OMIT,
- scheduler: typing.Optional[Scheduler] = OMIT,
+ scheduler: typing.Optional[CompareText2ImgPageRequestScheduler] = OMIT,
edit_instruction: typing.Optional[str] = OMIT,
image_guidance_scale: typing.Optional[float] = OMIT,
settings: typing.Optional[RunSettings] = OMIT,
@@ -403,7 +403,7 @@ async def compare_text2img(
selected_models : typing.Optional[typing.Sequence[CompareText2ImgPageRequestSelectedModelsItem]]
- scheduler : typing.Optional[Scheduler]
+ scheduler : typing.Optional[CompareText2ImgPageRequestScheduler]
edit_instruction : typing.Optional[str]
@@ -506,7 +506,7 @@ async def async_compare_text2img(
seed: typing.Optional[int] = OMIT,
sd2upscaling: typing.Optional[bool] = OMIT,
selected_models: typing.Optional[typing.Sequence[CompareText2ImgPageRequestSelectedModelsItem]] = OMIT,
- scheduler: typing.Optional[Scheduler] = OMIT,
+ scheduler: typing.Optional[CompareText2ImgPageRequestScheduler] = OMIT,
edit_instruction: typing.Optional[str] = OMIT,
image_guidance_scale: typing.Optional[float] = OMIT,
settings: typing.Optional[RunSettings] = OMIT,
@@ -544,7 +544,7 @@ async def async_compare_text2img(
selected_models : typing.Optional[typing.Sequence[CompareText2ImgPageRequestSelectedModelsItem]]
- scheduler : typing.Optional[Scheduler]
+ scheduler : typing.Optional[CompareText2ImgPageRequestScheduler]
edit_instruction : typing.Optional[str]
diff --git a/src/gooey/core/__init__.py b/src/gooey/core/__init__.py
index 1f453ef..5a0bee3 100644
--- a/src/gooey/core/__init__.py
+++ b/src/gooey/core/__init__.py
@@ -19,12 +19,14 @@
from .query_encoder import encode_query
from .remove_none_from_dict import remove_none_from_dict
from .request_options import RequestOptions
+from .serialization import FieldMetadata, convert_and_respect_annotation_metadata
__all__ = [
"ApiError",
"AsyncClientWrapper",
"AsyncHttpClient",
"BaseClientWrapper",
+ "FieldMetadata",
"File",
"HttpClient",
"IS_PYDANTIC_V2",
@@ -32,6 +34,7 @@
"SyncClientWrapper",
"UniversalBaseModel",
"UniversalRootModel",
+ "convert_and_respect_annotation_metadata",
"convert_file_dict_to_httpx_tuples",
"deep_union_pydantic_dicts",
"encode_query",
diff --git a/src/gooey/core/client_wrapper.py b/src/gooey/core/client_wrapper.py
index 29143d8..0565a35 100644
--- a/src/gooey/core/client_wrapper.py
+++ b/src/gooey/core/client_wrapper.py
@@ -24,8 +24,8 @@ def __init__(
def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
- "X-Fern-SDK-Name": "gooey",
- "X-Fern-SDK-Version": "0.0.1b0",
+ "X-Fern-SDK-Name": "gooeyai",
+ "X-Fern-SDK-Version": "0.0.1b01",
}
if self._authorization is not None:
headers["Authorization"] = self._authorization
diff --git a/src/gooey/core/serialization.py b/src/gooey/core/serialization.py
new file mode 100644
index 0000000..8ad5cf8
--- /dev/null
+++ b/src/gooey/core/serialization.py
@@ -0,0 +1,167 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import collections
+import typing
+
+import typing_extensions
+
+
+class FieldMetadata:
+ """
+ Metadata class used to annotate fields to provide additional information.
+
+ Example:
+ class MyDict(TypedDict):
+ field: typing.Annotated[str, FieldMetadata(alias="field_name")]
+
+ Will serialize: `{"field": "value"}`
+ To: `{"field_name": "value"}`
+ """
+
+ alias: str
+
+ def __init__(self, *, alias: str) -> None:
+ self.alias = alias
+
+
+def convert_and_respect_annotation_metadata(
+ *, object_: typing.Any, annotation: typing.Any, inner_type: typing.Optional[typing.Any] = None
+) -> typing.Any:
+ """
+ Respect the metadata annotations on a field, such as aliasing. This function effectively
+ manipulates the dict-form of an object to respect the metadata annotations. This is primarily used for
+ TypedDicts, which cannot support aliasing out of the box, and can be extended for additional
+ utilities, such as defaults.
+
+ Parameters
+ ----------
+ object_ : typing.Any
+
+ annotation : type
+ The type we're looking to apply typing annotations from
+
+ inner_type : typing.Optional[type]
+
+ Returns
+ -------
+ typing.Any
+ """
+
+ if object_ is None:
+ return None
+ if inner_type is None:
+ inner_type = annotation
+
+ clean_type = _remove_annotations(inner_type)
+ if typing_extensions.is_typeddict(clean_type) and isinstance(object_, typing.Mapping):
+ return _convert_typeddict(object_, clean_type)
+
+ if (
+ # If you're iterating on a string, do not bother to coerce it to a sequence.
+ (not isinstance(object_, str))
+ and (
+ (
+ (
+ typing_extensions.get_origin(clean_type) == typing.List
+ or typing_extensions.get_origin(clean_type) == list
+ or clean_type == typing.List
+ )
+ and isinstance(object_, typing.List)
+ )
+ or (
+ (
+ typing_extensions.get_origin(clean_type) == typing.Set
+ or typing_extensions.get_origin(clean_type) == set
+ or clean_type == typing.Set
+ )
+ and isinstance(object_, typing.Set)
+ )
+ or (
+ (
+ typing_extensions.get_origin(clean_type) == typing.Sequence
+ or typing_extensions.get_origin(clean_type) == collections.abc.Sequence
+ or clean_type == typing.Sequence
+ )
+ and isinstance(object_, typing.Sequence)
+ )
+ )
+ ):
+ inner_type = typing_extensions.get_args(clean_type)[0]
+ return [
+ convert_and_respect_annotation_metadata(object_=item, annotation=annotation, inner_type=inner_type)
+ for item in object_
+ ]
+
+ if typing_extensions.get_origin(clean_type) == typing.Union:
+ # We should be able to ~relatively~ safely try to convert keys against all
+ # member types in the union, the edge case here is if one member aliases a field
+ # of the same name to a different name from another member
+ # Or if another member aliases a field of the same name that another member does not.
+ for member in typing_extensions.get_args(clean_type):
+ object_ = convert_and_respect_annotation_metadata(object_=object_, annotation=annotation, inner_type=member)
+ return object_
+
+ annotated_type = _get_annotation(annotation)
+ if annotated_type is None:
+ return object_
+
+ # If the object is not a TypedDict, a Union, or other container (list, set, sequence, etc.)
+ # Then we can safely call it on the recursive conversion.
+ return object_
+
+
+def _convert_typeddict(object_: typing.Mapping[str, object], expected_type: typing.Any) -> typing.Mapping[str, object]:
+ converted_object: typing.Dict[str, object] = {}
+ annotations = typing_extensions.get_type_hints(expected_type, include_extras=True)
+ for key, value in object_.items():
+ type_ = annotations.get(key)
+ if type_ is None:
+ converted_object[key] = value
+ else:
+ converted_object[_alias_key(key, type_)] = convert_and_respect_annotation_metadata(
+ object_=value, annotation=type_
+ )
+ return converted_object
+
+
+def _get_annotation(type_: typing.Any) -> typing.Optional[typing.Any]:
+ maybe_annotated_type = typing_extensions.get_origin(type_)
+ if maybe_annotated_type is None:
+ return None
+
+ if maybe_annotated_type == typing_extensions.NotRequired:
+ type_ = typing_extensions.get_args(type_)[0]
+ maybe_annotated_type = typing_extensions.get_origin(type_)
+
+ if maybe_annotated_type == typing_extensions.Annotated:
+ return type_
+
+ return None
+
+
+def _remove_annotations(type_: typing.Any) -> typing.Any:
+ maybe_annotated_type = typing_extensions.get_origin(type_)
+ if maybe_annotated_type is None:
+ return type_
+
+ if maybe_annotated_type == typing_extensions.NotRequired:
+ return _remove_annotations(typing_extensions.get_args(type_)[0])
+
+ if maybe_annotated_type == typing_extensions.Annotated:
+ return _remove_annotations(typing_extensions.get_args(type_)[0])
+
+ return type_
+
+
+def _alias_key(key: str, type_: typing.Any) -> str:
+ maybe_annotated_type = _get_annotation(type_)
+
+ if maybe_annotated_type is not None:
+ # The actual annotations are 1 onward, the first is the annotated type
+ annotations = typing_extensions.get_args(maybe_annotated_type)[1:]
+
+ for annotation in annotations:
+ if isinstance(annotation, FieldMetadata) and annotation.alias is not None:
+ return annotation.alias
+
+ return key
diff --git a/src/gooey/types/__init__.py b/src/gooey/types/__init__.py
index 2693f1e..eab2baa 100644
--- a/src/gooey/types/__init__.py
+++ b/src/gooey/types/__init__.py
@@ -1,7 +1,9 @@
# This file was auto-generated by Fern from our API Definition.
from .agg_function import AggFunction
+from .agg_function_function import AggFunctionFunction
from .agg_function_result import AggFunctionResult
+from .agg_function_result_function import AggFunctionResultFunction
from .animation_prompt import AnimationPrompt
from .asr_chunk import AsrChunk
from .asr_output_json import AsrOutputJson
@@ -27,6 +29,7 @@
from .bulk_runner_page_status_response import BulkRunnerPageStatusResponse
from .button_pressed import ButtonPressed
from .called_function_response import CalledFunctionResponse
+from .called_function_response_trigger import CalledFunctionResponseTrigger
from .chat_completion_content_part_image_param import ChatCompletionContentPartImageParam
from .chat_completion_content_part_text_param import ChatCompletionContentPartTextParam
from .chyron_plant_page_output import ChyronPlantPageOutput
@@ -41,6 +44,7 @@
from .compare_llm_page_status_response import CompareLlmPageStatusResponse
from .compare_text2img_page_output import CompareText2ImgPageOutput
from .compare_text2img_page_request import CompareText2ImgPageRequest
+from .compare_text2img_page_request_scheduler import CompareText2ImgPageRequestScheduler
from .compare_text2img_page_request_selected_models_item import CompareText2ImgPageRequestSelectedModelsItem
from .compare_text2img_page_response import CompareText2ImgPageResponse
from .compare_text2img_page_status_response import CompareText2ImgPageStatusResponse
@@ -50,13 +54,15 @@
from .compare_upscaler_page_response import CompareUpscalerPageResponse
from .compare_upscaler_page_status_response import CompareUpscalerPageStatusResponse
from .console_logs import ConsoleLogs
-from .content import Content
+from .console_logs_level import ConsoleLogsLevel
from .conversation_entry import ConversationEntry
+from .conversation_entry_content import ConversationEntryContent
from .conversation_entry_content_item import (
ConversationEntryContentItem,
ConversationEntryContentItem_ImageUrl,
ConversationEntryContentItem_Text,
)
+from .conversation_entry_role import ConversationEntryRole
from .conversation_start import ConversationStart
from .create_stream_response import CreateStreamResponse
from .deforum_sd_page_output import DeforumSdPageOutput
@@ -64,7 +70,6 @@
from .deforum_sd_page_request_selected_model import DeforumSdPageRequestSelectedModel
from .deforum_sd_page_response import DeforumSdPageResponse
from .deforum_sd_page_status_response import DeforumSdPageStatusResponse
-from .detail import Detail
from .doc_extract_page_output import DocExtractPageOutput
from .doc_extract_page_request import DocExtractPageRequest
from .doc_extract_page_request_selected_asr_model import DocExtractPageRequestSelectedAsrModel
@@ -104,7 +109,6 @@
from .failed_reponse_model_v2 import FailedReponseModelV2
from .failed_response_detail import FailedResponseDetail
from .final_response import FinalResponse
-from .function import Function
from .functions_page_output import FunctionsPageOutput
from .functions_page_request import FunctionsPageRequest
from .functions_page_response import FunctionsPageResponse
@@ -129,6 +133,7 @@
from .image_segmentation_page_response import ImageSegmentationPageResponse
from .image_segmentation_page_status_response import ImageSegmentationPageStatusResponse
from .image_url import ImageUrl
+from .image_url_detail import ImageUrlDetail
from .img2img_page_output import Img2ImgPageOutput
from .img2img_page_request import Img2ImgPageRequest
from .img2img_page_request_selected_controlnet_model import Img2ImgPageRequestSelectedControlnetModel
@@ -140,7 +145,6 @@
from .letter_writer_page_request import LetterWriterPageRequest
from .letter_writer_page_response import LetterWriterPageResponse
from .letter_writer_page_status_response import LetterWriterPageStatusResponse
-from .level import Level
from .lipsync_page_output import LipsyncPageOutput
from .lipsync_page_request import LipsyncPageRequest
from .lipsync_page_request_selected_model import LipsyncPageRequestSelectedModel
@@ -161,14 +165,14 @@
from .object_inpainting_page_request_selected_model import ObjectInpaintingPageRequestSelectedModel
from .object_inpainting_page_response import ObjectInpaintingPageResponse
from .object_inpainting_page_status_response import ObjectInpaintingPageStatusResponse
-from .preprocess import Preprocess
-from .prompt import Prompt
from .prompt_tree_node import PromptTreeNode
+from .prompt_tree_node_prompt import PromptTreeNodePrompt
from .qr_code_generator_page_output import QrCodeGeneratorPageOutput
from .qr_code_generator_page_request import QrCodeGeneratorPageRequest
from .qr_code_generator_page_request_image_prompt_controlnet_models_item import (
QrCodeGeneratorPageRequestImagePromptControlnetModelsItem,
)
+from .qr_code_generator_page_request_scheduler import QrCodeGeneratorPageRequestScheduler
from .qr_code_generator_page_request_selected_controlnet_model_item import (
QrCodeGeneratorPageRequestSelectedControlnetModelItem,
)
@@ -176,6 +180,7 @@
from .qr_code_generator_page_response import QrCodeGeneratorPageResponse
from .qr_code_generator_page_status_response import QrCodeGeneratorPageStatusResponse
from .recipe_function import RecipeFunction
+from .recipe_function_trigger import RecipeFunctionTrigger
from .recipe_run_state import RecipeRunState
from .related_doc_search_response import RelatedDocSearchResponse
from .related_google_gpt_response import RelatedGoogleGptResponse
@@ -197,12 +202,11 @@
from .response_model import ResponseModel
from .response_model_final_keyword_query import ResponseModelFinalKeywordQuery
from .response_model_final_prompt import ResponseModelFinalPrompt
-from .role import Role
from .run_settings import RunSettings
from .run_settings_retention_policy import RunSettingsRetentionPolicy
from .run_start import RunStart
from .sad_talker_settings import SadTalkerSettings
-from .scheduler import Scheduler
+from .sad_talker_settings_preprocess import SadTalkerSettingsPreprocess
from .search_reference import SearchReference
from .seo_summary_page_output import SeoSummaryPageOutput
from .seo_summary_page_request import SeoSummaryPageRequest
@@ -239,7 +243,6 @@
from .translation_page_request_selected_model import TranslationPageRequestSelectedModel
from .translation_page_response import TranslationPageResponse
from .translation_page_status_response import TranslationPageStatusResponse
-from .trigger import Trigger
from .validation_error import ValidationError
from .validation_error_loc_item import ValidationErrorLocItem
from .vcard import Vcard
@@ -261,7 +264,9 @@
__all__ = [
"AggFunction",
+ "AggFunctionFunction",
"AggFunctionResult",
+ "AggFunctionResultFunction",
"AnimationPrompt",
"AsrChunk",
"AsrOutputJson",
@@ -287,6 +292,7 @@
"BulkRunnerPageStatusResponse",
"ButtonPressed",
"CalledFunctionResponse",
+ "CalledFunctionResponseTrigger",
"ChatCompletionContentPartImageParam",
"ChatCompletionContentPartTextParam",
"ChyronPlantPageOutput",
@@ -301,6 +307,7 @@
"CompareLlmPageStatusResponse",
"CompareText2ImgPageOutput",
"CompareText2ImgPageRequest",
+ "CompareText2ImgPageRequestScheduler",
"CompareText2ImgPageRequestSelectedModelsItem",
"CompareText2ImgPageResponse",
"CompareText2ImgPageStatusResponse",
@@ -310,11 +317,13 @@
"CompareUpscalerPageResponse",
"CompareUpscalerPageStatusResponse",
"ConsoleLogs",
- "Content",
+ "ConsoleLogsLevel",
"ConversationEntry",
+ "ConversationEntryContent",
"ConversationEntryContentItem",
"ConversationEntryContentItem_ImageUrl",
"ConversationEntryContentItem_Text",
+ "ConversationEntryRole",
"ConversationStart",
"CreateStreamResponse",
"DeforumSdPageOutput",
@@ -322,7 +331,6 @@
"DeforumSdPageRequestSelectedModel",
"DeforumSdPageResponse",
"DeforumSdPageStatusResponse",
- "Detail",
"DocExtractPageOutput",
"DocExtractPageRequest",
"DocExtractPageRequestSelectedAsrModel",
@@ -362,7 +370,6 @@
"FailedReponseModelV2",
"FailedResponseDetail",
"FinalResponse",
- "Function",
"FunctionsPageOutput",
"FunctionsPageRequest",
"FunctionsPageResponse",
@@ -387,6 +394,7 @@
"ImageSegmentationPageResponse",
"ImageSegmentationPageStatusResponse",
"ImageUrl",
+ "ImageUrlDetail",
"Img2ImgPageOutput",
"Img2ImgPageRequest",
"Img2ImgPageRequestSelectedControlnetModel",
@@ -398,7 +406,6 @@
"LetterWriterPageRequest",
"LetterWriterPageResponse",
"LetterWriterPageStatusResponse",
- "Level",
"LipsyncPageOutput",
"LipsyncPageRequest",
"LipsyncPageRequestSelectedModel",
@@ -419,17 +426,18 @@
"ObjectInpaintingPageRequestSelectedModel",
"ObjectInpaintingPageResponse",
"ObjectInpaintingPageStatusResponse",
- "Preprocess",
- "Prompt",
"PromptTreeNode",
+ "PromptTreeNodePrompt",
"QrCodeGeneratorPageOutput",
"QrCodeGeneratorPageRequest",
"QrCodeGeneratorPageRequestImagePromptControlnetModelsItem",
+ "QrCodeGeneratorPageRequestScheduler",
"QrCodeGeneratorPageRequestSelectedControlnetModelItem",
"QrCodeGeneratorPageRequestSelectedModel",
"QrCodeGeneratorPageResponse",
"QrCodeGeneratorPageStatusResponse",
"RecipeFunction",
+ "RecipeFunctionTrigger",
"RecipeRunState",
"RelatedDocSearchResponse",
"RelatedGoogleGptResponse",
@@ -451,12 +459,11 @@
"ResponseModel",
"ResponseModelFinalKeywordQuery",
"ResponseModelFinalPrompt",
- "Role",
"RunSettings",
"RunSettingsRetentionPolicy",
"RunStart",
"SadTalkerSettings",
- "Scheduler",
+ "SadTalkerSettingsPreprocess",
"SearchReference",
"SeoSummaryPageOutput",
"SeoSummaryPageRequest",
@@ -493,7 +500,6 @@
"TranslationPageRequestSelectedModel",
"TranslationPageResponse",
"TranslationPageStatusResponse",
- "Trigger",
"ValidationError",
"ValidationErrorLocItem",
"Vcard",
diff --git a/src/gooey/types/agg_function.py b/src/gooey/types/agg_function.py
index 33c6e19..ce512c1 100644
--- a/src/gooey/types/agg_function.py
+++ b/src/gooey/types/agg_function.py
@@ -5,12 +5,12 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .function import Function
+from .agg_function_function import AggFunctionFunction
class AggFunction(UniversalBaseModel):
column: typing.Optional[str] = None
- function: Function
+ function: AggFunctionFunction
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
diff --git a/src/gooey/types/function.py b/src/gooey/types/agg_function_function.py
similarity index 91%
rename from src/gooey/types/function.py
rename to src/gooey/types/agg_function_function.py
index 5841377..8eab8f8 100644
--- a/src/gooey/types/function.py
+++ b/src/gooey/types/agg_function_function.py
@@ -2,7 +2,7 @@
import typing
-Function = typing.Union[
+AggFunctionFunction = typing.Union[
typing.Literal[
"mean",
"median",
diff --git a/src/gooey/types/agg_function_result.py b/src/gooey/types/agg_function_result.py
index 3419b4c..6dcdfe0 100644
--- a/src/gooey/types/agg_function_result.py
+++ b/src/gooey/types/agg_function_result.py
@@ -5,12 +5,12 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .function import Function
+from .agg_function_result_function import AggFunctionResultFunction
class AggFunctionResult(UniversalBaseModel):
column: str
- function: Function
+ function: AggFunctionResultFunction
count: int
value: float
diff --git a/src/gooey/types/agg_function_result_function.py b/src/gooey/types/agg_function_result_function.py
new file mode 100644
index 0000000..acc98eb
--- /dev/null
+++ b/src/gooey/types/agg_function_result_function.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+AggFunctionResultFunction = typing.Union[
+ typing.Literal[
+ "mean",
+ "median",
+ "min",
+ "max",
+ "sum",
+ "cumsum",
+ "prod",
+ "cumprod",
+ "std",
+ "var",
+ "first",
+ "last",
+ "count",
+ "cumcount",
+ "nunique",
+ "rank",
+ ],
+ typing.Any,
+]
diff --git a/src/gooey/types/called_function_response.py b/src/gooey/types/called_function_response.py
index 674a388..42ea912 100644
--- a/src/gooey/types/called_function_response.py
+++ b/src/gooey/types/called_function_response.py
@@ -5,12 +5,12 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .trigger import Trigger
+from .called_function_response_trigger import CalledFunctionResponseTrigger
class CalledFunctionResponse(UniversalBaseModel):
url: str
- trigger: Trigger
+ trigger: CalledFunctionResponseTrigger
return_value: typing.Optional[typing.Any] = None
if IS_PYDANTIC_V2:
diff --git a/src/gooey/types/called_function_response_trigger.py b/src/gooey/types/called_function_response_trigger.py
new file mode 100644
index 0000000..d232a4f
--- /dev/null
+++ b/src/gooey/types/called_function_response_trigger.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+CalledFunctionResponseTrigger = typing.Union[typing.Literal["pre", "post"], typing.Any]
diff --git a/src/gooey/types/compare_text2img_page_request.py b/src/gooey/types/compare_text2img_page_request.py
index 5e37a05..fbfeb11 100644
--- a/src/gooey/types/compare_text2img_page_request.py
+++ b/src/gooey/types/compare_text2img_page_request.py
@@ -5,10 +5,10 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
+from .compare_text2img_page_request_scheduler import CompareText2ImgPageRequestScheduler
from .compare_text2img_page_request_selected_models_item import CompareText2ImgPageRequestSelectedModelsItem
from .recipe_function import RecipeFunction
from .run_settings import RunSettings
-from .scheduler import Scheduler
class CompareText2ImgPageRequest(UniversalBaseModel):
@@ -30,7 +30,7 @@ class CompareText2ImgPageRequest(UniversalBaseModel):
seed: typing.Optional[int] = None
sd2upscaling: typing.Optional[bool] = pydantic.Field(alias="sd_2_upscaling", default=None)
selected_models: typing.Optional[typing.List[CompareText2ImgPageRequestSelectedModelsItem]] = None
- scheduler: typing.Optional[Scheduler] = None
+ scheduler: typing.Optional[CompareText2ImgPageRequestScheduler] = None
edit_instruction: typing.Optional[str] = None
image_guidance_scale: typing.Optional[float] = None
settings: typing.Optional[RunSettings] = None
diff --git a/src/gooey/types/scheduler.py b/src/gooey/types/compare_text2img_page_request_scheduler.py
similarity index 89%
rename from src/gooey/types/scheduler.py
rename to src/gooey/types/compare_text2img_page_request_scheduler.py
index b18d974..29ce840 100644
--- a/src/gooey/types/scheduler.py
+++ b/src/gooey/types/compare_text2img_page_request_scheduler.py
@@ -2,7 +2,7 @@
import typing
-Scheduler = typing.Union[
+CompareText2ImgPageRequestScheduler = typing.Union[
typing.Literal[
"singlestep_dpm_solver",
"multistep_dpm_solver",
diff --git a/src/gooey/types/console_logs.py b/src/gooey/types/console_logs.py
index d8621d0..c988354 100644
--- a/src/gooey/types/console_logs.py
+++ b/src/gooey/types/console_logs.py
@@ -5,11 +5,11 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .level import Level
+from .console_logs_level import ConsoleLogsLevel
class ConsoleLogs(UniversalBaseModel):
- level: Level
+ level: ConsoleLogsLevel
message: str
if IS_PYDANTIC_V2:
diff --git a/src/gooey/types/detail.py b/src/gooey/types/console_logs_level.py
similarity index 51%
rename from src/gooey/types/detail.py
rename to src/gooey/types/console_logs_level.py
index 2b6070d..2ed3913 100644
--- a/src/gooey/types/detail.py
+++ b/src/gooey/types/console_logs_level.py
@@ -2,4 +2,4 @@
import typing
-Detail = typing.Union[typing.Literal["auto", "low", "high"], typing.Any]
+ConsoleLogsLevel = typing.Union[typing.Literal["log", "error"], typing.Any]
diff --git a/src/gooey/types/conversation_entry.py b/src/gooey/types/conversation_entry.py
index 4bce5fd..8980442 100644
--- a/src/gooey/types/conversation_entry.py
+++ b/src/gooey/types/conversation_entry.py
@@ -5,13 +5,13 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .content import Content
-from .role import Role
+from .conversation_entry_content import ConversationEntryContent
+from .conversation_entry_role import ConversationEntryRole
class ConversationEntry(UniversalBaseModel):
- role: Role
- content: Content
+ role: ConversationEntryRole
+ content: ConversationEntryContent
display_name: typing.Optional[str] = None
if IS_PYDANTIC_V2:
diff --git a/src/gooey/types/content.py b/src/gooey/types/conversation_entry_content.py
similarity index 63%
rename from src/gooey/types/content.py
rename to src/gooey/types/conversation_entry_content.py
index 1e48eb8..377c128 100644
--- a/src/gooey/types/content.py
+++ b/src/gooey/types/conversation_entry_content.py
@@ -4,4 +4,4 @@
from .conversation_entry_content_item import ConversationEntryContentItem
-Content = typing.Union[str, typing.List[ConversationEntryContentItem]]
+ConversationEntryContent = typing.Union[str, typing.List[ConversationEntryContentItem]]
diff --git a/src/gooey/types/conversation_entry_content_item.py b/src/gooey/types/conversation_entry_content_item.py
index 433ab74..18cbdb8 100644
--- a/src/gooey/types/conversation_entry_content_item.py
+++ b/src/gooey/types/conversation_entry_content_item.py
@@ -11,8 +11,8 @@
class ConversationEntryContentItem_Text(UniversalBaseModel):
- text: typing.Optional[str] = None
type: typing.Literal["text"] = "text"
+ text: typing.Optional[str] = None
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -25,8 +25,8 @@ class Config:
class ConversationEntryContentItem_ImageUrl(UniversalBaseModel):
- image_url: typing.Optional[ImageUrl] = None
type: typing.Literal["image_url"] = "image_url"
+ image_url: typing.Optional[ImageUrl] = None
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
diff --git a/src/gooey/types/conversation_entry_role.py b/src/gooey/types/conversation_entry_role.py
new file mode 100644
index 0000000..ce4289c
--- /dev/null
+++ b/src/gooey/types/conversation_entry_role.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ConversationEntryRole = typing.Union[typing.Literal["user", "system", "assistant"], typing.Any]
diff --git a/src/gooey/types/image_url.py b/src/gooey/types/image_url.py
index 811f386..0cd421c 100644
--- a/src/gooey/types/image_url.py
+++ b/src/gooey/types/image_url.py
@@ -5,12 +5,12 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .detail import Detail
+from .image_url_detail import ImageUrlDetail
class ImageUrl(UniversalBaseModel):
url: typing.Optional[str] = None
- detail: typing.Optional[Detail] = None
+ detail: typing.Optional[ImageUrlDetail] = None
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
diff --git a/src/gooey/types/image_url_detail.py b/src/gooey/types/image_url_detail.py
new file mode 100644
index 0000000..8513edd
--- /dev/null
+++ b/src/gooey/types/image_url_detail.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+ImageUrlDetail = typing.Union[typing.Literal["auto", "low", "high"], typing.Any]
diff --git a/src/gooey/types/level.py b/src/gooey/types/level.py
deleted file mode 100644
index b87834f..0000000
--- a/src/gooey/types/level.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-Level = typing.Union[typing.Literal["log", "error"], typing.Any]
diff --git a/src/gooey/types/preprocess.py b/src/gooey/types/preprocess.py
deleted file mode 100644
index 6189430..0000000
--- a/src/gooey/types/preprocess.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-Preprocess = typing.Union[typing.Literal["crop", "extcrop", "resize", "full", "extfull"], typing.Any]
diff --git a/src/gooey/types/prompt_tree_node.py b/src/gooey/types/prompt_tree_node.py
index 9e993f3..de44ce4 100644
--- a/src/gooey/types/prompt_tree_node.py
+++ b/src/gooey/types/prompt_tree_node.py
@@ -7,11 +7,11 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel, update_forward_refs
-from .prompt import Prompt
+from .prompt_tree_node_prompt import PromptTreeNodePrompt
class PromptTreeNode(UniversalBaseModel):
- prompt: Prompt
+ prompt: PromptTreeNodePrompt
children: typing.List[PromptTreeNode]
if IS_PYDANTIC_V2:
diff --git a/src/gooey/types/prompt.py b/src/gooey/types/prompt_tree_node_prompt.py
similarity index 64%
rename from src/gooey/types/prompt.py
rename to src/gooey/types/prompt_tree_node_prompt.py
index 1375bae..d27c578 100644
--- a/src/gooey/types/prompt.py
+++ b/src/gooey/types/prompt_tree_node_prompt.py
@@ -4,4 +4,4 @@
from .conversation_entry import ConversationEntry
-Prompt = typing.Union[str, typing.List[ConversationEntry]]
+PromptTreeNodePrompt = typing.Union[str, typing.List[ConversationEntry]]
diff --git a/src/gooey/types/qr_code_generator_page_request.py b/src/gooey/types/qr_code_generator_page_request.py
index 2883b1d..6ebb5c4 100644
--- a/src/gooey/types/qr_code_generator_page_request.py
+++ b/src/gooey/types/qr_code_generator_page_request.py
@@ -8,13 +8,13 @@
from .qr_code_generator_page_request_image_prompt_controlnet_models_item import (
QrCodeGeneratorPageRequestImagePromptControlnetModelsItem,
)
+from .qr_code_generator_page_request_scheduler import QrCodeGeneratorPageRequestScheduler
from .qr_code_generator_page_request_selected_controlnet_model_item import (
QrCodeGeneratorPageRequestSelectedControlnetModelItem,
)
from .qr_code_generator_page_request_selected_model import QrCodeGeneratorPageRequestSelectedModel
from .recipe_function import RecipeFunction
from .run_settings import RunSettings
-from .scheduler import Scheduler
from .vcard import Vcard
@@ -50,7 +50,7 @@ class QrCodeGeneratorPageRequest(UniversalBaseModel):
controlnet_conditioning_scale: typing.Optional[typing.List[float]] = None
num_outputs: typing.Optional[int] = None
quality: typing.Optional[int] = None
- scheduler: typing.Optional[Scheduler] = None
+ scheduler: typing.Optional[QrCodeGeneratorPageRequestScheduler] = None
seed: typing.Optional[int] = None
obj_scale: typing.Optional[float] = None
obj_pos_x: typing.Optional[float] = None
diff --git a/src/gooey/types/qr_code_generator_page_request_scheduler.py b/src/gooey/types/qr_code_generator_page_request_scheduler.py
new file mode 100644
index 0000000..e30308a
--- /dev/null
+++ b/src/gooey/types/qr_code_generator_page_request_scheduler.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+QrCodeGeneratorPageRequestScheduler = typing.Union[
+ typing.Literal[
+ "singlestep_dpm_solver",
+ "multistep_dpm_solver",
+ "dpm_sde",
+ "dpm_discrete",
+ "dpm_discrete_ancestral",
+ "unipc",
+ "lms_discrete",
+ "heun",
+ "euler",
+ "euler_ancestral",
+ "pndm",
+ "ddpm",
+ "ddim",
+ "deis",
+ ],
+ typing.Any,
+]
diff --git a/src/gooey/types/recipe_function.py b/src/gooey/types/recipe_function.py
index d8b46f5..82f6a86 100644
--- a/src/gooey/types/recipe_function.py
+++ b/src/gooey/types/recipe_function.py
@@ -5,7 +5,7 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .trigger import Trigger
+from .recipe_function_trigger import RecipeFunctionTrigger
class RecipeFunction(UniversalBaseModel):
@@ -14,7 +14,7 @@ class RecipeFunction(UniversalBaseModel):
The URL of the [function](https://gooey.ai/functions) to call.
"""
- trigger: Trigger = pydantic.Field()
+ trigger: RecipeFunctionTrigger = pydantic.Field()
"""
When to run this function. `pre` runs before the recipe, `post` runs after the recipe.
"""
diff --git a/src/gooey/types/role.py b/src/gooey/types/recipe_function_trigger.py
similarity index 50%
rename from src/gooey/types/role.py
rename to src/gooey/types/recipe_function_trigger.py
index f300df5..7c7dead 100644
--- a/src/gooey/types/role.py
+++ b/src/gooey/types/recipe_function_trigger.py
@@ -2,4 +2,4 @@
import typing
-Role = typing.Union[typing.Literal["user", "system", "assistant"], typing.Any]
+RecipeFunctionTrigger = typing.Union[typing.Literal["pre", "post"], typing.Any]
diff --git a/src/gooey/types/sad_talker_settings.py b/src/gooey/types/sad_talker_settings.py
index d60e283..a0c40e3 100644
--- a/src/gooey/types/sad_talker_settings.py
+++ b/src/gooey/types/sad_talker_settings.py
@@ -5,12 +5,12 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
-from .preprocess import Preprocess
+from .sad_talker_settings_preprocess import SadTalkerSettingsPreprocess
class SadTalkerSettings(UniversalBaseModel):
still: typing.Optional[bool] = None
- preprocess: typing.Optional[Preprocess] = pydantic.Field(default=None)
+ preprocess: typing.Optional[SadTalkerSettingsPreprocess] = pydantic.Field(default=None)
"""
SadTalker only generates 512x512 output. 'crop' handles this by cropping the input to 512x512. 'resize' scales down the input to fit 512x512 and scales it back up after lipsyncing (does not work well for full person images, better for portraits). 'full' processes the cropped region and pastes it back into the original input. 'extcrop' and 'extfull' are similar to 'crop' and 'full' but with extended cropping.
"""
diff --git a/src/gooey/types/sad_talker_settings_preprocess.py b/src/gooey/types/sad_talker_settings_preprocess.py
new file mode 100644
index 0000000..a782e9d
--- /dev/null
+++ b/src/gooey/types/sad_talker_settings_preprocess.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+SadTalkerSettingsPreprocess = typing.Union[typing.Literal["crop", "extcrop", "resize", "full", "extfull"], typing.Any]
diff --git a/src/gooey/types/trigger.py b/src/gooey/types/trigger.py
deleted file mode 100644
index 99821c7..0000000
--- a/src/gooey/types/trigger.py
+++ /dev/null
@@ -1,5 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-Trigger = typing.Union[typing.Literal["pre", "post"], typing.Any]
diff --git a/src/gooey/version.py b/src/gooey/version.py
index c6a685e..e16ae65 100644
--- a/src/gooey/version.py
+++ b/src/gooey/version.py
@@ -1,4 +1,4 @@
from importlib import metadata
-__version__ = metadata.version("gooey")
+__version__ = metadata.version("gooeyai")
diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py
new file mode 100644
index 0000000..f3ea265
--- /dev/null
+++ b/tests/utils/__init__.py
@@ -0,0 +1,2 @@
+# This file was auto-generated by Fern from our API Definition.
+
diff --git a/tests/utils/assets/models/__init__.py b/tests/utils/assets/models/__init__.py
new file mode 100644
index 0000000..2cf0126
--- /dev/null
+++ b/tests/utils/assets/models/__init__.py
@@ -0,0 +1,21 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+from .circle import CircleParams
+from .object_with_defaults import ObjectWithDefaultsParams
+from .object_with_optional_field import ObjectWithOptionalFieldParams
+from .shape import Shape_CircleParams, Shape_SquareParams, ShapeParams
+from .square import SquareParams
+from .undiscriminated_shape import UndiscriminatedShapeParams
+
+__all__ = [
+ "CircleParams",
+ "ObjectWithDefaultsParams",
+ "ObjectWithOptionalFieldParams",
+ "ShapeParams",
+ "Shape_CircleParams",
+ "Shape_SquareParams",
+ "SquareParams",
+ "UndiscriminatedShapeParams",
+]
diff --git a/tests/utils/assets/models/circle.py b/tests/utils/assets/models/circle.py
new file mode 100644
index 0000000..ad286fd
--- /dev/null
+++ b/tests/utils/assets/models/circle.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from gooey.core.serialization import FieldMetadata
+
+
+class CircleParams(typing_extensions.TypedDict):
+ radius_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="radiusMeasurement")]
diff --git a/tests/utils/assets/models/color.py b/tests/utils/assets/models/color.py
new file mode 100644
index 0000000..2aa2c4c
--- /dev/null
+++ b/tests/utils/assets/models/color.py
@@ -0,0 +1,7 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+Color = typing.Union[typing.Literal["red", "blue"], typing.Any]
diff --git a/tests/utils/assets/models/object_with_defaults.py b/tests/utils/assets/models/object_with_defaults.py
new file mode 100644
index 0000000..a977b1d
--- /dev/null
+++ b/tests/utils/assets/models/object_with_defaults.py
@@ -0,0 +1,15 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+
+
+class ObjectWithDefaultsParams(typing_extensions.TypedDict):
+ """
+ Defines properties with default values and validation rules.
+ """
+
+ decimal: typing_extensions.NotRequired[float]
+ string: typing_extensions.NotRequired[str]
+ required_string: str
diff --git a/tests/utils/assets/models/object_with_optional_field.py b/tests/utils/assets/models/object_with_optional_field.py
new file mode 100644
index 0000000..e85eaca
--- /dev/null
+++ b/tests/utils/assets/models/object_with_optional_field.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import datetime as dt
+import typing
+import uuid
+
+import typing_extensions
+from gooey.core.serialization import FieldMetadata
+
+from .color import Color
+from .shape import ShapeParams
+from .undiscriminated_shape import UndiscriminatedShapeParams
+
+
+class ObjectWithOptionalFieldParams(typing_extensions.TypedDict):
+ literal: typing.Literal["lit_one"]
+ string: typing_extensions.NotRequired[str]
+ integer: typing_extensions.NotRequired[int]
+ long_: typing_extensions.NotRequired[typing_extensions.Annotated[int, FieldMetadata(alias="long")]]
+ double: typing_extensions.NotRequired[float]
+ bool_: typing_extensions.NotRequired[typing_extensions.Annotated[bool, FieldMetadata(alias="bool")]]
+ datetime: typing_extensions.NotRequired[dt.datetime]
+ date: typing_extensions.NotRequired[dt.date]
+ uuid_: typing_extensions.NotRequired[typing_extensions.Annotated[uuid.UUID, FieldMetadata(alias="uuid")]]
+ base_64: typing_extensions.NotRequired[typing_extensions.Annotated[str, FieldMetadata(alias="base64")]]
+ list_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Sequence[str], FieldMetadata(alias="list")]]
+ set_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Set[str], FieldMetadata(alias="set")]]
+ map_: typing_extensions.NotRequired[typing_extensions.Annotated[typing.Dict[int, str], FieldMetadata(alias="map")]]
+ enum: typing_extensions.NotRequired[Color]
+ union: typing_extensions.NotRequired[ShapeParams]
+ second_union: typing_extensions.NotRequired[ShapeParams]
+ undiscriminated_union: typing_extensions.NotRequired[UndiscriminatedShapeParams]
+ any: typing.Any
diff --git a/tests/utils/assets/models/shape.py b/tests/utils/assets/models/shape.py
new file mode 100644
index 0000000..a8d62e6
--- /dev/null
+++ b/tests/utils/assets/models/shape.py
@@ -0,0 +1,27 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+from __future__ import annotations
+
+import typing
+
+import typing_extensions
+from gooey.core.serialization import FieldMetadata
+
+
+class Base(typing_extensions.TypedDict):
+ id: str
+
+
+class Shape_CircleParams(Base):
+ shape_type: typing_extensions.Annotated[typing.Literal["circle"], FieldMetadata(alias="shapeType")]
+ radius_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="radiusMeasurement")]
+
+
+class Shape_SquareParams(Base):
+ shape_type: typing_extensions.Annotated[typing.Literal["square"], FieldMetadata(alias="shapeType")]
+ length_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="lengthMeasurement")]
+
+
+ShapeParams = typing.Union[Shape_CircleParams, Shape_SquareParams]
diff --git a/tests/utils/assets/models/square.py b/tests/utils/assets/models/square.py
new file mode 100644
index 0000000..86f923f
--- /dev/null
+++ b/tests/utils/assets/models/square.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from gooey.core.serialization import FieldMetadata
+
+
+class SquareParams(typing_extensions.TypedDict):
+ length_measurement: typing_extensions.Annotated[float, FieldMetadata(alias="lengthMeasurement")]
diff --git a/tests/utils/assets/models/undiscriminated_shape.py b/tests/utils/assets/models/undiscriminated_shape.py
new file mode 100644
index 0000000..99f12b3
--- /dev/null
+++ b/tests/utils/assets/models/undiscriminated_shape.py
@@ -0,0 +1,10 @@
+# This file was auto-generated by Fern from our API Definition.
+
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+from .circle import CircleParams
+from .square import SquareParams
+
+UndiscriminatedShapeParams = typing.Union[CircleParams, SquareParams]
diff --git a/tests/utils/test_query_encoding.py b/tests/utils/test_query_encoding.py
index 43e9d34..c41d8d8 100644
--- a/tests/utils/test_query_encoding.py
+++ b/tests/utils/test_query_encoding.py
@@ -11,3 +11,8 @@ def test_query_encoding() -> None:
"hello_world[test]": "this",
"hi": "there",
}
+
+
+def test_encode_query_with_none() -> None:
+ encoded = encode_query(None)
+ assert encoded == None
diff --git a/tests/utils/test_serialization.py b/tests/utils/test_serialization.py
new file mode 100644
index 0000000..512cc18
--- /dev/null
+++ b/tests/utils/test_serialization.py
@@ -0,0 +1,66 @@
+# This file was auto-generated by Fern from our API Definition.
+
+from typing import Any, List
+
+from gooey.core.serialization import convert_and_respect_annotation_metadata
+
+from .assets.models import ObjectWithOptionalFieldParams, ShapeParams
+
+UNION_TEST: ShapeParams = {"radius_measurement": 1.0, "shape_type": "circle", "id": "1"}
+UNION_TEST_CONVERTED = {"shapeType": "circle", "radiusMeasurement": 1.0, "id": "1"}
+
+
+def test_convert_and_respect_annotation_metadata() -> None:
+ data: ObjectWithOptionalFieldParams = {
+ "string": "string",
+ "long_": 12345,
+ "bool_": True,
+ "literal": "lit_one",
+ "any": "any",
+ }
+ converted = convert_and_respect_annotation_metadata(object_=data, annotation=ObjectWithOptionalFieldParams)
+ assert converted == {"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"}
+
+
+def test_convert_and_respect_annotation_metadata_in_list() -> None:
+ data: List[ObjectWithOptionalFieldParams] = [
+ {"string": "string", "long_": 12345, "bool_": True, "literal": "lit_one", "any": "any"},
+ {"string": "another string", "long_": 67890, "list_": [], "literal": "lit_one", "any": "any"},
+ ]
+ converted = convert_and_respect_annotation_metadata(object_=data, annotation=List[ObjectWithOptionalFieldParams])
+
+ assert converted == [
+ {"string": "string", "long": 12345, "bool": True, "literal": "lit_one", "any": "any"},
+ {"string": "another string", "long": 67890, "list": [], "literal": "lit_one", "any": "any"},
+ ]
+
+
+def test_convert_and_respect_annotation_metadata_in_nested_object() -> None:
+ data: ObjectWithOptionalFieldParams = {
+ "string": "string",
+ "long_": 12345,
+ "union": UNION_TEST,
+ "literal": "lit_one",
+ "any": "any",
+ }
+ converted = convert_and_respect_annotation_metadata(object_=data, annotation=ObjectWithOptionalFieldParams)
+
+ assert converted == {
+ "string": "string",
+ "long": 12345,
+ "union": UNION_TEST_CONVERTED,
+ "literal": "lit_one",
+ "any": "any",
+ }
+
+
+def test_convert_and_respect_annotation_metadata_in_union() -> None:
+ converted = convert_and_respect_annotation_metadata(object_=UNION_TEST, annotation=ShapeParams)
+
+ assert converted == UNION_TEST_CONVERTED
+
+
+def test_convert_and_respect_annotation_metadata_with_empty_object() -> None:
+ data: Any = {}
+ converted = convert_and_respect_annotation_metadata(object_=data, annotation=ShapeParams)
+ assert converted == data