diff --git a/ai-hub/app/core/pipelines/dspy_rag.py b/ai-hub/app/core/pipelines/dspy_rag.py index 2a76510..7e2f243 100644 --- a/ai-hub/app/core/pipelines/dspy_rag.py +++ b/ai-hub/app/core/pipelines/dspy_rag.py @@ -24,11 +24,12 @@ class AnswerWithHistory(dspy.Signature): - """Given the context and chat history, answer the user's question.""" - context = dspy.InputField(desc="Relevant document snippets from the knowledge base.") - chat_history = dspy.InputField(desc="The ongoing conversation between the user and the AI.") - question = dspy.InputField() - answer = dspy.OutputField() + """Generate a natural and context-aware answer to the user's question using the provided knowledge and conversation history.""" + + context = dspy.InputField(desc="Relevant excerpts from the knowledge base to support the answer.") + chat_history = dspy.InputField(desc="The ongoing dialogue between the user and the AI, providing conversational context.") + question = dspy.InputField(desc="The user's current question.") + answer = dspy.OutputField(desc="A well-formed answer suitable for delivery in an audio play format.") class DspyRagPipeline(dspy.Module): diff --git a/ai-hub/app/core/pipelines/dspy_rag.py b/ai-hub/app/core/pipelines/dspy_rag.py index 2a76510..7e2f243 100644 --- a/ai-hub/app/core/pipelines/dspy_rag.py +++ b/ai-hub/app/core/pipelines/dspy_rag.py @@ -24,11 +24,12 @@ class AnswerWithHistory(dspy.Signature): - """Given the context and chat history, answer the user's question.""" - context = dspy.InputField(desc="Relevant document snippets from the knowledge base.") - chat_history = dspy.InputField(desc="The ongoing conversation between the user and the AI.") - question = dspy.InputField() - answer = dspy.OutputField() + """Generate a natural and context-aware answer to the user's question using the provided knowledge and conversation history.""" + + context = dspy.InputField(desc="Relevant excerpts from the knowledge base to support the answer.") + chat_history = dspy.InputField(desc="The ongoing dialogue between the user and the AI, providing conversational context.") + question = dspy.InputField(desc="The user's current question.") + answer = dspy.OutputField(desc="A well-formed answer suitable for delivery in an audio play format.") class DspyRagPipeline(dspy.Module): diff --git a/ai-hub/app/core/providers/tts/gcloud_tts.py b/ai-hub/app/core/providers/tts/gcloud_tts.py index bfdb1b1..0ae78a6 100644 --- a/ai-hub/app/core/providers/tts/gcloud_tts.py +++ b/ai-hub/app/core/providers/tts/gcloud_tts.py @@ -14,14 +14,21 @@ # New concrete class for the Google Cloud Text-to-Speech API class GCloudTTSProvider(TTSProvider): # This provider uses Google's dedicated TTS API. The voices are different from Gemini. - # Here is a small, representative list of available WaveNet voices. - # The full list is much larger and can be found in the official documentation. + # Updated with the full list of available Chirp3 HD voices you provided. AVAILABLE_VOICES = [ - "en-US-Wavenet-A", "en-US-Wavenet-B", "en-US-Wavenet-C", "en-US-Wavenet-D", - "en-US-Wavenet-E", "en-US-Wavenet-F", "en-US-Wavenet-G", "en-US-Wavenet-H" + "en-US-Chirp3-HD-Achernar", "en-US-Chirp3-HD-Achird", "en-US-Chirp3-HD-Algenib", + "en-US-Chirp3-HD-Algieba", "en-US-Chirp3-HD-Alnilam", "en-US-Chirp3-HD-Aoede", + "en-US-Chirp3-HD-Autonoe", "en-US-Chirp3-HD-Callirrhoe", "en-US-Chirp3-HD-Charon", + "en-US-Chirp3-HD-Despina", "en-US-Chirp3-HD-Enceladus", "en-US-Chirp3-HD-Erinome", + "en-US-Chirp3-HD-Fenrir", "en-US-Chirp3-HD-Gacrux", "en-US-Chirp3-HD-Iapetus", + "en-US-Chirp3-HD-Kore", "en-US-Chirp3-HD-Laomedeia", "en-US-Chirp3-HD-Leda", + "en-US-Chirp3-HD-Orus", "en-US-Chirp3-HD-Puck", "en-US-Chirp3-HD-Pulcherrima", + "en-US-Chirp3-HD-Rasalgethi", "en-US-Chirp3-HD-Sadachbia", "en-US-Chirp3-HD-Sadaltager", + "en-US-Chirp3-HD-Schedar", "en-US-Chirp3-HD-Sulafat", "en-US-Chirp3-HD-Umbriel", + "en-US-Chirp3-HD-Vindemiatrix", "en-US-Chirp3-HD-Zephyr", "en-US-Chirp3-HD-Zubenelgenubi" ] - def __init__(self, api_key: str, voice_name: str = "en-US-Wavenet-D"): + def __init__(self, api_key: str, voice_name: str = "en-US-Chirp3-HD-Kore"): if voice_name not in self.AVAILABLE_VOICES: raise ValueError(f"Invalid voice name: {voice_name}. Choose from {self.AVAILABLE_VOICES}") diff --git a/ai-hub/app/core/pipelines/dspy_rag.py b/ai-hub/app/core/pipelines/dspy_rag.py index 2a76510..7e2f243 100644 --- a/ai-hub/app/core/pipelines/dspy_rag.py +++ b/ai-hub/app/core/pipelines/dspy_rag.py @@ -24,11 +24,12 @@ class AnswerWithHistory(dspy.Signature): - """Given the context and chat history, answer the user's question.""" - context = dspy.InputField(desc="Relevant document snippets from the knowledge base.") - chat_history = dspy.InputField(desc="The ongoing conversation between the user and the AI.") - question = dspy.InputField() - answer = dspy.OutputField() + """Generate a natural and context-aware answer to the user's question using the provided knowledge and conversation history.""" + + context = dspy.InputField(desc="Relevant excerpts from the knowledge base to support the answer.") + chat_history = dspy.InputField(desc="The ongoing dialogue between the user and the AI, providing conversational context.") + question = dspy.InputField(desc="The user's current question.") + answer = dspy.OutputField(desc="A well-formed answer suitable for delivery in an audio play format.") class DspyRagPipeline(dspy.Module): diff --git a/ai-hub/app/core/providers/tts/gcloud_tts.py b/ai-hub/app/core/providers/tts/gcloud_tts.py index bfdb1b1..0ae78a6 100644 --- a/ai-hub/app/core/providers/tts/gcloud_tts.py +++ b/ai-hub/app/core/providers/tts/gcloud_tts.py @@ -14,14 +14,21 @@ # New concrete class for the Google Cloud Text-to-Speech API class GCloudTTSProvider(TTSProvider): # This provider uses Google's dedicated TTS API. The voices are different from Gemini. - # Here is a small, representative list of available WaveNet voices. - # The full list is much larger and can be found in the official documentation. + # Updated with the full list of available Chirp3 HD voices you provided. AVAILABLE_VOICES = [ - "en-US-Wavenet-A", "en-US-Wavenet-B", "en-US-Wavenet-C", "en-US-Wavenet-D", - "en-US-Wavenet-E", "en-US-Wavenet-F", "en-US-Wavenet-G", "en-US-Wavenet-H" + "en-US-Chirp3-HD-Achernar", "en-US-Chirp3-HD-Achird", "en-US-Chirp3-HD-Algenib", + "en-US-Chirp3-HD-Algieba", "en-US-Chirp3-HD-Alnilam", "en-US-Chirp3-HD-Aoede", + "en-US-Chirp3-HD-Autonoe", "en-US-Chirp3-HD-Callirrhoe", "en-US-Chirp3-HD-Charon", + "en-US-Chirp3-HD-Despina", "en-US-Chirp3-HD-Enceladus", "en-US-Chirp3-HD-Erinome", + "en-US-Chirp3-HD-Fenrir", "en-US-Chirp3-HD-Gacrux", "en-US-Chirp3-HD-Iapetus", + "en-US-Chirp3-HD-Kore", "en-US-Chirp3-HD-Laomedeia", "en-US-Chirp3-HD-Leda", + "en-US-Chirp3-HD-Orus", "en-US-Chirp3-HD-Puck", "en-US-Chirp3-HD-Pulcherrima", + "en-US-Chirp3-HD-Rasalgethi", "en-US-Chirp3-HD-Sadachbia", "en-US-Chirp3-HD-Sadaltager", + "en-US-Chirp3-HD-Schedar", "en-US-Chirp3-HD-Sulafat", "en-US-Chirp3-HD-Umbriel", + "en-US-Chirp3-HD-Vindemiatrix", "en-US-Chirp3-HD-Zephyr", "en-US-Chirp3-HD-Zubenelgenubi" ] - def __init__(self, api_key: str, voice_name: str = "en-US-Wavenet-D"): + def __init__(self, api_key: str, voice_name: str = "en-US-Chirp3-HD-Kore"): if voice_name not in self.AVAILABLE_VOICES: raise ValueError(f"Invalid voice name: {voice_name}. Choose from {self.AVAILABLE_VOICES}") diff --git a/ai-hub/requirements.txt b/ai-hub/requirements.txt index c455aa1..d4e6495 100644 --- a/ai-hub/requirements.txt +++ b/ai-hub/requirements.txt @@ -7,7 +7,7 @@ requests anyio sqlalchemy -psycopg2 +psycopg2-binary pytest-asyncio pytest-tornasync pytest-trio