-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.go
More file actions
52 lines (42 loc) · 1.27 KB
/
errors.go
File metadata and controls
52 lines (42 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package wise
import (
"errors"
"fmt"
)
// Domain errors.
var (
ErrModelRequired = errors.New("model is required")
ErrEnvironmentRequired = errors.New("environment is required")
)
// TerminationReason indicates why the agent stopped.
type TerminationReason string
const (
ReasonComplete TerminationReason = "complete"
ReasonStepLimit TerminationReason = "step_limit"
ReasonCostLimit TerminationReason = "cost_limit"
ReasonUserAbort TerminationReason = "user_abort"
)
// TerminatingErr signals the agent should stop the loop.
type TerminatingErr struct {
Reason TerminationReason
Output string // Optional final output
}
func (e *TerminatingErr) Error() string {
return fmt.Sprintf("terminating: %s", e.Reason)
}
// ProcessErrType indicates the type of recoverable error.
type ProcessErrType string
const (
ProcessErrFormat ProcessErrType = "format"
ProcessErrTimeout ProcessErrType = "timeout"
ProcessErrExecution ProcessErrType = "execution"
)
// ProcessErr signals a recoverable error. The agent should add
// feedback to messages and continue the loop.
type ProcessErr struct {
Type ProcessErrType
Message string // Feedback to add to conversation
}
func (e *ProcessErr) Error() string {
return fmt.Sprintf("process error [%s]: %s", e.Type, e.Message)
}