mirror of
https://github.com/sortedcord/omnia.git
synced 2026-07-22 12:02:49 +05:30
chore: Format files
This commit is contained in:
@@ -14,14 +14,15 @@ describe("GeminiProvider Eval", () => {
|
||||
});
|
||||
|
||||
const response = await provider.generateStructuredResponse({
|
||||
systemPrompt: "You are a helpful assistant. Classify the tone of the user's sentence.",
|
||||
systemPrompt:
|
||||
"You are a helpful assistant. Classify the tone of the user's sentence.",
|
||||
userContext: "I absolutely love this new engine, it works perfectly!",
|
||||
schema: ToneSchema,
|
||||
});
|
||||
|
||||
expect(response.success).toBe(true);
|
||||
expect(response.data).toBeDefined();
|
||||
|
||||
|
||||
const data = response.data!;
|
||||
expect(data.tone).toBe("positive");
|
||||
expect(data.confidence).toBeGreaterThan(0.8);
|
||||
|
||||
@@ -6,7 +6,7 @@ import { IntentDecoder } from "@omnia/intent";
|
||||
describe("IntentDecoder Live Eval (Tier 3)", () => {
|
||||
test("decodes real complex narrative prose using live Gemini API", async () => {
|
||||
expect(llmConfig.GOOGLE_API_KEY).toBeDefined();
|
||||
|
||||
|
||||
// 1. Initialize live provider and decoder
|
||||
const provider = new GeminiProvider(llmConfig.GOOGLE_API_KEY);
|
||||
const decoder = new IntentDecoder(provider);
|
||||
@@ -19,7 +19,8 @@ describe("IntentDecoder Live Eval (Tier 3)", () => {
|
||||
world.addEntity(bob);
|
||||
|
||||
// 3. Narrative prose containing both a dialogue and physical action
|
||||
const narrativeProse = '"Let\'s see if this key opens the main vault," Alice said to Bob. She slipped the silver key into the keyhole and turned it slowly.';
|
||||
const narrativeProse =
|
||||
'"Let\'s see if this key opens the main vault," Alice said to Bob. She slipped the silver key into the keyhole and turned it slowly.';
|
||||
|
||||
// 4. Decode prose using live Gemini model
|
||||
const result = await decoder.decode(world, "alice", narrativeProse);
|
||||
@@ -30,14 +31,16 @@ describe("IntentDecoder Live Eval (Tier 3)", () => {
|
||||
expect(result.intents.length).toBeGreaterThanOrEqual(1);
|
||||
|
||||
// Verify first intent is dialogue spoken to Bob
|
||||
const dialogueIntent = result.intents.find(i => i.type === "dialogue");
|
||||
const dialogueIntent = result.intents.find((i) => i.type === "dialogue");
|
||||
expect(dialogueIntent).toBeDefined();
|
||||
expect(dialogueIntent!.actorId).toBe("alice");
|
||||
expect(dialogueIntent!.targetIds).toContain("bob");
|
||||
expect(dialogueIntent!.originalText).toContain("Let's see if this key opens the main vault");
|
||||
expect(dialogueIntent!.originalText).toContain(
|
||||
"Let's see if this key opens the main vault",
|
||||
);
|
||||
|
||||
// Verify second intent is action
|
||||
const actionIntent = result.intents.find(i => i.type === "action");
|
||||
const actionIntent = result.intents.find((i) => i.type === "action");
|
||||
expect(actionIntent).toBeDefined();
|
||||
expect(actionIntent!.actorId).toBe("alice");
|
||||
expect(actionIntent!.originalText).toContain("slipped the silver key");
|
||||
@@ -45,28 +48,29 @@ describe("IntentDecoder Live Eval (Tier 3)", () => {
|
||||
|
||||
test("resolves targets correctly using the actor's subjective alias map", async () => {
|
||||
expect(llmConfig.GOOGLE_API_KEY).toBeDefined();
|
||||
|
||||
|
||||
const provider = new GeminiProvider(llmConfig.GOOGLE_API_KEY);
|
||||
const decoder = new IntentDecoder(provider);
|
||||
|
||||
const world = new WorldState("world-xyz");
|
||||
const alice = new Entity("alice");
|
||||
const bob = new Entity("bob");
|
||||
|
||||
|
||||
// Register alias mapping: Bob is known to Alice as "the hooded stranger"
|
||||
alice.aliases.set("bob", "the hooded stranger");
|
||||
|
||||
|
||||
world.addEntity(alice);
|
||||
world.addEntity(bob);
|
||||
|
||||
// Narrative prose referring to Bob only by the subjective alias
|
||||
const narrativeProse = "Alice handed the silver key to the hooded stranger.";
|
||||
const narrativeProse =
|
||||
"Alice handed the silver key to the hooded stranger.";
|
||||
|
||||
const result = await decoder.decode(world, "alice", narrativeProse);
|
||||
|
||||
expect(result.intents).toHaveLength(1);
|
||||
const intent = result.intents[0];
|
||||
|
||||
|
||||
expect(intent.type).toBe("action");
|
||||
expect(intent.actorId).toBe("alice");
|
||||
// Verify target resolution resolved the alias back to the correct system entity ID
|
||||
|
||||
Reference in New Issue
Block a user