Skip to main content

KnowledgeBox

@nuclia/core


@nuclia/core / KnowledgeBox

Class: KnowledgeBox

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:96

Provides access to all the Knowledge Box contents and services in read mode.

For any Knowledge Box operation that requires write access, you need to use WritableKnowledgeBox instead.

Extends​

Extended by​

Implements​

Constructors​

Constructor​

new KnowledgeBox(nuclia, account, data): KnowledgeBox

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:154

Parameters​

nuclia​

INuclia

account​

string

data​

IKnowledgeBoxBase | IKnowledgeBoxStandalone

Returns​

KnowledgeBox

Inherited from​

IKnowledgeBox.constructor

Properties​

accountId​

accountId: string

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:104


allowed_ip_addresses?​

optional allowed_ip_addresses?: string[] | null

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:40

Implementation of​

IKnowledgeBox.allowed_ip_addresses

Inherited from​

IKnowledgeBox.allowed_ip_addresses


allowed_origins?​

optional allowed_origins?: string[] | null

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:39

Implementation of​

IKnowledgeBox.allowed_origins

Inherited from​

IKnowledgeBox.allowed_origins


created?​

optional created?: string

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:38

Implementation of​

IKnowledgeBox.created

Inherited from​

IKnowledgeBox.created


description?​

optional description?: string

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:36

Implementation of​

IKnowledgeBox.description

Inherited from​

IKnowledgeBox.description


enforce_security?​

optional enforce_security?: boolean

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:44

Implementation of​

IKnowledgeBox.enforce_security

Inherited from​

IKnowledgeBox.enforce_security


external_index_provider?​

optional external_index_provider?: string

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:45

Implementation of​

IKnowledgeBox.external_index_provider

Inherited from​

IKnowledgeBox.external_index_provider


hidden_resources_enabled?​

optional hidden_resources_enabled?: boolean

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:42

Implementation of​

IKnowledgeBox.hidden_resources_enabled

Inherited from​

IKnowledgeBox.hidden_resources_enabled


hidden_resources_hide_on_creation?​

optional hidden_resources_hide_on_creation?: boolean

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:43

Implementation of​

IKnowledgeBox.hidden_resources_hide_on_creation

Inherited from​

IKnowledgeBox.hidden_resources_hide_on_creation


id​

id: string

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:32

Implementation of​

IKnowledgeBox.id

Inherited from​

IKnowledgeBox.id


nuclia​

protected nuclia: INuclia

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:105


search_configs?​

optional search_configs?: object

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:41

Index Signature​

[key: string]: any

Implementation of​

IKnowledgeBox.search_configs

Inherited from​

IKnowledgeBox.search_configs


slug​

slug: string

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:33

Implementation of​

IKnowledgeBox.slug

Inherited from​

IKnowledgeBox.slug


state?​

optional state?: KBStates

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:35

Implementation of​

IKnowledgeBox.state

Inherited from​

IKnowledgeBox.state


title​

title: string

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:34

Implementation of​

IKnowledgeBox.title

Inherited from​

IKnowledgeBox.title


zone​

zone: string

Defined in: libs/sdk-core/src/lib/db/kb/kb.models.ts:37

Implementation of​

IKnowledgeBox.zone

Inherited from​

IKnowledgeBox.zone

Accessors​

fullpath​

Get Signature​

get fullpath(): string

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:150

The Knowledge Box fullpath on the regional API.

Example: https://europe-1.dp.progress.cloud/api/v1/kb/3cce4a71-9cb9-4fda-beee-8a1512616bf0

Returns​

string

Implementation of​

IKnowledgeBox.fullpath

Inherited from​

IKnowledgeBox.fullpath


path​

Get Signature​

get path(): string

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:141

The Knowledge Box path on the regional API.

Example: /v1/kb/3cce4a71-9cb9-4fda-beee-8a1512616bf0

Returns​

string

Implementation of​

IKnowledgeBox.path

Inherited from​

IKnowledgeBox.path

Methods​

ask()​

Call Signature​

ask(query, context?, features?, options?): Observable<Answer | IErrorResponse>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:374

Retrieves a generative answer for the given query.

The generative answer is a text that is generated chunk by chunk by the language model. It is retrieved through a readable HTTP stream, so the chat() method returns an Observable emitting a value each time a new chunk is available. The incomplete attribute of the emitted value indicates if the asnwer is complete or not.

Example:

 nuclia.knowledgeBox
.ask('where does the Little Prince live')
.pipe(filter((answer) => !answer.incomplete))
.subscribe((answer) => {
console.log(answer.text);
});
Parameters​
query​

