Revert "runner: simplify parser entrypoints in runner (#12233)"

This reverts commit 8d6fffaead.
This commit is contained in:
jmorganca
2025-09-12 13:32:02 -07:00
committed by Jeffrey Morgan
parent 053092185e
commit 9d56e63dbf
6 changed files with 77 additions and 173 deletions

View File

@@ -35,7 +35,6 @@ import (
"github.com/ollama/ollama/logutil"
"github.com/ollama/ollama/ml"
"github.com/ollama/ollama/model"
"github.com/ollama/ollama/parser"
)
type filteredEnv []string
@@ -1350,7 +1349,7 @@ type CompletionRequest struct {
Options *api.Options
Grammar string // set before sending the request to the subprocess
ParserType parser.TokenParserType
UseHarmony bool
PrefillString string
}
@@ -1364,6 +1363,8 @@ const (
DoneReasonLength
// DoneReasonConnectionClosed indicates the completion stopped due to the connection being closed
DoneReasonConnectionClosed
// DoneReasonTokenRepeatLimit indicates the completion stopped due to a token repeat limit
DoneReasonTokenRepeatLimit
)
func (d DoneReason) String() string {
@@ -1372,6 +1373,8 @@ func (d DoneReason) String() string {
return "length"
case DoneReasonStop:
return "stop"
case DoneReasonTokenRepeatLimit:
return "token_repeat_limit"
default:
return "" // closed
}