Skip to content

Commit

Permalink
more renaming and remove api_choices in favor of api_enum
Browse files Browse the repository at this point in the history
  • Loading branch information
nikochiko committed Sep 13, 2024
1 parent 55e5ea9 commit e48b197
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
5 changes: 0 additions & 5 deletions daras_ai_v2/custom_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ def from_db(cls, db_value) -> typing_extensions.Self:
return e
raise ValueError(f"Invalid {cls.__name__} {db_value=}")

@classmethod
@property
def api_choices(cls):
return typing.Literal[tuple(e.api_value for e in cls)]

@classmethod
@property
@cached_classmethod
Expand Down
4 changes: 3 additions & 1 deletion daras_ai_v2/vector_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ class Config:
use_enum_values = True

search_query: str
keyword_query: str | list[str] | None
keyword_query: str | list[str] | None = Field(
**{"x-fern-type-name": "KeywordQuery"}
)

documents: list[str] | None

Expand Down
4 changes: 2 additions & 2 deletions functions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ class RecipeFunction(BaseModel):
title="URL",
description="The URL of the [function](https://gooey.ai/functions) to call.",
)
trigger: FunctionTrigger.api_choices = Field(
trigger: FunctionTrigger.api_enum = Field(
title="Trigger",
description="When to run this function. `pre` runs before the recipe, `post` runs after the recipe.",
)


class CalledFunctionResponse(BaseModel):
url: str
trigger: FunctionTrigger.api_choices
trigger: FunctionTrigger.api_enum
return_value: typing.Any

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions recipes/Img2Img.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from daras_ai_v2.pydantic_validation import FieldHttpUrl
import requests
from pydantic import BaseModel
from pydantic import BaseModel, Field

import gooey_gui as gui
from bots.models import Workflow
Expand Down Expand Up @@ -49,7 +49,7 @@ class RequestModel(BasePage.RequestModel):
selected_model: ImageToImageModels.api_enum | None
selected_controlnet_model: (
list[ControlNetModels.api_enum] | ControlNetModels.api_enum | None
)
) = Field(**{"x-fern-type-name": "SelectedControlNetModels"})
negative_prompt: str | None

num_outputs: int | None
Expand Down
4 changes: 2 additions & 2 deletions recipes/TextToSpeech.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class TextToSpeechSettings(BaseModel):

azure_voice_name: str | None

openai_voice_name: OpenAI_TTS_Voices.api_choices | None
openai_tts_model: OpenAI_TTS_Models.api_choices | None
openai_voice_name: OpenAI_TTS_Voices.api_enum | None
openai_tts_model: OpenAI_TTS_Models.api_enum | None


class TextToSpeechPage(BasePage):
Expand Down

0 comments on commit e48b197

Please sign in to comment.