string

context?​

ContextEntry[]

features?​

Features[]

options?​

ChatOptions

Returns​

Observable<Answer | IErrorResponse>

Inherited from​

IKnowledgeBox.ask

Call Signature​

ask(query, context?, features?, options?, callback?): Observable<null>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:380

Retrieves a generative answer for the given query.

The generative answer is a text that is generated chunk by chunk by the language model. It is retrieved through a readable HTTP stream, so the chat() method returns an Observable emitting a value each time a new chunk is available. The incomplete attribute of the emitted value indicates if the asnwer is complete or not.

Example:

 nuclia.knowledgeBox
.ask('where does the Little Prince live')
.pipe(filter((answer) => !answer.incomplete))
.subscribe((answer) => {
console.log(answer.text);
});
Parameters​
query​

string

context?​

ContextEntry[]

features?​

Features[]

options?​

ChatOptions

callback?​

(answer) => void

Returns​

Observable<null>

Inherited from​

IKnowledgeBox.ask


askViaWS()​

askViaWS(agenticConfigId, question, keepOpen?, searchConfiguration?, groups?, chatHistory?): Observable<IErrorResponse | AragResponse>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:958

Asks a question using an agentic pipeline (Rephrase → SmartAgent → Summarize) over WebSocket.

Requires an agentic_config_id that has been created via createAgenticConfig(). Set keepOpen: true to keep the connection open for follow-up questions.

Parameters​

agenticConfigId​

string

question​

string

keepOpen?​

boolean = false

searchConfiguration?​

string

groups?​

string[]

chatHistory?​

HistoryEntry[]

Returns​

Observable<IErrorResponse | AragResponse>

Inherited from​

IKnowledgeBox.askViaWS


catalog()​

catalog(query, options?): Observable<IErrorResponse | Results>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:652

Parameters​

query​

string | CatalogQuery

options?​

CatalogOptions

Returns​

Observable<IErrorResponse | Results>

Inherited from​

IKnowledgeBox.catalog


counters()​

counters(): Observable<Counters>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:677

Returns totals for each kind of contents stored in the Knowledge Box (resources, fields, paragraphs, vectors)

Returns​

Observable<Counters>

Inherited from​

IKnowledgeBox.counters


createAgenticRAGPipeline()​

createAgenticRAGPipeline(steps): Pipeline

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:352

Parameters​

steps​

Steps

Returns​

Pipeline

Inherited from​

IKnowledgeBox.createAgenticRAGPipeline


feedback()​

feedback(answerId, good, feedback?, text_block_id?): Observable<void>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:666

Parameters​

answerId​

string

good​

boolean

feedback?​

string = ''

text_block_id?​

string

Returns​

Observable<void>

Inherited from​

IKnowledgeBox.feedback


find()​

find(query, features?, options?): Observable<FindResults | IErrorResponse>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:414

Performs a find operation in the Knowledge Box, which is the recommended way to search for results.

Example:

nuclia.knowledgeBox
.find('where does the Little Prince live')
.subscribe((searchResult) => {
console.log('search result', searchResult);
});

Parameters​

query​

string

features?​

Features[] = []

options?​

SearchOptions

Returns​

Observable<FindResults | IErrorResponse>

Inherited from​

IKnowledgeBox.find


generate()​

generate(question, context?): Observable<{ answer: string; cannotAnswer: boolean; }>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:536

Performs a question answering operation based on a given context.

Example:

nuclia.knowledgeBox
.generate('Who is Eric from Toronto?', [
'Eric is a taxi driver',
'Eric was born in France',
'Eric lives in Toronto',
]))
.subscribe(({ answer }) => {
console.log('answer', answer);
});

Parameters​

question​

string

context?​

string[] = []

Returns​

Observable<{ answer: string; cannotAnswer: boolean; }>

Inherited from​

IKnowledgeBox.generate


generateJSON()​

generateJSON(question, json_schema, context?): Observable<{ answer: object; success: boolean; }>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:580

Performs a question answering operation using a JSON schema.

Example:

nuclia.knowledgeBox
.generateJSON(
'Who is Eric from Toronto?',
{
name: 'info',
parameters: {
properties: {
location: {
title: 'Location',
description: 'The location of the person',
type: 'string',
},
name: {
title: 'Name',
description: 'The name of the person',
type: 'string',
},
},
required: ['name', 'location'],
},
},
[
'Eric is a taxi driver',
'Eric was born in France',
'Eric lives in Toronto',
],
)).subscribe((answer) => {
console.log('location', answer.answer.location);
});

