Normalize private D&D response schema identities
This commit is contained in:
@@ -30,5 +30,5 @@ messages:
|
|||||||
output:
|
output:
|
||||||
format: json
|
format: json
|
||||||
validation_mode: json_schema
|
validation_mode: json_schema
|
||||||
schema_path: dnd_scenes.v1.json
|
schema_path: dnd_scenes_llm.v1.json
|
||||||
repair_attempts: 0
|
repair_attempts: 0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
"$id": "notarius.dnd.scenes",
|
"$id": "notarius.dnd.scenes.llm",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"required": ["scenes"],
|
"required": ["scenes"],
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||||
"$id": "notarius.dnd.spells",
|
"$id": "notarius.dnd.spells.llm",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"required": ["spell_casts"],
|
"required": ["spell_casts"],
|
||||||
|
|||||||
@@ -187,8 +187,8 @@ func TestRunManifestIncludesTopLevelModuleMetadata(t *testing.T) {
|
|||||||
"prompt_id": "dnd.scenes",
|
"prompt_id": "dnd.scenes",
|
||||||
"prompt_version": "v1",
|
"prompt_version": "v1",
|
||||||
"prompt_sha256": "sha256:abc123",
|
"prompt_sha256": "sha256:abc123",
|
||||||
"response_schema_key": "dnd_scenes",
|
"response_schema_key": "dnd_scenes_llm",
|
||||||
"response_schema_name": "dnd_scenes",
|
"response_schema_name": "notarius_dnd_scenes_llm_v1",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ func TestLookupResponseSchemaUnknownReturnsFalse(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLookupResponseSchemaDNDSpellsIsNotFrameworkRegistered(t *testing.T) {
|
func TestLookupResponseSchemaDNDSpellsLLMIsNotFrameworkRegistered(t *testing.T) {
|
||||||
if schema, ok := LookupResponseSchema("dnd_spells"); ok {
|
if schema, ok := LookupResponseSchema("dnd_spells_llm"); ok {
|
||||||
t.Fatalf("expected D&D spells schema lookup to fail in framework registry, got %+v", schema)
|
t.Fatalf("expected D&D spells schema lookup to fail in framework registry, got %+v", schema)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ func TestPromptAssetsPrepareTranscriptWithInstructionOrdering(t *testing.T) {
|
|||||||
if prepared.PromptID != PromptID {
|
if prepared.PromptID != PromptID {
|
||||||
t.Fatalf("prompt id = %q, want %q", prepared.PromptID, PromptID)
|
t.Fatalf("prompt id = %q, want %q", prepared.PromptID, PromptID)
|
||||||
}
|
}
|
||||||
|
if prepared.OutputContract.SchemaPath != "dnd_scenes_llm.v1.json" {
|
||||||
|
t.Fatalf("scene output schema path = %q, want private LLM schema", prepared.OutputContract.SchemaPath)
|
||||||
|
}
|
||||||
if len(prepared.Messages) < 4 {
|
if len(prepared.Messages) < 4 {
|
||||||
t.Fatalf("prepared messages = %#v, want system, references, instructions, and transcript", prepared.Messages)
|
t.Fatalf("prepared messages = %#v, want system, references, instructions, and transcript", prepared.Messages)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import "gitea.maximumdirect.net/eric/notarius/internal/framework/llm"
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
PromptID = "dnd.scenes"
|
PromptID = "dnd.scenes"
|
||||||
ResponseSchemaKey = llm.ResponseSchemaKey("dnd_scenes")
|
ResponseSchemaKey = llm.ResponseSchemaKey("dnd_scenes_llm")
|
||||||
ResponseSchemaID = "notarius.dnd.scenes"
|
ResponseSchemaID = "notarius.dnd.scenes.llm"
|
||||||
ResponseSchemaVersion = "v1"
|
ResponseSchemaVersion = "v1"
|
||||||
ResponseSchemaName = "notarius_dnd_scenes_v1"
|
ResponseSchemaName = "notarius_dnd_scenes_llm_v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func loadResponseSchema() (llm.ResponseSchema, error) {
|
func loadResponseSchema() (llm.ResponseSchema, error) {
|
||||||
@@ -20,6 +20,6 @@ func loadResponseSchema() (llm.ResponseSchema, error) {
|
|||||||
ID: ResponseSchemaID,
|
ID: ResponseSchemaID,
|
||||||
Version: ResponseSchemaVersion,
|
Version: ResponseSchemaVersion,
|
||||||
Name: ResponseSchemaName,
|
Name: ResponseSchemaName,
|
||||||
AssetPath: "schemas/dnd_scenes.v1.json",
|
AssetPath: "schemas/dnd_scenes_llm.v1.json",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,17 +15,17 @@ func TestLoadResponseSchemaForScenes(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("loadResponseSchema() error = %v, want nil", err)
|
t.Fatalf("loadResponseSchema() error = %v, want nil", err)
|
||||||
}
|
}
|
||||||
if schema.Key != ResponseSchemaKey {
|
if got, want := string(schema.Key), "dnd_scenes_llm"; got != want {
|
||||||
t.Fatalf("schema.Key = %q, want %q", schema.Key, ResponseSchemaKey)
|
t.Fatalf("schema.Key = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
if schema.ID != ResponseSchemaID {
|
if got, want := schema.ID, "notarius.dnd.scenes.llm"; got != want {
|
||||||
t.Fatalf("schema.ID = %q, want %q", schema.ID, ResponseSchemaID)
|
t.Fatalf("schema.ID = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
if schema.Version != ResponseSchemaVersion {
|
if got, want := schema.Version, "v1"; got != want {
|
||||||
t.Fatalf("schema.Version = %q, want %q", schema.Version, ResponseSchemaVersion)
|
t.Fatalf("schema.Version = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
if schema.Name != ResponseSchemaName {
|
if got, want := schema.Name, "notarius_dnd_scenes_llm_v1"; got != want {
|
||||||
t.Fatalf("schema.Name = %q, want %q", schema.Name, ResponseSchemaName)
|
t.Fatalf("schema.Name = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(schema.SHA256, "sha256:") {
|
if !strings.HasPrefix(schema.SHA256, "sha256:") {
|
||||||
t.Fatalf("schema.SHA256 = %q, want sha256 prefix", schema.SHA256)
|
t.Fatalf("schema.SHA256 = %q, want sha256 prefix", schema.SHA256)
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import "gitea.maximumdirect.net/eric/notarius/internal/framework/llm"
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
PromptID = "dnd.spells"
|
PromptID = "dnd.spells"
|
||||||
ResponseSchemaKey = llm.ResponseSchemaKey("dnd_spells")
|
ResponseSchemaKey = llm.ResponseSchemaKey("dnd_spells_llm")
|
||||||
ResponseSchemaID = "notarius.dnd.spells"
|
ResponseSchemaID = "notarius.dnd.spells.llm"
|
||||||
ResponseSchemaName = "notarius_dnd_spells_v1"
|
ResponseSchemaName = "notarius_dnd_spells_llm_v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func loadResponseSchema() (llm.ResponseSchema, error) {
|
func loadResponseSchema() (llm.ResponseSchema, error) {
|
||||||
|
|||||||
@@ -14,8 +14,17 @@ func TestLoadResponseSchemaUsesExtractorOwnedLLMSchema(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("loadResponseSchema() error = %v, want nil", err)
|
t.Fatalf("loadResponseSchema() error = %v, want nil", err)
|
||||||
}
|
}
|
||||||
if schema.Key != ResponseSchemaKey || schema.ID != ResponseSchemaID || schema.Version != SchemaVersion || schema.Name != ResponseSchemaName {
|
if got, want := string(schema.Key), "dnd_spells_llm"; got != want {
|
||||||
t.Fatalf("schema identity = %#v, want maintained response identity", schema)
|
t.Fatalf("schema key = %q, want %q", got, want)
|
||||||
|
}
|
||||||
|
if got, want := schema.ID, "notarius.dnd.spells.llm"; got != want {
|
||||||
|
t.Fatalf("schema ID = %q, want %q", got, want)
|
||||||
|
}
|
||||||
|
if got, want := schema.Version, "v1"; got != want {
|
||||||
|
t.Fatalf("schema version = %q, want %q", got, want)
|
||||||
|
}
|
||||||
|
if got, want := schema.Name, "notarius_dnd_spells_llm_v1"; got != want {
|
||||||
|
t.Fatalf("schema name = %q, want %q", got, want)
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(schema.SHA256, "sha256:") || !json.Valid(schema.JSONSchema) {
|
if !strings.HasPrefix(schema.SHA256, "sha256:") || !json.Valid(schema.JSONSchema) {
|
||||||
t.Fatalf("schema metadata = %#v, want valid hashed JSON", schema)
|
t.Fatalf("schema metadata = %#v, want valid hashed JSON", schema)
|
||||||
@@ -24,8 +33,8 @@ func TestLoadResponseSchemaUsesExtractorOwnedLLMSchema(t *testing.T) {
|
|||||||
if err := json.Unmarshal(schema.JSONSchema, &schemaDocument); err != nil {
|
if err := json.Unmarshal(schema.JSONSchema, &schemaDocument); err != nil {
|
||||||
t.Fatalf("Unmarshal(schema.JSONSchema) error = %v, want nil", err)
|
t.Fatalf("Unmarshal(schema.JSONSchema) error = %v, want nil", err)
|
||||||
}
|
}
|
||||||
if schemaDocument["$id"] != ResponseSchemaID {
|
if schemaDocument["$id"] != "notarius.dnd.spells.llm" {
|
||||||
t.Fatalf("schema $id = %#v, want %q", schemaDocument["$id"], ResponseSchemaID)
|
t.Fatalf("schema $id = %#v, want private LLM schema ID", schemaDocument["$id"])
|
||||||
}
|
}
|
||||||
|
|
||||||
valid := validSpellsResponse()
|
valid := validSpellsResponse()
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ func TestRegisterAddsDNDFamily(t *testing.T) {
|
|||||||
t.Fatalf("NPC interaction merge validator chain = %#v, want absent", got)
|
t.Fatalf("NPC interaction merge validator chain = %#v, want absent", got)
|
||||||
}
|
}
|
||||||
assertAssetNamesContain(t, assets.SchemaFS, []string{
|
assertAssetNamesContain(t, assets.SchemaFS, []string{
|
||||||
"dnd_scenes.v1.json",
|
"dnd_scenes_llm.v1.json",
|
||||||
"dnd_spells_llm.v1.json",
|
"dnd_spells_llm.v1.json",
|
||||||
"dnd_npcs_llm.v1.json",
|
"dnd_npcs_llm.v1.json",
|
||||||
"dnd_combat_turns_llm.v1.json",
|
"dnd_combat_turns_llm.v1.json",
|
||||||
|
|||||||
Reference in New Issue
Block a user