DOCS / INTEGRATIONS
하나의 NPC 메모리 흐름, 여섯 가지 연동 경로
모든 예제는 같은 시나리오를 사용합니다. NPC 엔티티를 만들고, witness 이벤트를 기록하고, 다음 대화 턴 전에 컨텍스트를 회수합니다.
루프를 검증하는 단계라면 raw HTTP부터 시작하고, recall 단계가 런타임 안에 들어가면 JavaScript, Python, Unity, Unreal, Godot 쪽으로 올리면 됩니다.
시나리오
여관 주인 Mira가 해질녘 old gate에서 플레이어가 떠나는 장면을 봅니다. 다음 턴에서 게임은 지금 Mira가 무엇을 알고 있는지 Seizn에 묻습니다.
Raw HTTP
가장 짧은 통합 경로를 위한 직접 API 호출입니다.
curl -X POST https://seizn.com/api/v1/graph/$GRAPH_ID/entities \
-H "Authorization: Bearer $SEIZN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"type":"character","name":"Mira","external_id":"npc_mira"}'
curl -X POST https://seizn.com/api/v1/graph/$GRAPH_ID/extract \
-H "Authorization: Bearer $SEIZN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Mira saw the player leave the old gate at dusk."}'
curl -X POST https://seizn.com/api/v1/graph/$GRAPH_ID/context \
-H "Authorization: Bearer $SEIZN_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query":"What does Mira know about the player?","max_entities":8}'JavaScript
다음 대화 턴 직전에 넣는 얇은 서버 래퍼 예제입니다.
const headers = {
Authorization: `Bearer ${process.env.SEIZN_API_KEY}`,
"Content-Type": "application/json",
};
await fetch(`https://seizn.com/api/v1/graph/${graphId}/entities`, {
method: "POST", headers,
body: JSON.stringify({ type: "character", name: "Mira", external_id: "npc_mira" }),
});
await fetch(`https://seizn.com/api/v1/graph/${graphId}/extract`, {
method: "POST", headers,
body: JSON.stringify({ text: "Mira saw the player leave the old gate at dusk." }),
});
const context = await fetch(`https://seizn.com/api/v1/graph/${graphId}/context`, {
method: "POST", headers,
body: JSON.stringify({ query: "What does Mira know about the player?", max_entities: 8 }),
}).then((r) => r.json());Python
툴링, 시뮬레이션 백엔드, 퀘스트 서비스에 맞는 서버 권한 루프입니다.
import requests
headers = {
"Authorization": f"Bearer {SEIZN_API_KEY}",
"Content-Type": "application/json",
}
requests.post(f"{BASE}/api/v1/graph/{graph_id}/entities", headers=headers, json={
"type": "character", "name": "Mira", "external_id": "npc_mira"
})
requests.post(f"{BASE}/api/v1/graph/{graph_id}/extract", headers=headers, json={
"text": "Mira saw the player leave the old gate at dusk."
})
context = requests.post(f"{BASE}/api/v1/graph/{graph_id}/context", headers=headers, json={
"query": "What does Mira know about the player?", "max_entities": 8
}).json()Unity C#
다음 bark나 dialogue node 직전에 부르는 얇은 클라이언트 래퍼 예제입니다.
var client = new SeiznClient(baseUrl, apiKey, graphId);
await client.UpsertEntity(new SeiznEntity {
Type = "character",
Name = "Mira",
ExternalId = "npc_mira"
});
await client.ExtractAsync("Mira saw the player leave the old gate at dusk.");
var context = await client.BuildContextAsync(
"What does Mira know about the player?",
maxEntities: 8,
maxDepth: 2
);
dialogueRunner.SetMemoryContext(context.SubgraphDescription);Godot GDScript
대화 턴이나 behavior tree 스크립트에서 Seizn을 호출합니다.
var client := SeiznClient.new(base_url, api_key, graph_id)
await client.upsert_entity({
"type": "character",
"name": "Mira",
"external_id": "npc_mira"
})
await client.extract("Mira saw the player leave the old gate at dusk.")
var context = await client.build_context(
"What does Mira know about the player?",
8,
2
)
dialogue_state.memory_context = context.subgraph_descriptionUnreal C++
같은 세 호출을 게임플레이 클라이언트 뒤에 감싼 예제입니다.
FSeiznClient Client(BaseUrl, ApiKey, GraphId);
co_await Client.UpsertEntity({
TEXT("character"),
TEXT("Mira"),
TEXT("npc_mira")
});
co_await Client.Extract(TEXT("Mira saw the player leave the old gate at dusk."));
const FSeiznContext Context = co_await Client.BuildContext(
TEXT("What does Mira know about the player?"),
8,
2
);
DialogueSubsystem->SetMemoryContext(Context.SubgraphDescription);정확한 레퍼런스도 같이 필요하신가요?
정확한 request schema는 API reference에서 보고, 루프가 맞으면 그다음 pricing으로 넘어가면 됩니다.