ai-audio-books / src /utils.py
Aliaksandr
e2e audio book generation (#5)
c2fa877 unverified
raw
history blame
489 Bytes
from enum import StrEnum
from httpx import Timeout
from langchain_openai import ChatOpenAI
class GPTModels(StrEnum):
GPT_4o = "gpt-4o"
GPT_4o_MINI = "gpt-4o-mini"
GPT_4_TURBO_2024_04_09 = "gpt-4-turbo-2024-04-09"
def get_chat_llm(llm_model: GPTModels, temperature=0.0):
llm = ChatOpenAI(
model=llm_model, temperature=temperature, timeout=Timeout(60, connect=4)
)
return llm
async def consume_aiter(aiterator):
return [x async for x in aiterator]