Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable summarisation spec #199134

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
ObservabilityAIAssistantPluginSetupDependencies,
ObservabilityAIAssistantPluginStartDependencies,
} from './types';
import { addLensDocsToKb } from './service/knowledge_base_service/kb_docs/lens';
import { registerFunctions } from './functions';
import { recallRankingEvent } from './analytics/recall_ranking';
import { initLangtrace } from './service/client/instrumentation/init_langtrace';
Expand Down Expand Up @@ -164,10 +163,6 @@ export class ObservabilityAIAssistantPlugin

service.register(registerFunctions);

if (this.config.enableKnowledgeBase) {
addLensDocsToKb({ service, logger: this.logger.get('kb').get('lens') });
}
Comment on lines -167 to -169
Copy link
Member Author

@sorenlouv sorenlouv Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removed to make testing easier. Right now Lens docs are imported automatically and pollutes tests. In order not to bother with this I simply got rid of it.
It will be properly removed (and cleaned up) in #191043


registerServerRoutes({
core,
logger: this.logger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,32 @@ import {
createProxyActionConnector,
deleteActionConnector,
} from '../../../common/action_connectors';
import {
clearKnowledgeBase,
createKnowledgeBaseModel,
deleteKnowledgeBaseModel,
} from '../../knowledge_base/helpers';

export default function ApiTest({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
const log = getService('log');
const ml = getService('ml');
const es = getService('es');
const observabilityAIAssistantAPIClient = getService('observabilityAIAssistantAPIClient');

// Skipped until Elser is available in tests
describe.skip('when calling summarize function', () => {
describe('when calling summarize function', () => {
let proxy: LlmProxy;
let connectorId: string;

before(async () => {
await clearKnowledgeBase(es);
await createKnowledgeBaseModel(ml);
await observabilityAIAssistantAPIClient
.editorUser({
endpoint: 'POST /internal/observability_ai_assistant/kb/setup',
})
.expect(200);

proxy = await createLlmProxy(log);
connectorId = await createProxyActionConnector({ supertest, log, port: proxy.getPort() });

Expand All @@ -44,7 +58,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
id: 'my-id',
text: 'Hello world',
is_correction: false,
confidence: 1,
confidence: 'high',
public: false,
}),
},
Expand All @@ -55,7 +69,9 @@ export default function ApiTest({ getService }: FtrProviderContext) {

after(async () => {
proxy.close();

await deleteActionConnector({ supertest, connectorId, log });
await deleteKnowledgeBaseModel(ml);
});

it('persists entry in knowledge base', async () => {
Expand All @@ -70,6 +86,14 @@ export default function ApiTest({ getService }: FtrProviderContext) {
},
});

const { role, public: isPublic, text, type, user, id } = res.body.entries[0];

expect(role).to.eql('assistant_summarization');
expect(isPublic).to.eql(false);
expect(text).to.eql('Hello world');
expect(type).to.eql('contextual');
expect(user?.name).to.eql('editor');
expect(id).to.eql('my-id');
expect(res.body.entries).to.have.length(1);
});
});
Expand Down