Parameters​

question​

string

json_schema​

object

context?​

string[] = []

Returns​

Observable<{ answer: object; success: boolean; }>

Inherited from​

IKnowledgeBox.generateJSON


generateRandomQuestionAboutResource()​

generateRandomQuestionAboutResource(resource): Observable<string>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:626

Generates a random question about the given resource. It picks an entities relation from the extracted metadata and generates a question about it. It returns an empty string if no question can be generated. Example:

 nuclia.knowledgeBox
.getResource('09a94719a6444c5a9689394f6ed9baf6', [ResourceProperties.EXTRACTED], [ExtractedDataTypes.METADATA])
.pipe(
switchMap((resource) => knowledgeBox.generateRandomQuestionAboutResource(resource)),
)
.subscribe((question) => {
console.log('question', question);
});

Parameters​

resource​

Resource

Returns​

Observable<string>

Inherited from​

IKnowledgeBox.generateRandomQuestionAboutResource


getAgenticConfig()​

getAgenticConfig(id): Observable<AgenticConfig>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:932

Parameters​

id​

string

Returns​

Observable<AgenticConfig>

Inherited from​

IKnowledgeBox.getAgenticConfig


getAgenticConfigsSchema()​

getAgenticConfigsSchema(): Observable<LearningConfigurationSchema>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:940

Returns​

Observable<LearningConfigurationSchema>


getAgenticSource()​

getAgenticSource(id): Observable<AgenticSource>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:944

Parameters​

id​

string

Returns​

Observable<AgenticSource>

Inherited from​

IKnowledgeBox.getAgenticSource


getConfiguration()​

getConfiguration(): Observable<{[id: string]: any; }>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:740

Returns​

Observable<{[id: string]: any; }>

Inherited from​

IKnowledgeBox.getConfiguration


getEntities()​

getEntities(): Observable<Entities>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:173

Returns all the NER families defined in the Knowledge Box.

Returns​

Observable<Entities>

Inherited from​

IKnowledgeBox.getEntities


getEntitiesGroup()​

getEntitiesGroup(groupId): Observable<EntitiesGroup>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:178

Returns the NER family with the given id.

Parameters​

groupId​

string

Returns​

Observable<EntitiesGroup>

Inherited from​

IKnowledgeBox.getEntitiesGroup


getExtractStrategies()​

getExtractStrategies(): Observable<ExtractStrategies>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:916

Returns​

Observable<ExtractStrategies>

Inherited from​

IKnowledgeBox.getExtractStrategies


getFacets()​

getFacets(facets): Observable<FacetsResult>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:205

Get the total amount of matches in the Knowledge Box for specific criteria (facets) passed in argument

Parameters​

facets​

string[]

List of facets to request

Returns​

Observable<FacetsResult>

An observable containing an object where each key is a string and maps to an object containing values and their corresponding counts.

Inherited from​

IKnowledgeBox.getFacets


getFullResource()​

getFullResource(uuid): Observable<Resource>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:264

Retrieves a resource from the Knowledge Box with all its attached metadata and content.

Parameters​

uuid​

string

Returns​

Observable<Resource>

Inherited from​

IKnowledgeBox.getFullResource


getFullResourceBySlug()​

getFullResourceBySlug(slug): Observable<Resource>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:296

Parameters​

slug​

string

Returns​

Observable<Resource>

Inherited from​

IKnowledgeBox.getFullResourceBySlug


getGenerativeProviders()​

getGenerativeProviders(): Observable<GenerativeProviders>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:750

Returns​

Observable<GenerativeProviders>

Inherited from​

IKnowledgeBox.getGenerativeProviders


getInvites()​

getInvites(): Observable<KbInvite[]>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:765

Returns​

Observable<KbInvite[]>


getKVSchema()​

getKVSchema(id): Observable<KVSchema>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:196

Returns the KV schema with the given id.

Parameters​

id​

string

Returns​

Observable<KVSchema>


getKVSchemas()​

getKVSchemas(): Observable<KBKVSchemas>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:191

Returns all the KV schemas defined in the Knowledge Box.

Returns​

Observable<KBKVSchemas>


getLabels()​

getLabels(): Observable<LabelSets>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:183

Returns all the labels defined in the Knowledge Box.

Returns​

Observable<LabelSets>

Inherited from​

IKnowledgeBox.getLabels


getLearningSchema()​

getLearningSchema(): Observable<LearningConfigurations>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:744

Returns​

