mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
feat(verifier): read llm instructions off config
This commit is contained in:
1 parent
5fb01af59c
commit
d9d206ee00
2 files changed
+22
-1
No files matched your search
@@ -12,6 +12,9 @@ import (
|
|||||||
// read off globalThis.actions when the spec assigned `actions = llm({...})`.
|
// read off globalThis.actions when the spec assigned `actions = llm({...})`.
|
||||||
type LLMConfig struct {
|
type LLMConfig struct {
|
||||||
Model string
|
Model string
|
||||||
|
// Instructions is optional spec-level guidance appended to the prompt to
|
||||||
|
// steer the model toward bug-hunting (empty when unset).
|
||||||
|
Instructions string
|
||||||
}
|
}
|
||||||
|
|
||||||
// LLMConfig reports the LLM action backend config when the spec selected it
|
// LLMConfig reports the LLM action backend config when the spec selected it
|
||||||
@@ -42,7 +45,11 @@ func (v *Verifier) LLMConfig() (LLMConfig, bool) {
|
|||||||
if value := configObject.Get("model"); value != nil && !goja.IsUndefined(value) {
|
if value := configObject.Get("model"); value != nil && !goja.IsUndefined(value) {
|
||||||
model = value.String()
|
model = value.String()
|
||||||
}
|
}
|
||||||
return LLMConfig{Model: model}, true
|
instructions := ""
|
||||||
|
if value := configObject.Get("instructions"); value != nil && !goja.IsUndefined(value) && !goja.IsNull(value) {
|
||||||
|
instructions = value.String()
|
||||||
|
}
|
||||||
|
return LLMConfig{Model: model, Instructions: instructions}, true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Screenshot returns the most recent step's screenshot PNG (set by
|
// Screenshot returns the most recent step's screenshot PNG (set by
|
||||||
|
|||||||
@@ -96,6 +96,20 @@ func TestLLMConfigDetectsMarker(t *testing.T) {
|
|||||||
if config.Model != "vendor/model" {
|
if config.Model != "vendor/model" {
|
||||||
t.Errorf("model = %q, want vendor/model", config.Model)
|
t.Errorf("model = %q, want vendor/model", config.Model)
|
||||||
}
|
}
|
||||||
|
if config.Instructions != "" {
|
||||||
|
t.Errorf("instructions = %q, want empty when unset", config.Instructions)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLLMConfigReadsInstructions(t *testing.T) {
|
||||||
|
v := newLoadedVerifier(t, `globalThis.actions = { kind: "llm", config: { model: "m", instructions: "find bugs" } };`)
|
||||||
|
config, ok := v.LLMConfig()
|
||||||
|
if !ok {
|
||||||
|
t.Fatal("LLMConfig not detected")
|
||||||
|
}
|
||||||
|
if config.Instructions != "find bugs" {
|
||||||
|
t.Errorf("instructions = %q, want %q", config.Instructions, "find bugs")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLLMConfigAbsentForSeededSpec(t *testing.T) {
|
func TestLLMConfigAbsentForSeededSpec(t *testing.T) {
|
||||||
|
|||||||
Reference in new issue
Block a user