Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Return A Set Of Sources #86

Merged
merged 1 commit into from
May 14, 2024
Merged
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
11 changes: 6 additions & 5 deletions packages/ocular/src/approaches/ask-retrieve-read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
AppNameDefinitions,
} from "@ocular/types";
import { MessageBuilder } from "../utils/message";
import { Organisation } from "../models";
import { App, Organisation } from "../models";
import { OrganisationService } from "../services";

const SYSTEM_CHAT_TEMPLATE = `You are an intelligent assistant who can helps Engineers at Ocular with a variety of tasks. Use 'you' to refer to the individual asking the questions even if they ask with 'I'.
Expand Down Expand Up @@ -101,11 +101,12 @@ export default class AskRetrieveThenRead implements ISearchApproach {
}

// Add Sources To The Search Results
const org = await this.organisationService_.listInstalledApps();
const sources: AppNameDefinitions[] = org.installed_apps.map(
(app) => app.name as AppNameDefinitions
const sources = new Set(
searchResults.hits.map(
(hit) => hit.documentMetadata?.source as AppNameDefinitions
)
);
searchResults.sources = sources;
searchResults.sources = [...sources];
return searchResults;
}

Expand Down