Observable<LearningConfigurations>

Inherited from​

IKnowledgeBox.getLearningSchema


getProcessingHook()​

getProcessingHook(): Observable<ProcessingHook | undefined>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:1003

Returns​

Observable<ProcessingHook | undefined>

Inherited from​

IKnowledgeBox.getProcessingHook


getResource()​

getResource(uuid, show?, extracted?): Observable<Resource>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:253

Retrieves a resource from the Knowledge Box.

  • show defines which properties are returned. Default retrieves only the basic metadata.
  • extracted defines which extracted data are returned. It is ignored if ResourceProperties.EXTRACTED is not in the returned properties. Default is an empty array.

Example:

nuclia.db
.getKnowledgeBox()
.pipe(switchMap((knowledgeBox) => knowledgeBox.getResource('09a94719a6444c5a9689394f6ed9baf6')))
.subscribe((resource) => {
console.log('resource', resource);
});

Parameters​

uuid​

string

show?​

ResourceProperties[] = ...

extracted?​

ExtractedDataTypes[] = []

Returns​

Observable<Resource>

Inherited from​

IKnowledgeBox.getResource


getResourceBySlug()​

getResourceBySlug(slug, show?, extracted?): Observable<Resource>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:288

Parameters​

slug​

string

show?​

ResourceProperties[] = ...

extracted?​

ExtractedDataTypes[] = []

Returns​

Observable<Resource>

Inherited from​

IKnowledgeBox.getResourceBySlug


getResourceFromData()​

getResourceFromData(data): Resource

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:348

Parameters​

data​

IResource

Returns​

Resource


getSearchConfig()​

getSearchConfig(id): Observable<SearchConfig>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:924

Parameters​

id​

string

Returns​

Observable<SearchConfig>

Inherited from​

IKnowledgeBox.getSearchConfig


getSearchConfigs()​

getSearchConfigs(): Observable<SearchConfigs>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:928

Returns​

Observable<SearchConfigs>

Inherited from​

IKnowledgeBox.getSearchConfigs


getSplitStrategies()​

getSplitStrategies(): Observable<SplitStrategies>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:920

Returns​

Observable<SplitStrategies>

Inherited from​

IKnowledgeBox.getSplitStrategies


getTempToken()​

getTempToken(payload?, ignoreExpiration?): Observable<string>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:713

Returns an ephemeral token. Requires account id and zone to be set in the Nuclia options (except when working with a local NucliaDB instance).

This is useful when displaying a clickable link to a file in a private Knowledge Box (the token will authorize the request even though there are no authentication headers).

Example:

const downloadLink = `${nuclia.rest.getFullpath(filePath)}?eph-token=${nuclia.knowledgeBox.getTempToken()}`;

Parameters​

payload?​

any

Optional payload to provide extra data for the token generation

ignoreExpiration?​

boolean = false

Optional By default, a temp token is valid for 5min and the same token returned if this method is called several times during this time. Passing ignoreExpiration flag to true will ignore this expiration delay and will always return a new token.

Returns​

Observable<string>

Inherited from​

IKnowledgeBox.getTempToken


getUsers()​

getUsers(): Observable<FullKbUser[]>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:756

Returns​

Observable<FullKbUser[]>

Inherited from​

IKnowledgeBox.getUsers


listAgenticConfigs()​

listAgenticConfigs(): Observable<AgenticConfigs>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:936

Returns​

Observable<AgenticConfigs>

Inherited from​

IKnowledgeBox.listAgenticConfigs


listAgenticSources()​

listAgenticSources(): Observable<AgenticSources>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:948

Returns​

Observable<AgenticSources>

Inherited from​

IKnowledgeBox.listAgenticSources


listenToAllNotifications()​

listenToAllNotifications(): Observable<NotificationMessage[]>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:777

Start listening to all the notifications sent by the Knowledge Box.

Returns​

Observable<NotificationMessage[]>

Inherited from​

IKnowledgeBox.listenToAllNotifications


listenToProcessingNotifications()​

listenToProcessingNotifications(): Observable<ResourceBaseNotification[]>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:856

Start listening to the Knowledge Box notifications, and returns the list of notifications for resources which have processing completed (either successfully or not). Notifications are sent anytime processing is completed, and processing is done anytime the resource is created or modified (like when a summary is added to the resource for example).

Returns​

Observable<ResourceBaseNotification[]>

Inherited from​

IKnowledgeBox.listenToProcessingNotifications


listenToResourceOperationNotifications()​

listenToResourceOperationNotifications(): Observable<ResourceOperationNotification[]>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:801

