diff --git a/endpoints/misc.py b/endpoints/misc.py index 1167f25..63e647c 100644 --- a/endpoints/misc.py +++ b/endpoints/misc.py @@ -125,7 +125,12 @@ class Misc(FastAPI): """ np: dict = self.radio.radio_util.now_playing - artistsong: str = np.get("artistsong", "N/A - N/A") + artistsong: str = "N/A - N/A" + artist = np.get("artist") + song = np.get("song") + if artist and song: + artistsong = f"{artist} - {song}" + album: str = np.get("album", "N/A") genre: str = np.get("genre", "N/A") return (artistsong, album, genre) @@ -143,10 +148,6 @@ class Misc(FastAPI): # End response time test total_keys = await self.redis_client.dbsize() response_time: float = time_end - time_start - (_, ci_keys) = await self.redis_client.scan( - cursor=0, match="ci_session*", count=10000000 - ) - num_ci_keys = len(ci_keys) index_info = await self.redis_client.ft().info() indexed_lyrics: int = index_info.get("num_docs") return JSONResponse( @@ -154,7 +155,7 @@ class Misc(FastAPI): "responseTime": round(response_time, 7), "storedKeys": total_keys, "indexedLyrics": indexed_lyrics, - "sessions": num_ci_keys, + "sessions": -1, } ) diff --git a/gpt/__init__.py b/gpt/__init__.py index 1b859a8..8f21098 100644 --- a/gpt/__init__.py +++ b/gpt/__init__.py @@ -11,8 +11,13 @@ class GPT: api_key=self.api_key, timeout=10.0, ) - 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.""" + 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. + # IMPORTANT + As an AI assistant, you may not always have much information available to describe the track provided. That is TOTALLY FINE! + What is not acceptable is hallucinations, for example: + - Do NOT mention the name of the album the track was included on. You rarely have correct information in this context. + - If no 100% reliable data is available, do NOT (!!) mention the album...""" logging.getLogger("httpx").setLevel("CRITICAL") @@ -33,7 +38,7 @@ class GPT: }, ], model="gpt-4o-mini", - temperature=0.35, + temperature=1.00, ) response: Optional[str] = chat_completion.choices[0].message.content return response