Skip to content

Commit

Permalink
Run linter
Browse files Browse the repository at this point in the history
  • Loading branch information
Corina Gum committed Jul 23, 2024
1 parent 5a0923f commit 67fafd6
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 30 deletions.
28 changes: 16 additions & 12 deletions js/packages/teams-ai/src/augmentations/SequenceAugmentation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,14 @@ describe('SequenceAugmentation', () => {
content: validation.value,
context: {
intent: 'to test citations',
citations: [{
url: '',
title: '',
filepath: '',
content: 'my citation content...'
}]
citations: [
{
url: '',
title: '',
filepath: '',
content: 'my citation content...'
}
]
}
}
});
Expand All @@ -272,12 +274,14 @@ describe('SequenceAugmentation', () => {
content: 'hello world',
context: {
intent: 'to test citations',
citations: [{
url: '',
title: '',
filepath: '',
content: 'my citation content...'
}]
citations: [
{
url: '',
title: '',
filepath: '',
content: 'my citation content...'
}
]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe('BotAuthenticationBase.ts utility functions', () => {
assert(context.activity.value['settingName'] == settingName);
assert(context.activity.value['testProperty'] == 'testValue');
});
})
});

describe('setUserInSignInFlow()', async () => {
it('should set user in sign in flow', async () => {
Expand Down
2 changes: 1 addition & 1 deletion js/packages/teams-ai/src/external/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
* Licensed under the MIT License.
*/

export * from './strict-event-emitter-types';
export * from './strict-event-emitter-types';
28 changes: 18 additions & 10 deletions js/packages/teams-ai/src/models/TestModel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ import { GPTTokenizer } from '../tokenizers';
import { TestTurnState } from '../internals/testing/TestTurnState';
import { Prompt, PromptTemplate, PromptTemplateConfig, UserMessage } from '../prompts';

describe('TestModel', function() {
describe('TestModel', function () {
const adapter = new TestAdapter();
const functions = new TestPromptManager();
const tokenizer = new GPTTokenizer();
const prompt: PromptTemplate = {
name: 'test',
prompt: new Prompt([
new UserMessage('hello')
]),
prompt: new Prompt([new UserMessage('hello')]),
config: {} as PromptTemplateConfig
};

describe('factories', () => {
it('should factory a TestModel instance using a handler', async () => {
const model = TestModel.createTestModel(_ => Promise.resolve({ status: 'success', message: { role: 'assistant', content: 'hello world' } }));
const model = TestModel.createTestModel((_) =>
Promise.resolve({ status: 'success', message: { role: 'assistant', content: 'hello world' } })
);
assert(model, 'model should not be null');
assert(model.events, 'model.events should not be null');
});
Expand Down Expand Up @@ -66,7 +66,11 @@ describe('TestModel', function() {
assert.equal(response.status, 'success', 'response.status should be "success"');
assert(response.message, 'response.message should not be null');
assert.equal(response.message.role, 'assistant', 'response.message.role should be "assistant"');
assert.equal(response.message.content, 'hi! how are you?', 'response.message.content should be "hi! how are you?"');
assert.equal(
response.message.content,
'hi! how are you?',
'response.message.content should be "hi! how are you?"'
);
});
});

Expand All @@ -92,7 +96,7 @@ describe('TestModel', function() {
assert(response.error, 'response.error should not be null');
assert.equal(response.error.message, 'test error', 'response.error.message should be "test error"');
});
});
});

it('should fire events when completing a prompt', async () => {
await adapter.sendTextToBot('test', async (context) => {
Expand Down Expand Up @@ -138,7 +142,11 @@ describe('TestModel', function() {
assert(memory, 'memory should not be null');
assert(chunk, 'chunk should not be null');
assert(chunk.delta, 'chunk.delta should not be null');
assert.equal(chunk.delta.role, chunksReceived == 0 ? 'assistant' : undefined, 'chunk.delta.role should be "assistant"');
assert.equal(
chunk.delta.role,
chunksReceived == 0 ? 'assistant' : undefined,
'chunk.delta.role should be "assistant"'
);
assert.equal(chunk.delta.content, chunks[chunksReceived], 'chunk.delta.content should match');
chunksReceived++;
});
Expand All @@ -157,4 +165,4 @@ describe('TestModel', function() {
});
});
});
});
});
10 changes: 4 additions & 6 deletions js/packages/teams-ai/src/planners/LLMClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ import { Prompt, PromptTemplate, PromptTemplateConfig, UserMessage } from '../pr
import { JSONResponseValidator } from '../validators';
import { TestTurnState } from '../internals/testing/TestTurnState';

describe('LLMClient', function() {
describe('LLMClient', function () {
const functions = new TestPromptManager();
const tokenizer = new GPTTokenizer();
const validator = new JSONResponseValidator();
const template: PromptTemplate = {
name: 'test',
prompt: new Prompt([
new UserMessage('hello')
]),
prompt: new Prompt([new UserMessage('hello')]),
config: {} as PromptTemplateConfig
};
const model = TestModel.returnContent('hi! how are you?');
Expand Down Expand Up @@ -44,7 +42,7 @@ describe('LLMClient', function() {
max_repair_attempts: 11,
tokenizer,
validator,
logRepairs: true,
logRepairs: true
});
assert(client, 'client should not be null');
assert.equal(client.options.model, model, 'model should match');
Expand Down Expand Up @@ -92,7 +90,7 @@ describe('LLMClient', function() {
assert.equal(response.error.message, 'some error occurred!', 'response error message should match');
});
});

it('should successfully complete a streaming prompt', async () => {
const adapter = new TestAdapter();
await adapter.sendTextToBot('hello', async (context) => {
Expand Down

0 comments on commit 67fafd6

Please sign in to comment.