Assistant API memory seems to reset after 10 to 15 messages

I have created an Assistant using openai API. The agent seems to lose its memory after 10-15 messages. and It reverts to the start of the conversation.
Is there a setting in Thread or Run creation that allows for setting memory window size?

I have tried using it using new Langchain Agent implementation but even in that mode the memory seems to fail.

I dont have this issue with Traditional langchain agents based on Gpt4 models.