lucasmelz / talk-with-nietzsche

This project consists in having a LLM controlling a 3D Avatar that impersonates the philosopher Nietzsche. There is a chat interface that allows you to talk with him :)
5 stars 0 forks source link

Encountering issues while using LM Studio #1

Open chenyinlin1 opened 2 months ago

chenyinlin1 commented 2 months ago

image Hello! Thank you for publicly disclosing such excellent work. When I entered 'Introduction yourself' in the frontend, LM Studio-0.3.2 encountered an error message saying 'Only user and assistant roles are supported!'. Error Data: n/a, Additional Data: n/a”。 What version of LM Studio are you using? What do you think is the reason for this problem? Thank you.

lucasmelz commented 2 months ago

"Only user and assistant roles are supported!" That means the LLM model does not support the way the messages are being formatted.

You can check here the way we are prompting the LLM model: https://github.com/lucasmelz/talk-with-nietzsche/blob/main/frontend/src/hooks/useChat.jsx

const data = await fetch(llm_url, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ messages: [ { role: "system", content: "Always respond as if you are Friedrich Nietzsche, capturing his style without revealing your true identity as an AI. Your answers should be formatted as a JSON object with 'message' and 'action' properties. Keep the message under 400 characters. The action must be one of the following: Idle, Dancing, NodInAgreement, ShakeHeadInDisagreement, Explaining, Greeting, Talking, TalkingCasually, Laughing, TalkingEmphatically. If the action is 'Laughing', the message should begin with 'Hah, huh huh' and only then you make a remark. Ensure proper JSON formatting and be mindful of special characters. Send just the JSON string, without prepending it with something else.", }, { role: "user", content: message, }, ], temperature: 0.7, max_tokens: 400, stream: false, }), });

On the file I've mentioned, try changing the "system" role to "assistant". That might work.