Prepare structured D&D reference context
This commit is contained in:
@@ -131,15 +131,15 @@ func TestExtractPassesCampaignReferencesAsPromptInputs(t *testing.T) {
|
||||
req := extractionRequest()
|
||||
req.References = contracts.ReferenceSet{Slots: map[string]contracts.ResolvedReferenceSlot{
|
||||
"players": {Slot: contracts.ReferenceSlot{Name: "players"}, Items: []contracts.ReferenceItem{{SlotName: "players", Content: []byte("Dana: Mira")}}},
|
||||
"party": {Slot: contracts.ReferenceSlot{Name: "party"}, Items: []contracts.ReferenceItem{{SlotName: "party", Content: []byte("Mira: ranger")}}},
|
||||
"glossary": {Slot: contracts.ReferenceSlot{Name: "glossary"}, Items: []contracts.ReferenceItem{{SlotName: "glossary", Content: []byte("Greencloak: local title")}}},
|
||||
"party": {Slot: contracts.ReferenceSlot{Name: "party"}, Items: []contracts.ReferenceItem{{SlotName: "party", MediaType: "application/json", Content: []byte(`{"schema_version":"maximumdirect.rpg.party.v1","characters":{"m":{"character":{"name":"Mira","classes":[{"name":"ranger"}]}}}}`)}}},
|
||||
"glossary": {Slot: contracts.ReferenceSlot{Name: "glossary"}, Items: []contracts.ReferenceItem{{SlotName: "glossary", MediaType: "application/json", Content: []byte(`{"schema_version":"maximumdirect.glossary.v1","collections":{"campaign":{"entries":[{"id":"g","name":"Greencloak","category":"title","description":"local title"}]}}}`)}}},
|
||||
}}
|
||||
if _, err := runExtraction(context.Background(), newExtractor(t, client), req); err != nil {
|
||||
if _, err := runExtraction(context.Background(), newExtractor(t, client, req.References), req); err != nil {
|
||||
t.Fatalf("Extract() error = %v, want nil", err)
|
||||
}
|
||||
request := client.requests[0]
|
||||
references := messageContaining(t, request, "Dana: Mira").Content
|
||||
if !strings.Contains(references, "Mira: ranger") || !strings.Contains(references, "Greencloak: local title") {
|
||||
if !strings.Contains(references, "Mira") || !strings.Contains(references, "ranger") || !strings.Contains(references, "Greencloak") || !strings.Contains(references, "local title") {
|
||||
t.Fatal("campaign references missing")
|
||||
}
|
||||
if strings.Contains(messageContaining(t, request, string(req.Chunk.Content)).Content, "local title") {
|
||||
|
||||
Reference in New Issue
Block a user