@nuclia/core
Advanced tools
Comparing version 1.14.6 to 1.14.7
@@ -0,1 +1,9 @@ | ||
# 1.14.7 (2024-04-19) | ||
### Improvements | ||
- `ask()` method in the resource, it allows to ask questions to the resource using the entire content of the resource as context | ||
- Remove `inTitleOnly` search option | ||
- Add new `/usage` endpoint and add deprecation note on previous `/stats` endpoint | ||
# 1.14.6 (2024-04-12) | ||
@@ -2,0 +10,0 @@ |
import { Observable } from 'rxjs'; | ||
import { AccountUsersPayload, FullAccountUser, IDb, INuclia, InviteAccountUserPayload, PendingInvitation } from '../models'; | ||
import { Account, AccountCreation, AccountModification, AccountStatus, KbIndex, LearningConfigurations, NUAClient, NUAClientPayload, PredictedToken, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, QueryInfo, StatsPeriod, StatsRange, StatsType, Welcome } from './db.models'; | ||
import { Account, AccountCreation, AccountModification, AccountStatus, KbIndex, LearningConfigurations, NUAClient, NUAClientPayload, PredictedToken, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, QueryInfo, StatsPeriod, StatsRange, StatsType, UsageAggregation, UsagePoint, Welcome } from './db.models'; | ||
import type { EventList, IKnowledgeBoxItem, KnowledgeBoxCreation } from './kb'; | ||
@@ -102,2 +102,20 @@ import { IStandaloneKb, WritableKnowledgeBox } from './kb'; | ||
createKnowledgeBox(accountId: string, knowledgeBox: KnowledgeBoxCreation, zone?: string): Observable<WritableKnowledgeBox>; | ||
/** | ||
* Get usage metric for the account. | ||
* @param accountId Account identifier | ||
* @param from Timestamp of the moment from which we want the metrics. | ||
* @param to Timestamp of the moment until which we want the metrics. When not provided, the metrics are returned "until now". | ||
* @param knowledgeBoxId Knowledge Box identifier to get the metrics for a specific Knowledge Box (returns the metrics aggregated for all the Knowledge Boxes of the account by default) | ||
* @param aggregation 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" | ||
*/ | ||
getUsage(accountId: string, from: string, to?: string, knowledgeBoxId?: string, aggregation?: UsageAggregation): Observable<UsagePoint[]>; | ||
/** | ||
* @deprecated: To be replaced by getUsage | ||
*/ | ||
getStats(accountSlug: string, type: StatsType, knowledgeBox?: string, period?: StatsPeriod, utctime?: string): Observable<ProcessingStat[]>; | ||
@@ -104,0 +122,0 @@ /** |
@@ -81,2 +81,43 @@ export type AccountTypes = 'stash-trial' | 'v3starter' | 'v3fly' | 'v3growth' | 'v3enterprise' | 'stash-basic' | 'stash-team' | 'stash-startup' | 'stash-starter' | 'stash-growth' | 'stash-enterprise' | 'stash-developer' | 'stash-business'; | ||
} | ||
export type UsageAggregation = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; | ||
export interface CommonMetricDetails { | ||
identifier: { | ||
[key: string]: string | null; | ||
}; | ||
raw_usage: { | ||
requests: number | null; | ||
input: number | null; | ||
output: number | null; | ||
}; | ||
} | ||
export interface UsageMetric { | ||
name: string; | ||
value: number; | ||
details: CommonMetricDetails[]; | ||
} | ||
export interface NucliaTokensDetails extends CommonMetricDetails { | ||
identifier: { | ||
type: string; | ||
source: string; | ||
version: string; | ||
model: string | null; | ||
}; | ||
nuclia_tokens: { | ||
requests: number | null; | ||
input: number | null; | ||
output: number | null; | ||
}; | ||
} | ||
export interface NucliaTokensMetric extends UsageMetric { | ||
name: 'nuclia_tokens'; | ||
value: number; | ||
details: NucliaTokensDetails[]; | ||
} | ||
export interface UsagePoint { | ||
timestamp: string; | ||
metrics: (UsageMetric | NucliaTokensMetric)[]; | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare enum StatsPeriod { | ||
@@ -88,2 +129,5 @@ DAY = "day", | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare enum StatsRange { | ||
@@ -98,2 +142,5 @@ anHour = "1h", | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export interface ProcessingStat { | ||
@@ -103,2 +150,5 @@ time_period: string; | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare enum StatsType { | ||
@@ -105,0 +155,0 @@ PROCESSING_TIME = "processing_time", |
@@ -215,3 +215,3 @@ import { Observable } from 'rxjs'; | ||
suggest(query: string, inTitleOnly?: boolean, features?: Search.SuggestionFeatures[]): Observable<Search.Suggestions | IErrorResponse>; | ||
feedback(answerId: string, good: boolean): Observable<void>; | ||
feedback(answerId: string, good: boolean, feedback?: string): Observable<void>; | ||
listFeedback(): Observable<string[]>; | ||
@@ -218,0 +218,0 @@ /** Returns totals for each kind of contents stored in the Knowledge Box (resources, fields, paragraphs, vectors) */ |
@@ -7,3 +7,3 @@ import { Observable } from 'rxjs'; | ||
import { ExtractedDataTypes, ResourceFieldProperties } from './resource.models'; | ||
import type { Search, SearchOptions } from '../search'; | ||
import type { Chat, ChatOptions, Search, SearchOptions } from '../search'; | ||
export interface ReadableResource extends IResource { | ||
@@ -135,4 +135,16 @@ } | ||
find(query: string, features?: Search.ResourceFeatures[], options?: SearchOptions): Observable<Search.FindResults | IErrorResponse>; | ||
/** | ||
* Retrieves a generative answer for the given query based on | ||
* the results of a search operation performed on the resource. | ||
*/ | ||
chat(query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions): Observable<Chat.Answer | IErrorResponse>; | ||
chat(query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions, callback?: (answer: Chat.Answer | IErrorResponse) => void): Observable<null>; | ||
/** | ||
* Retrieves a generative answer for the given query using the entire resource as context | ||
* (the resource's text might be shorten if too large). | ||
*/ | ||
ask(query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions): Observable<Chat.Answer | IErrorResponse>; | ||
ask(query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions, callback?: (answer: Chat.Answer | IErrorResponse) => void): Observable<null>; | ||
setLabels(fieldId: string, fieldType: string, paragraphId: string, labels: Classification[]): Observable<void>; | ||
setEntities(fieldId: string, fieldType: string, entities: TokenAnnotation[]): Observable<void>; | ||
} |
@@ -5,2 +5,2 @@ import { Observable } from 'rxjs'; | ||
import { ChatOptions } from './search.models'; | ||
export declare function chat(nuclia: INuclia, path: string, query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions): Observable<Chat.Answer | IErrorResponse>; | ||
export declare function chat(nuclia: INuclia, kbid: string, path: string, query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions): Observable<Chat.Answer | IErrorResponse>; |
@@ -54,3 +54,2 @@ import type { ExtractedDataTypes, FIELD_TYPE, FieldId, IFieldData, IResource, RelationEntityType, RelationType } from '../resource'; | ||
export interface SearchOptions extends BaseSearchOptions { | ||
inTitleOnly?: boolean; | ||
faceted?: string[]; | ||
@@ -57,0 +56,0 @@ sort?: SortOption; |
@@ -34,2 +34,3 @@ import { Observable } from 'rxjs'; | ||
payload?: ICreateResource; | ||
contentType?: string; | ||
} | ||
@@ -36,0 +37,0 @@ export interface FileMetadata { |
import type { Observable } from 'rxjs'; | ||
import type { AuthTokens, JwtUser, NucliaDBRole } from './auth'; | ||
import { Account, AccountCreation, AccountModification, AccountStatus, AccountTypes, EventList, IKnowledgeBoxItem, IStandaloneKb, KBRoles, KbIndex, KnowledgeBox, KnowledgeBoxCreation, LearningConfigurations, NUAClient, NUAClientPayload, PredictedToken, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, QueryInfo, StatsPeriod, StatsRange, StatsType, Welcome, WritableKnowledgeBox } from './db'; | ||
import { Account, AccountCreation, AccountModification, AccountStatus, AccountTypes, EventList, IKnowledgeBoxItem, IStandaloneKb, KbIndex, KBRoles, KnowledgeBox, KnowledgeBoxCreation, LearningConfigurations, NUAClient, NUAClientPayload, PredictedToken, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, QueryInfo, StatsPeriod, StatsRange, StatsType, UsageAggregation, UsagePoint, Welcome, WritableKnowledgeBox } from './db'; | ||
export interface INuclia { | ||
@@ -99,2 +99,3 @@ options: NucliaOptions; | ||
createKnowledgeBox(accountId: string, knowledgeBox: KnowledgeBoxCreation, zone?: string): Observable<WritableKnowledgeBox>; | ||
getUsage(accountId: string, from: string, to?: string, knowledgeBox?: string, aggregation?: UsageAggregation): Observable<UsagePoint[]>; | ||
getStats(accountSlug: string, type: StatsType, knowledgeBox?: string, period?: StatsPeriod, utctime?: string): Observable<ProcessingStat[]>; | ||
@@ -101,0 +102,0 @@ upload(file: File): Observable<ProcessingPushResponse>; |
{ | ||
"name": "@nuclia/core", | ||
"version": "1.14.6", | ||
"version": "1.14.7", | ||
"description": "SDK allowing to integrate Nuclia services in your frontend application", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
import { Observable } from 'rxjs'; | ||
import { AccountUsersPayload, FullAccountUser, IDb, INuclia, InviteAccountUserPayload, PendingInvitation } from '../models'; | ||
import { Account, AccountCreation, AccountModification, AccountStatus, KbIndex, LearningConfigurations, NUAClient, NUAClientPayload, PredictedToken, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, QueryInfo, StatsPeriod, StatsRange, StatsType, Welcome } from './db.models'; | ||
import { Account, AccountCreation, AccountModification, AccountStatus, KbIndex, LearningConfigurations, NUAClient, NUAClientPayload, PredictedToken, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, QueryInfo, StatsPeriod, StatsRange, StatsType, UsageAggregation, UsagePoint, Welcome } from './db.models'; | ||
import type { EventList, IKnowledgeBoxItem, KnowledgeBoxCreation } from './kb'; | ||
@@ -102,2 +102,20 @@ import { IStandaloneKb, WritableKnowledgeBox } from './kb'; | ||
createKnowledgeBox(accountId: string, knowledgeBox: KnowledgeBoxCreation, zone?: string): Observable<WritableKnowledgeBox>; | ||
/** | ||
* Get usage metric for the account. | ||
* @param accountId Account identifier | ||
* @param from Timestamp of the moment from which we want the metrics. | ||
* @param to Timestamp of the moment until which we want the metrics. When not provided, the metrics are returned "until now". | ||
* @param knowledgeBoxId Knowledge Box identifier to get the metrics for a specific Knowledge Box (returns the metrics aggregated for all the Knowledge Boxes of the account by default) | ||
* @param aggregation 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" | ||
*/ | ||
getUsage(accountId: string, from: string, to?: string, knowledgeBoxId?: string, aggregation?: UsageAggregation): Observable<UsagePoint[]>; | ||
/** | ||
* @deprecated: To be replaced by getUsage | ||
*/ | ||
getStats(accountSlug: string, type: StatsType, knowledgeBox?: string, period?: StatsPeriod, utctime?: string): Observable<ProcessingStat[]>; | ||
@@ -104,0 +122,0 @@ /** |
@@ -81,2 +81,43 @@ export type AccountTypes = 'stash-trial' | 'v3starter' | 'v3fly' | 'v3growth' | 'v3enterprise' | 'stash-basic' | 'stash-team' | 'stash-startup' | 'stash-starter' | 'stash-growth' | 'stash-enterprise' | 'stash-developer' | 'stash-business'; | ||
} | ||
export type UsageAggregation = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; | ||
export interface CommonMetricDetails { | ||
identifier: { | ||
[key: string]: string | null; | ||
}; | ||
raw_usage: { | ||
requests: number | null; | ||
input: number | null; | ||
output: number | null; | ||
}; | ||
} | ||
export interface UsageMetric { | ||
name: string; | ||
value: number; | ||
details: CommonMetricDetails[]; | ||
} | ||
export interface NucliaTokensDetails extends CommonMetricDetails { | ||
identifier: { | ||
type: string; | ||
source: string; | ||
version: string; | ||
model: string | null; | ||
}; | ||
nuclia_tokens: { | ||
requests: number | null; | ||
input: number | null; | ||
output: number | null; | ||
}; | ||
} | ||
export interface NucliaTokensMetric extends UsageMetric { | ||
name: 'nuclia_tokens'; | ||
value: number; | ||
details: NucliaTokensDetails[]; | ||
} | ||
export interface UsagePoint { | ||
timestamp: string; | ||
metrics: (UsageMetric | NucliaTokensMetric)[]; | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare enum StatsPeriod { | ||
@@ -88,2 +129,5 @@ DAY = "day", | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare enum StatsRange { | ||
@@ -98,2 +142,5 @@ anHour = "1h", | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export interface ProcessingStat { | ||
@@ -103,2 +150,5 @@ time_period: string; | ||
} | ||
/** | ||
* @deprecated | ||
*/ | ||
export declare enum StatsType { | ||
@@ -105,0 +155,0 @@ PROCESSING_TIME = "processing_time", |
@@ -215,3 +215,3 @@ import { Observable } from 'rxjs'; | ||
suggest(query: string, inTitleOnly?: boolean, features?: Search.SuggestionFeatures[]): Observable<Search.Suggestions | IErrorResponse>; | ||
feedback(answerId: string, good: boolean): Observable<void>; | ||
feedback(answerId: string, good: boolean, feedback?: string): Observable<void>; | ||
listFeedback(): Observable<string[]>; | ||
@@ -218,0 +218,0 @@ /** Returns totals for each kind of contents stored in the Knowledge Box (resources, fields, paragraphs, vectors) */ |
@@ -7,3 +7,3 @@ import { Observable } from 'rxjs'; | ||
import { ExtractedDataTypes, ResourceFieldProperties } from './resource.models'; | ||
import type { Search, SearchOptions } from '../search'; | ||
import type { Chat, ChatOptions, Search, SearchOptions } from '../search'; | ||
export interface ReadableResource extends IResource { | ||
@@ -135,4 +135,16 @@ } | ||
find(query: string, features?: Search.ResourceFeatures[], options?: SearchOptions): Observable<Search.FindResults | IErrorResponse>; | ||
/** | ||
* Retrieves a generative answer for the given query based on | ||
* the results of a search operation performed on the resource. | ||
*/ | ||
chat(query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions): Observable<Chat.Answer | IErrorResponse>; | ||
chat(query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions, callback?: (answer: Chat.Answer | IErrorResponse) => void): Observable<null>; | ||
/** | ||
* Retrieves a generative answer for the given query using the entire resource as context | ||
* (the resource's text might be shorten if too large). | ||
*/ | ||
ask(query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions): Observable<Chat.Answer | IErrorResponse>; | ||
ask(query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions, callback?: (answer: Chat.Answer | IErrorResponse) => void): Observable<null>; | ||
setLabels(fieldId: string, fieldType: string, paragraphId: string, labels: Classification[]): Observable<void>; | ||
setEntities(fieldId: string, fieldType: string, entities: TokenAnnotation[]): Observable<void>; | ||
} |
@@ -5,2 +5,2 @@ import { Observable } from 'rxjs'; | ||
import { ChatOptions } from './search.models'; | ||
export declare function chat(nuclia: INuclia, path: string, query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions): Observable<Chat.Answer | IErrorResponse>; | ||
export declare function chat(nuclia: INuclia, kbid: string, path: string, query: string, context?: Chat.ContextEntry[], features?: Chat.Features[], options?: ChatOptions): Observable<Chat.Answer | IErrorResponse>; |
@@ -54,3 +54,2 @@ import type { ExtractedDataTypes, FIELD_TYPE, FieldId, IFieldData, IResource, RelationEntityType, RelationType } from '../resource'; | ||
export interface SearchOptions extends BaseSearchOptions { | ||
inTitleOnly?: boolean; | ||
faceted?: string[]; | ||
@@ -57,0 +56,0 @@ sort?: SortOption; |
@@ -34,2 +34,3 @@ import { Observable } from 'rxjs'; | ||
payload?: ICreateResource; | ||
contentType?: string; | ||
} | ||
@@ -36,0 +37,0 @@ export interface FileMetadata { |
import type { Observable } from 'rxjs'; | ||
import type { AuthTokens, JwtUser, NucliaDBRole } from './auth'; | ||
import { Account, AccountCreation, AccountModification, AccountStatus, AccountTypes, EventList, IKnowledgeBoxItem, IStandaloneKb, KBRoles, KbIndex, KnowledgeBox, KnowledgeBoxCreation, LearningConfigurations, NUAClient, NUAClientPayload, PredictedToken, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, QueryInfo, StatsPeriod, StatsRange, StatsType, Welcome, WritableKnowledgeBox } from './db'; | ||
import { Account, AccountCreation, AccountModification, AccountStatus, AccountTypes, EventList, IKnowledgeBoxItem, IStandaloneKb, KbIndex, KBRoles, KnowledgeBox, KnowledgeBoxCreation, LearningConfigurations, NUAClient, NUAClientPayload, PredictedToken, ProcessingPullResponse, ProcessingPushResponse, ProcessingStat, QueryInfo, StatsPeriod, StatsRange, StatsType, UsageAggregation, UsagePoint, Welcome, WritableKnowledgeBox } from './db'; | ||
export interface INuclia { | ||
@@ -99,2 +99,3 @@ options: NucliaOptions; | ||
createKnowledgeBox(accountId: string, knowledgeBox: KnowledgeBoxCreation, zone?: string): Observable<WritableKnowledgeBox>; | ||
getUsage(accountId: string, from: string, to?: string, knowledgeBox?: string, aggregation?: UsageAggregation): Observable<UsagePoint[]>; | ||
getStats(accountSlug: string, type: StatsType, knowledgeBox?: string, period?: StatsPeriod, utctime?: string): Observable<ProcessingStat[]>; | ||
@@ -101,0 +102,0 @@ upload(file: File): Observable<ProcessingPushResponse>; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
480158
9388