phraser: move errEmptyResponse next to its only caller (V-397)
It sat in world.go, which is about the workstation model; it is a phrasing error and belongs in llmphraser.go. Also trims the PhraseQuery doc. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
@@ -26,6 +27,11 @@ import (
|
|||||||
|
|
||||||
var listenRE = regexp.MustCompile(`listening on (https?://\S+)`)
|
var listenRE = regexp.MustCompile(`listening on (https?://\S+)`)
|
||||||
|
|
||||||
|
// errEmptyResponse — the server answered and said nothing. Separate from a
|
||||||
|
// transport failure: the model is up and produced no tokens, which is still not
|
||||||
|
// an answer and must not score as one.
|
||||||
|
var errEmptyResponse = errors.New("phraser: empty response from the model")
|
||||||
|
|
||||||
type LLMPhraser struct {
|
type LLMPhraser struct {
|
||||||
cfg Config
|
cfg Config
|
||||||
client *http.Client
|
client *http.Client
|
||||||
@@ -428,10 +434,10 @@ func (p *LLMPhraser) PhraseNudge(ctx context.Context, c loop.Candidate) (deliver
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PhraseQuery prompts the LLM with the user's utterance and matching notes to
|
// PhraseQuery prompts the LLM with the user's utterance and matching notes to
|
||||||
// compose a natural answer. On any LLM error it returns BOTH the fallback text
|
// compose a natural answer. On any LLM error it returns the fallback text —
|
||||||
// ("вот что я нашла: <notes>", or "не знаю." with no notes) AND the error, so a
|
// "вот что я нашла: <notes>", or "не знаю." with no notes — and the error
|
||||||
// caller that wants to keep the turn alive uses the text and a caller that is
|
// together. The daemon uses the text and keeps the turn alive; a caller that is
|
||||||
// measuring counts the failure. Until Vikunja #397 the error was swallowed and a
|
// measuring counts the failure. Until Vikunja #397 the error was dropped, so a
|
||||||
// dead server scored as bad phrasing.
|
// dead server scored as bad phrasing.
|
||||||
func (p *LLMPhraser) PhraseQuery(ctx context.Context, utterance string, notes []string) (string, error) {
|
func (p *LLMPhraser) PhraseQuery(ctx context.Context, utterance string, notes []string) (string, error) {
|
||||||
// Blank sources are no sources. A caller that hands over one empty string —
|
// Blank sources are no sources. A caller that hands over one empty string —
|
||||||
|
|||||||
@@ -37,11 +37,6 @@ type Remote interface {
|
|||||||
// (docs/evals/2026-08-02-workstation-gemma4-12b.md).
|
// (docs/evals/2026-08-02-workstation-gemma4-12b.md).
|
||||||
var ErrNoWorldModel = errors.New("phraser: no world model available")
|
var ErrNoWorldModel = errors.New("phraser: no world model available")
|
||||||
|
|
||||||
// errEmptyResponse — the server answered and said nothing. A separate error from
|
|
||||||
// a transport failure because it means the model is up and produced no tokens,
|
|
||||||
// which is still not an answer and must not score as one.
|
|
||||||
var errEmptyResponse = errors.New("phraser: empty response from the model")
|
|
||||||
|
|
||||||
// chatTemperature — what the phraser's own transport has always sampled at.
|
// chatTemperature — what the phraser's own transport has always sampled at.
|
||||||
// Named so the remote path cannot drift from it silently. Whether 0.7 is right
|
// Named so the remote path cannot drift from it silently. Whether 0.7 is right
|
||||||
// at all is Vikunja #402, and answering that here would hide a phrasing change
|
// at all is Vikunja #402, and answering that here would hide a phrasing change
|
||||||
|
|||||||
Reference in New Issue
Block a user