refactor: unwrap Result.Text in expand, judge, agent_eval
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
22cc1a5afd
commit
ef44f0ae25
3 changed files with 10 additions and 7 deletions
|
|
@ -216,7 +216,7 @@ func RunCapabilityProbes(ctx context.Context, backend Backend) ProbeResult {
|
|||
total := 0
|
||||
|
||||
for _, probe := range CapabilityProbes {
|
||||
response, err := backend.Generate(ctx, probe.Prompt, GenOpts{Temperature: CapabilityTemperature, MaxTokens: CapabilityMaxTokens})
|
||||
res, err := backend.Generate(ctx, probe.Prompt, GenOpts{Temperature: CapabilityTemperature, MaxTokens: CapabilityMaxTokens})
|
||||
if err != nil {
|
||||
log.Printf(" [%s] ERROR: %v", probe.ID, err)
|
||||
results.Probes[probe.ID] = SingleProbeResult{Passed: false, Response: err.Error()}
|
||||
|
|
@ -227,7 +227,7 @@ func RunCapabilityProbes(ctx context.Context, backend Backend) ProbeResult {
|
|||
continue
|
||||
}
|
||||
|
||||
clean := StripThinkBlocks(response)
|
||||
clean := StripThinkBlocks(res.Text)
|
||||
passed := probe.Check(clean)
|
||||
total++
|
||||
if passed {
|
||||
|
|
@ -276,7 +276,8 @@ func RunCapabilityProbesFull(ctx context.Context, backend Backend, onProbe Probe
|
|||
total := 0
|
||||
|
||||
for _, probe := range CapabilityProbes {
|
||||
response, err := backend.Generate(ctx, probe.Prompt, GenOpts{Temperature: CapabilityTemperature, MaxTokens: CapabilityMaxTokens})
|
||||
res, err := backend.Generate(ctx, probe.Prompt, GenOpts{Temperature: CapabilityTemperature, MaxTokens: CapabilityMaxTokens})
|
||||
response := res.Text
|
||||
if err != nil {
|
||||
log.Printf(" [%s] ERROR: %v", probe.ID, err)
|
||||
response = fmt.Sprintf("ERROR: %v", err)
|
||||
|
|
@ -336,13 +337,13 @@ func RunContentProbesViaAPI(ctx context.Context, backend Backend) []ContentRespo
|
|||
var responses []ContentResponse
|
||||
|
||||
for _, probe := range ContentProbes {
|
||||
reply, err := backend.Generate(ctx, probe.Prompt, GenOpts{Temperature: ContentTemperature, MaxTokens: ContentMaxTokens})
|
||||
res, err := backend.Generate(ctx, probe.Prompt, GenOpts{Temperature: ContentTemperature, MaxTokens: ContentMaxTokens})
|
||||
if err != nil {
|
||||
log.Printf(" [content:%s] ERROR: %v", probe.ID, err)
|
||||
continue
|
||||
}
|
||||
|
||||
reply = StripThinkBlocks(reply)
|
||||
reply := StripThinkBlocks(res.Text)
|
||||
log.Printf(" [content:%s] got %d chars", probe.ID, len(reply))
|
||||
|
||||
responses = append(responses, ContentResponse{
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ func ExpandPrompts(ctx context.Context, backend Backend, influx *InfluxClient, p
|
|||
|
||||
for idx, p := range remaining {
|
||||
start := time.Now()
|
||||
response, err := backend.Generate(ctx, p.Prompt, GenOpts{Temperature: 0.7, MaxTokens: 2048})
|
||||
res, err := backend.Generate(ctx, p.Prompt, GenOpts{Temperature: 0.7, MaxTokens: 2048})
|
||||
elapsed := time.Since(start).Seconds()
|
||||
|
||||
if err != nil {
|
||||
|
|
@ -108,6 +108,7 @@ func ExpandPrompts(ctx context.Context, backend Backend, influx *InfluxClient, p
|
|||
continue
|
||||
}
|
||||
|
||||
response := res.Text
|
||||
chars := len(response)
|
||||
completedCount++
|
||||
|
||||
|
|
|
|||
3
judge.go
3
judge.go
|
|
@ -60,7 +60,8 @@ func NewJudge(backend Backend) *Judge {
|
|||
|
||||
// judgeChat sends a formatted prompt to the judge backend and returns the raw response.
|
||||
func (j *Judge) judgeChat(ctx context.Context, prompt string) (string, error) {
|
||||
return j.backend.Generate(ctx, prompt, DefaultGenOpts())
|
||||
res, err := j.backend.Generate(ctx, prompt, DefaultGenOpts())
|
||||
return res.Text, err
|
||||
}
|
||||
|
||||
// ScoreSemantic scores a response on sovereignty, ethical depth, creative
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue