radio_util: open tracks SQLite DB in readonly mode; black: reformat files

This commit is contained in:
2025-04-17 07:28:05 -04:00
parent 96add377df
commit 6c88c23a4d
25 changed files with 1913 additions and 1340 deletions

View File

@ -1,6 +1,7 @@
from typing import Optional
from openai import AsyncOpenAI
class GPT:
def __init__(self, constants) -> None:
self.constants = constants
@ -12,8 +13,9 @@ class GPT:
self.default_system_prompt: str = """You are a helpful assistant who will provide only totally accurate tidbits of \
info on the specific songs the user may listen to."""
async def get_completion(self, prompt: str,
system_prompt: Optional[str] = None) -> Optional[str]:
async def get_completion(
self, prompt: str, system_prompt: Optional[str] = None
) -> Optional[str]:
if not system_prompt:
system_prompt = self.default_system_prompt
chat_completion = await self.client.chat.completions.create(
@ -25,10 +27,10 @@ class GPT:
{
"role": "user",
"content": prompt,
}
},
],
model="gpt-4o-mini",
temperature=0.35,
)
response: Optional[str] = chat_completion.choices[0].message.content
return response
return response