Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

fix(voice): give every Live tool schema a required list

LeoXing91d1bf861741
diff --git a/apps/teamhub/internal/voicelive/playground_test.go b/apps/teamhub/internal/voicelive/playground_test.go
index 8e96cb79..d1228658 100644
--- a/apps/teamhub/internal/voicelive/playground_test.go
+++ b/apps/teamhub/internal/voicelive/playground_test.go
@@ -1,6 +1,7 @@
package voicelive
import (
+ "encoding/json"
"strings"
"testing"
"time"
@@ -50,3 +51,21 @@ func TestHumanSize(t *testing.T) {
}
}
}
+
+// The realtime model rejects a session whose tool schema has a null required
+// list, so every tool spells an empty one.
+func TestEveryToolSchemaHasARequiredList(t *testing.T) {
+ for _, tool := range Tools {
+ encoded, err := json.Marshal(tool.Parameters)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var schema map[string]any
+ if err := json.Unmarshal(encoded, &schema); err != nil {
+ t.Fatal(err)
+ }
+ if _, ok := schema["required"].([]any); !ok {
+ t.Errorf("%s: required=%v", tool.Name, schema["required"])
+ }
+ }
+}
diff --git a/apps/teamhub/internal/voicelive/tools.go b/apps/teamhub/internal/voicelive/tools.go
index def0b495..936e1c0b 100644
--- a/apps/teamhub/internal/voicelive/tools.go
+++ b/apps/teamhub/internal/voicelive/tools.go
@@ -43,6 +43,10 @@ type Tool struct {
}
func objectSchema(required []string, properties map[string]any) map[string]any {
+ // The realtime model refuses the whole session for a null required list.
+ if required == nil {
+ required = []string{}
+ }
return map[string]any{"type": "object", "properties": properties, "required": required}
}