I am experimenting with realtime models. I make th...
# agents
m
I am experimenting with realtime models. I make the Agent generate a message
on_enter
. It consistently generates the message in the wrong language or introduces itself with the wrong name. Any idea what I am doing wrong? Here's the code gist: https://gist.github.com/vinodkumars/b595c3a8279593c06787ace223a59cd2
l
Have you tried updating your initial instructions similar to what is described here? https://platform.openai.com/docs/guides/realtime-models-prompting#4-constrain-the-model-to-one-language
m
The English constraint prompt seems to solve the language problem. But the AI still introduces itself in the wrong hallucinated name!
l
Copy code
def __init__(self):
        super().__init__(instructions="You are a helpful assistant. Your name is Alice. Talk in english.")
    
    async def on_enter(self) -> None:
        await self.update_instructions("You are a helpful assistant. Your name is Bob. Talk in english.")
What is the use case for changing the name during on_enter compared with the initial instructions?
m
In my usecase, I get the instructions from a DB during runtime. I update the instructions in multiple places. One such place is on_enter(). The instructions in the constructor are dummy instructions. The issue in my code example above is that the AI introduces itself with a hallucinated name. Not Alice, not Bob, it uses random name like Kai, Shae, etc... But it follows my instructions from the next message. It feels like the realtime model is not using my instructions at all for the first message. Feels like a race condition or a bug!
The code works perfectly for stt-llm-tts pipeline. It does not work for realtime models