Start listening to the Knowledge Box notifications, and returns the list of notifications corresponding to the different operations affecting the resources: created, modified, deleted. The notification contains the resource id, title, a timestamp and a flag indicating if the operation was successful or not.

Returns​

Observable<ResourceOperationNotification[]>

Inherited from​

IKnowledgeBox.listenToResourceOperationNotifications


listResources()​

listResources(page?, size?): Observable<ResourceList>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:682

Lists all the resources stored in the Knowledge Box.

Parameters​

page?​

number

size?​

number

Returns​

Observable<ResourceList>

Inherited from​

IKnowledgeBox.listResources


predictAnswer()​

predictAnswer(question, options?, synchronous?): Observable<Answer | IErrorResponse>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:512

Performs a question answering operation

Example:

nuclia.knowledgeBox
.predictAnswer('Who is Eric from Toronto?'))
.subscribe((answer) => {
if (answer.type !== 'error') {
console.log('answer', answer.text);
}
});

Parameters​

question​

string

options?​

PredictAnswerOptions

synchronous?​

boolean = true

Returns​

Observable<Answer | IErrorResponse>

Inherited from​

IKnowledgeBox.predictAnswer


processingStatus()​

processingStatus(cursor?, scheduled?, limit?): Observable<{ cursor: string; results: ProcessingStatus[]; }>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:898

Parameters​

cursor?​

string

scheduled?​

boolean

limit?​

number

Returns​

Observable<{ cursor: string; results: ProcessingStatus[]; }>

Inherited from​

IKnowledgeBox.processingStatus


rephrase()​

rephrase(question, user_context?, rephrase_prompt?): Observable<string>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:604

Performs a question rephrasing operation. It returns a rephrased question that can be used as input for the generate() method. Example:

nuclia.knowledgeBox
.rephrase('Eric lives Toronto')
.subscribe((rephrased) => {
console.log('rephrased', rephrased); // Where does Eric live?
});

Parameters​

question​

string

user_context?​

string[]

rephrase_prompt?​

string

Returns​

Observable<string>

Inherited from​

IKnowledgeBox.rephrase


search(query, features?, options?): Observable<IErrorResponse | Results>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:436

Performs a search operation in the knowledge box.

It is similar to find() but the results are not nested.

Example:

nuclia.knowledgeBox
.search('where does the Little Prince live', [Search.Features.KEYWORD])
.subscribe((searchResult) => {
console.log('search result', searchResult);
});

Parameters​

query​

string

features?​

Features[] = []

options?​

SearchOptions

Returns​

Observable<IErrorResponse | Results>

Inherited from​

IKnowledgeBox.search


stopListeningToNotifications()​

stopListeningToNotifications(): void

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:788

Stop listening the notifications sent by the Knowledge Box.

Returns​

void

Inherited from​

IKnowledgeBox.stopListeningToNotifications


suggest()​

suggest(query, inTitleOnly?, features?, options?): Observable<IErrorResponse | Suggestions>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:657

Suggests paragraphs based on the given query.

Parameters​

query​

string

inTitleOnly?​

boolean = false

features?​

SuggestionFeatures[] = []

options?​

SuggestOptions

Returns​

Observable<IErrorResponse | Suggestions>

Inherited from​

IKnowledgeBox.suggest


summarize()​

summarize(ressourceIds, user_prompt?, generative_model?): Observable<string>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:462

Summarize resources.

It reads the resources text content and return a global summary about them and one summery per resource.

The optional user_prompt parameter allows you to specify a text that will be used to generate the summary, and must use the {text} placeholder to indicate where the resource text should be inserted (example: 'Make a one-line summary of the following text: {text}').

Example:

nuclia.knowledgeBox
.summarize(['09a94719a6444c5a9689394f6ed9baf6'])
.subscribe((summary) => {
console.log('Summary', summary);
});

Parameters​

ressourceIds​

string[]

user_prompt?​

string

generative_model?​

string

Returns​

Observable<string>

Inherited from​

IKnowledgeBox.summarize


tokens()​

tokens(text): Observable<SentenceToken[]>

Defined in: libs/sdk-core/src/lib/db/kb/kb.ts:492

Performs a tokenization of the given text.

Example:

nuclia.knowledgeBox
.tokens('Does James Joyce live in Dublin?')
.subscribe((tokens) => {
console.log('tokens', tokens);
});

Parameters​

text​

string

Returns​

Observable<SentenceToken[]>

Inherited from​

IKnowledgeBox.tokens