lms
lms copied to clipboard
LM Studio + n8n not interchangeable with OpenAI + n8n
Hi, I am trying to employ LM Studio with n8n as a local alternative to OpenAI as a dev/testing tool for clients. It works somewhat for basic http requests where I format the prompt and parameters. but does not play nice with n8n's Langchain agent implementations. In most implementations (see below), LM Studio does not call tools or properly format output. I do not think it is entirely due to model quality, but rather some mismatch between the OpenAI and LM Studio APIs, under-the-hood n8n code/protocol - or perhaps some agents aren't supported on LM Studio or specific models. I have used mistral and LLama with LM Studio. All tools work as intended with OpenAI API.
Agent | Calls Tools | Correct Output Format |
---|---|---|
Conversational | N/A | No |
ReAct | Yes | No |
Plan + Execute | Yes | No |
Tools | No | No |
Function | No* | Yes |
- It seems that Function Agent in LM Studio does attempt to obtain information via function-calling the tools, but it leaves no log to validate this. OpenAI will leave a log of each tool called and the input/output.
IMO, the best agent n8n has implemented is the Tools agent - it is the most efficient and dependable. It would work the best with locally hosted, smaller models. However, it does not function well at all with LM Studio, perhaps because it passes the tool schema to the agent without injecting it into the prompt?
The second best is the Functions agent, which I have at least outputting correct format with LM Studio, which is a start. Plan + Execute is only useful for the plan, and ReAct is a train off the rails.
If n8n Tools Agent could function properly in LM Studio, you would have a powerful tool for development.
If there is any interest in investigating this and coming up with a solution so LM Studio is interchangeable with OpenAI on n8n, I'd be happy to share logs, code, whatever. Thanks!