Skip to main content

ActivityMonitor

@nuclia/core


@nuclia/core / ActivityMonitor

Class: ActivityMonitor

Defined in: libs/sdk-core/src/lib/db/kb/activity/activity-monitor.ts:19

Constructors​

Constructor​

new ActivityMonitor(kb, nuclia): ActivityMonitor

Defined in: libs/sdk-core/src/lib/db/kb/activity/activity-monitor.ts:23

Parameters​

kb​

WritableKnowledgeBox

nuclia​

INuclia

Returns​

ActivityMonitor

Properties​

kb​

kb: WritableKnowledgeBox

Defined in: libs/sdk-core/src/lib/db/kb/activity/activity-monitor.ts:20


nuclia​

nuclia: INuclia

Defined in: libs/sdk-core/src/lib/db/kb/activity/activity-monitor.ts:21

Methods​

createActivityLogDownload()​

createActivityLogDownload(eventType, query, format): Observable<ActivityLogDownload>

Defined in: libs/sdk-core/src/lib/db/kb/activity/activity-monitor.ts:78

Create a URL to download activity log data

Parameters​

eventType​

EventType

query​

ActivityLogDownloadQuery

format​

DownloadFormat

Returns​

Observable<ActivityLogDownload>


getDownloadStatus()​

getDownloadStatus(requestId): Observable<ActivityLogDownload>

Defined in: libs/sdk-core/src/lib/db/kb/activity/activity-monitor.ts:93

Get the status of a download request

Parameters​

requestId​

string

Returns​

Observable<ActivityLogDownload>


getFullContexts()​

getFullContexts(eventId): Observable<RemiQueryResponseContextDetails>

Defined in: libs/sdk-core/src/lib/db/kb/activity/activity-monitor.ts:67

Get the RAG request (question and answer), the REMi scores and the full contexts list for a specific item coming from queryRemiScores method.

Parameters​

eventId​

number

Identifier of an item from queryRemiScores response.

Returns​

Observable<RemiQueryResponseContextDetails>


getMonthsWithActivity()​

getMonthsWithActivity(eventType): Observable<{ downloads: string[]; }>

Defined in: libs/sdk-core/src/lib/db/kb/activity/activity-monitor.ts:102

Get the list of months with available activity log data for a specific event type

Parameters​

eventType​

EventType

Returns​

Observable<{ downloads: string[]; }>


getRemiScores()​

getRemiScores(from, to?, aggregation?): Observable<RemiScoresResponseItem[]>

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

Get the evolution of REMi scores of a KB on the specified time range.

Parameters​

from​

string

Timestamp of the moment from which we want the metrics.

to?​

string

Timestamp of the moment until which we want the metrics. When not provided, the metrics are returned "until now".

aggregation?​

UsageAggregation

Define how the metrics are aggregated. By default, the endpoint returns only one point aggregating all the data for the specified date range. But you can have one point by:

  • "hour"
  • "day"
  • "week"
  • "month"
  • "quarter"
  • "year"
  • "millennium" (used by default)

Returns​

Observable<RemiScoresResponseItem[]>


getSearchMetrics()​

getSearchMetrics(from, to?, aggregation?): Observable<SearchMetricsItem[]>

Defined in: libs/sdk-core/src/lib/db/kb/activity/activity-monitor.ts:113

Retrieve statistics for search and ask requests

Parameters​

from​

string

Timestamp of the moment from which we want the metrics.

to?​

string

Timestamp of the moment until which we want the metrics. When not provided, the metrics are returned "until now".

aggregation?​

UsageAggregation

Define how the metrics are aggregated. By default, the endpoint returns only one point aggregating all the data for the specified date range.

Returns​

Observable<SearchMetricsItem[]>


queryActivityLogs()​

queryActivityLogs(eventType, query): Observable<ActivityLogResponseAskItem[]>

Defined in: libs/sdk-core/src/lib/db/kb/activity/activity-monitor.ts:131

Query activity logs with live pagination. Returns an array of log items parsed from the NDJSON response.

Parameters​

eventType​

EventType

The event type to query (ask, search, chat, new, modified, processed, etc.)

query​

ActivityLogQuery

Query body: year_month (required), optional pagination, show, filters

Returns​

Observable<ActivityLogResponseAskItem[]>


queryRemiScores()​

queryRemiScores(criteria): Observable<RemiQueryResponse>

Defined in: libs/sdk-core/src/lib/db/kb/activity/activity-monitor.ts:58

Get a list of RAG requests and their scores (if any) that matches a REMi scores query or a status.

Parameters​

criteria​

RemiQueryCriteria

Object representing the query to be done. It currently supports querying on context relevance, answer status or answer feedback.

Returns​

Observable<RemiQueryResponse>