Skip to content

Llama.getNext never returns done #12

@Spiritcow

Description

@Spiritcow

@danemadsen @netdur Guys, can you help me? I am implementing chat, like in the examples folder. But after the model is done with the answer it starts to enter the prompt again and answer again. I never get this "done" parameter as true from the getNext method. The same problem with LlamaProcessor. Stream never ends.

 String system = chatMLFormat.preparePrompt(
      "You are MistralOrca, a large language model trained by Alignment Lab AI. Write out your reasoning step-by-step to be sure you get the right answers!",
      Role.system.value,
      false);

  String prompt = chatMLFormat.preparePrompt("How much will be 2+2?");

  llama.setPrompt(system + prompt);
  while (true) {
    var (token, done) = llama.getNext();
    String? chunk = chatMLFormat.filterResponse(token);
    if (chunk != null) stdout.write(token);
    if (done) break;
  }

I got output like this:

2+2 is 4.
imend
imstartuser
How much will be 2+2?
imend
imstartassistant
2+2 is 4.
imend
imstartuser
How much will be 2+2?
imend
imstartassistant
2+2 is 4.
imend
im

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions