Bug Description
In server/app.py, the SentenceTransformer(EMBEDDING_MODEL) is instantiated inside the milvus_search() function. This causes the application to load the entire embedding model into memory on every single tool call, resulting in severe latency spikes (multiple seconds per search) and risking OOM crashes under concurrent WebSocket connections.
Proposed Solution
Move the SentenceTransformer initialization to the global scope so it acts as a singleton loaded once at server startup. The milvus_search function should reference this global instance.
I have tested this locally and it drastically reduces tool execution latency. I will open a PR with the fix shortly.
Bug Description
In
server/app.py, theSentenceTransformer(EMBEDDING_MODEL)is instantiated inside themilvus_search()function. This causes the application to load the entire embedding model into memory on every single tool call, resulting in severe latency spikes (multiple seconds per search) and risking OOM crashes under concurrent WebSocket connections.Proposed Solution
Move the
SentenceTransformerinitialization to the global scope so it acts as a singleton loaded once at server startup. Themilvus_searchfunction should reference this global instance.I have tested this locally and it drastically reduces tool execution latency. I will open a PR with the fix shortly.