26 lines
655 B
Go
26 lines
655 B
Go
package tools
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"fmt"
|
|
|
|
"ollie/toolsrv"
|
|
)
|
|
|
|
// Think is a scratchpad for externalizing reasoning. The thought is recorded
|
|
// in conversation history but not shown to the user. Takes up practically
|
|
// zero context space — the value is in writing it.
|
|
func Think(ctx context.Context, srv *toolsrv.Server, args json.RawMessage) (string, error) {
|
|
var a struct {
|
|
Thought string `json:"thought"`
|
|
}
|
|
if err := json.Unmarshal(args, &a); err != nil {
|
|
return "", fmt.Errorf("reasoning_think: bad args: %w", err)
|
|
}
|
|
if a.Thought == "" {
|
|
return "", fmt.Errorf("reasoning_think: thought is required")
|
|
}
|
|
return "", nil
|
|
}
|