nickthecook / archyve

GNU Affero General Public License v3.0
108 stars 15 forks source link

Model config system_prompt not being used in chat #109

Open mattlindsey opened 3 days ago

mattlindsey commented 3 days ago

Using the admin page, I added the system_prompt Please call me Jeremy to the default phi3:latest chat model, but when chatting I don't see it being used.

In the api call for Hi. Do you know my name? I just see the message below (from Message.summary_chat method). Shouldn't it use use or add a role: system message?

{
  "model": "phi3:latest",
  "messages": [
    {
      "role": "system",
      "content": "You are a summarization AI. You'll never answer a user's question directly, but instead summarize\nthe user's request into a single short sentence of four words or less. Always start your answer\nwith an emoji relevant to the summary\",\n"
    },
    {
      "role": "user",
      "content": "Who is the president of Gabon?"
    },
    {
      "role": "assistant",
      "content": "🇬🇦 President of Gabon"
    },
    {
      "role": "user",
      "content": "Who is Julien Chaumond?"
    },
    {
      "role": "assistant",
      "content": "🧑 Julien Chaumond"
    },
    {
      "role": "user",
      "content": "what is 1 + 1?"
    },
    {
      "role": "assistant",
      "content": "🔢 Simple math operation"
    },
    {
      "role": "user",
      "content": "What are the latest news?"
    },
    {
      "role": "assistant",
      "content": "📰 Latest news"
    },
    {
      "role": "user",
      "content": "How to make a great cheesecake?"
    },
    {
      "role": "assistant",
      "content": "🍰 Cheesecake recipe"
    },
    {
      "role": "user",
      "content": "what is your favorite movie? do a short answer."
    },
    {
      "role": "assistant",
      "content": "🎥 Favorite movie"
    },
    {
      "role": "user",
      "content": "Explain the concept of artificial intelligence in one sentence"
    },
    {
      "role": "assistant",
      "content": "🤖 AI definition"
    },
    {
      "role": "user",
      "content": "Draw a cute cat"
    },
    {
      "role": "assistant",
      "content": "🐱 Cute cat drawing"
    },
    {
      "role": "user",
      "content": "Hi. Do you know my name?"
    }
  ]
}

Response body:

🙋‍♂️ I don't have access to personal data unless it's shared with me in the context of our conversation, and even then, privacy is paramount. My primary function is to assist without retaining identifying information about individuals beyond this interaction for their safety and confidentiality.
nickthecook commented 3 days ago

Yes, the system prompt is in the schema but isn't actually used.

For each chat message a user submits, two calls to an LLM are made: the summarization call, which Archyve uses to set the conversation title, and the actual chat request.

The request you found is the summarization request, which doesn't include any augmentation, and I'm not sure if it should include the system prompt or not. The chat request, however, definitely should. This is an issue right now, definitely a basic feature we want to have.