@nuclia/core / Exports / KnowledgeBox
Class: KnowledgeBox
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.
Hierarchy
-
↳
KnowledgeBox
Implements
Table of contents
Constructors
Properties
- accountId
- allowed_origins
- description
- external_index_provider
- hidden_resources_enabled
- hidden_resources_hide_on_creation
- id
- nuclia
- search_configs
- slug
- state
- title
- zone
Accessors
Methods
- ask
- catalog
- counters
- createAgenticRAGPipeline
- feedback
- find
- generate
- generateJSON
- generateRandomQuestionAboutResource
- getConfiguration
- getEntities
- getEntitiesGroup
- getFullResource
- getFullResourceBySlug
- getInvites
- getLabels
- getLearningSchema
- getResource
- getResourceBySlug
- getResourceFromData
- getSynonyms
- getTempToken
- getUsers
- listResources
- listenToAllNotifications
- listenToProcessingNotifications
- listenToResourceOperationNotifications
- processingStatus
- rephrase
- search
- stopListeningToNotifications
- suggest
- summarize
- tokens
Constructors
constructor
• new KnowledgeBox(nuclia
, account
, data
)
Parameters
Name | Type |
---|---|
nuclia | INuclia |
account | string |
data | IKnowledgeBoxCreation | IKnowledgeBoxStandalone |
Inherited from
IKnowledgeBox.constructor
Defined in
libs/sdk-core/src/lib/db/kb/kb.ts:125
Properties
accountId
• accountId: string
Defined in
libs/sdk-core/src/lib/db/kb/kb.ts:75
allowed_origins
• Optional
allowed_origins: null
| string
[]
Implementation of
Inherited from
Defined in
libs/sdk-core/src/lib/db/kb/kb.models.ts:27
description
• Optional
description: string
Implementation of
Inherited from
Defined in
libs/sdk-core/src/lib/db/kb/kb.models.ts:25
external_index_provider
• Optional
external_index_provider: "pinecone"
Implementation of
IKnowledgeBox.external_index_provider
Inherited from
IKnowledgeBox.external_index_provider
Defined in
libs/sdk-core/src/lib/db/kb/kb.models.ts:84
hidden_resources_enabled
• Optional
hidden_resources_enabled: boolean
Implementation of
IKnowledgeBox.hidden_resources_enabled
Inherited from
IKnowledgeBox.hidden_resources_enabled
Defined in
libs/sdk-core/src/lib/db/kb/kb.models.ts:29
hidden_resources_hide_on_creation
• Optional
hidden_resources_hide_on_creation: boolean
Implementation of
IKnowledgeBox.hidden_resources_hide_on_creation
Inherited from
IKnowledgeBox.hidden_resources_hide_on_creation
Defined in
libs/sdk-core/src/lib/db/kb/kb.models.ts:30
id
• id: string
Implementation of
Inherited from
Defined in
libs/sdk-core/src/lib/db/kb/kb.models.ts:21
nuclia
• Protected
nuclia: INuclia
Defined in
libs/sdk-core/src/lib/db/kb/kb.ts:76
search_configs
• Optional
search_configs: Object
Index signature
▪ [key: string
]: any
Implementation of
Inherited from
Defined in
libs/sdk-core/src/lib/db/kb/kb.models.ts:28
slug
• slug: string
Implementation of
Inherited from
Defined in
libs/sdk-core/src/lib/db/kb/kb.models.ts:22
state
• Optional
state: KBStates
Implementation of
Inherited from
Defined in
libs/sdk-core/src/lib/db/kb/kb.models.ts:24
title
• title: string
Implementation of
Inherited from
Defined in
libs/sdk-core/src/lib/db/kb/kb.models.ts:23
zone
• zone: string
Implementation of
Inherited from
Defined in
libs/sdk-core/src/lib/db/kb/kb.models.ts:26
Accessors
fullpath
• get
fullpath(): string
The Knowledge Box fullpath on the regional API.
Example: https://europe-1.nuclia.cloud/api/v1/kb/3cce4a71-9cb9-4fda-beee-8a1512616bf0
Returns
string
Inherited from
IKnowledgeBox.fullpath
Defined in
libs/sdk-core/src/lib/db/kb/kb.ts:121
path
• get
path(): string
The Knowledge Box path on the regional API.
Example: /v1/kb/3cce4a71-9cb9-4fda-beee-8a1512616bf0
Returns
string
Inherited from
IKnowledgeBox.path
Defined in
libs/sdk-core/src/lib/db/kb/kb.ts:112
Methods
ask
▸ ask(query
, context?
, features?
, options?
): Observable
<IErrorResponse
| Answer
>
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
Name | Type |
---|---|
query | string |
context? | ContextEntry [] |
features? | Features [] |
options? | ChatOptions |
Returns
Observable
<IErrorResponse
| Answer
>
Inherited from
Defined in
libs/sdk-core/src/lib/db/kb/kb.ts:304
▸ ask(query
, context?
, features?
, options?
, callback?
): Observable
<null
>
Parameters
Name | Type |
---|---|
query | string |
context? | ContextEntry [] |
features? | Features [] |
options? | ChatOptions |
callback? | (answer : IErrorResponse | Answer ) => void |
Returns
Observable
<null
>
Inherited from
Defined in
libs/sdk-core/src/lib/db/kb/kb.ts:310
catalog
▸ catalog(query
, options?
): Observable
<Results
| IErrorResponse
>
Parameters
Name | Type |
---|---|
query | string |
options? | SearchOptions |
Returns
Observable
<Results
| IErrorResponse
>
Inherited from
Defined in
libs/sdk-core/src/lib/db/kb/kb.ts:602
counters
▸ counters(): Observable
<Counters
>
Returns totals for each kind of contents stored in the Knowledge Box (resources, fields, paragraphs, vectors)
Returns
Observable
<Counters
>