Skip to content

Commit

Permalink
update type hints
Browse files Browse the repository at this point in the history
  • Loading branch information
aaazzam committed Jan 16, 2024
1 parent 2436b73 commit fafe9fa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/marvin/ai/audio.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from functools import partial, wraps
from typing import Callable, Literal, Optional, TypeVar
from typing import Any, Callable, Literal, Optional, TypeVar

from openai._base_client import HttpxBinaryResponseContent

Expand All @@ -17,8 +17,8 @@

def generate_speech(
prompt_template: str,
prompt_kwargs: dict = None,
model_kwargs: dict = None,
prompt_kwargs: Optional[dict[str, Any]] = None,
model_kwargs: Optional[dict[str, Any]] = None,
) -> HttpxBinaryResponseContent:
"""
Generates an image based on a provided prompt template.
Expand All @@ -43,17 +43,17 @@ def generate_speech(
prompt = Environment.render(prompt_template, **prompt_kwargs)
request = SpeechRequest(input=prompt, **model_kwargs)
if marvin.settings.log_verbose:
logger.debug_kv("Request", request.model_dump_json(indent=2))
getattr(logger, "debug_kv")("Request", request.model_dump_json(indent=2))
response = MarvinClient().generate_speech(**request.model_dump())
if marvin.settings.log_verbose:
logger.debug_kv("Request", request.model_dump_json(indent=2))
getattr(logger, "debug_kv")("Response", response.model_dump_json(indent=2))
return response


def speak(
text: str,
voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"] = None,
model_kwargs: dict = None,
voice: Literal["alloy", "echo", "fable", "onyx", "nova", "shimmer"] = "alloy",
model_kwargs: Optional[dict[str, Any]] = None,
) -> HttpxBinaryResponseContent:
"""
Generates audio from text using an AI.
Expand Down

0 comments on commit fafe9fa

Please sign in to comment.