summaryrefslogtreecommitdiff
path: root/llm.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-02-21 16:31:59 +0300
committerGrail Finder <wohilas@gmail.com>2026-02-21 16:31:59 +0300
commiteedda0ec4b3ac5ce71b6b1bf28b76b3bcb65e7a4 (patch)
treed41e2d7b3333bd313617aefcb16ad1c806fbc250 /llm.go
parent96ffbd5cf53c448bdfc0d86f1e7e866a358e01bd (diff)
Feat (pull/18994): llama.cpp reasoning
Diffstat (limited to 'llm.go')
-rw-r--r--llm.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/llm.go b/llm.go
index bca9655..3da8488 100644
--- a/llm.go
+++ b/llm.go
@@ -237,8 +237,10 @@ func (op LCPChat) ParseChunk(data []byte) (*models.TextChunk, error) {
return &models.TextChunk{Finished: true}, nil
}
+ lastChoice := llmchunk.Choices[len(llmchunk.Choices)-1]
resp := &models.TextChunk{
- Chunk: llmchunk.Choices[len(llmchunk.Choices)-1].Delta.Content,
+ Chunk: lastChoice.Delta.Content,
+ Reasoning: lastChoice.Delta.ReasoningContent,
}
// Check for tool calls in all choices, not just the last one
@@ -256,7 +258,7 @@ func (op LCPChat) ParseChunk(data []byte) (*models.TextChunk, error) {
}
}
- if llmchunk.Choices[len(llmchunk.Choices)-1].FinishReason == "stop" {
+ if lastChoice.FinishReason == "stop" {
if resp.Chunk != "" {
logger.Error("text inside of finish llmchunk", "chunk", llmchunk)
}