Skip to content

Commit

Permalink
Add ai bot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FadhlanR committed Jan 8, 2025
1 parent b655c1b commit fc52784
Show file tree
Hide file tree
Showing 2 changed files with 416 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/ai-bot/tests/prompt-construction-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
APP_BOXEL_COMMAND_MSGTYPE,
APP_BOXEL_COMMAND_RESULT_EVENT_TYPE,
APP_BOXEL_COMMAND_RESULT_WITH_OUTPUT_MSGTYPE,
DEFAULT_LLM,
} from '@cardstack/runtime-common/matrix-constants';

import type {
Expand Down Expand Up @@ -1611,3 +1612,28 @@ test('Tools can be required to be called if done so in the last message', () =>
},
});
});

module('set model in prompt', () => {
test('default active LLM must be equal to `DEFAULT_LLM`', () => {
const eventList: DiscreteMatrixEvent[] = JSON.parse(
readFileSync(
path.join(
__dirname,
'resources/chats/required-tool-call-in-last-message.json',
),
),
);

const { model } = getPromptParts(eventList, '@aibot:localhost');
assert.strictEqual(model, DEFAULT_LLM);
});

test('use latest active llm', () => {
const eventList: DiscreteMatrixEvent[] = JSON.parse(
readFileSync(path.join(__dirname, 'resources/chats/set-active-llm.json')),
);

const { model } = getPromptParts(eventList, '@aibot:localhost');
assert.strictEqual(model, 'google/gemini-pro-1.5');
});
});
Loading

0 comments on commit fc52784

Please sign in to comment.