rapida-react
Version:
An easy to use react client for building generative ai application using Rapida platform.
2,203 lines • 76.3 kB
text/typescript
import * as jspb from 'google-protobuf';
import * as google_protobuf_any_pb from 'google-protobuf/google/protobuf/any_pb';
import * as google_protobuf_timestamp_pb from 'google-protobuf/google/protobuf/timestamp_pb';
import * as google_protobuf_struct_pb from 'google-protobuf/google/protobuf/struct_pb';
import { grpc } from '@improbable-eng/grpc-web';
import { F as Feedback, M as Message$1 } from './index-0bkcyQsE.mjs';
export { C as Conversation, a as MessageRole, b as MessageStatus } from './index-0bkcyQsE.mjs';
import TypedEmitter from 'typed-emitter';
import * as React from 'react';
export { AgentMultibandAudioVisualizer } from './components/visualization/agent-multiband-audio-visualizer.mjs';
export { AgentLiveTranscript } from './components/live-transcript.mjs';
import 'react/jsx-runtime';
// package:
// file: common.proto
declare class Criteria extends jspb.Message {
getKey(): string;
setKey(value: string): void;
getValue(): string;
setValue(value: string): void;
getLogic(): string;
setLogic(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Criteria.AsObject;
static toObject(includeInstance: boolean, msg: Criteria): Criteria.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Criteria, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Criteria;
static deserializeBinaryFromReader(message: Criteria, reader: jspb.BinaryReader): Criteria;
}
declare namespace Criteria {
export type AsObject = {
key: string,
value: string,
logic: string,
}
}
declare class Error$1 extends jspb.Message {
getErrorcode(): string;
setErrorcode(value: string): void;
getErrormessage(): string;
setErrormessage(value: string): void;
getHumanmessage(): string;
setHumanmessage(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Error$1.AsObject;
static toObject(includeInstance: boolean, msg: Error$1): Error$1.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Error$1, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Error$1;
static deserializeBinaryFromReader(message: Error$1, reader: jspb.BinaryReader): Error$1;
}
declare namespace Error$1 {
export type AsObject = {
errorcode: string,
errormessage: string,
humanmessage: string,
}
}
declare class Paginate extends jspb.Message {
getPage(): number;
setPage(value: number): void;
getPagesize(): number;
setPagesize(value: number): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Paginate.AsObject;
static toObject(includeInstance: boolean, msg: Paginate): Paginate.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Paginate, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Paginate;
static deserializeBinaryFromReader(message: Paginate, reader: jspb.BinaryReader): Paginate;
}
declare namespace Paginate {
export type AsObject = {
page: number,
pagesize: number,
}
}
declare class Paginated extends jspb.Message {
getCurrentpage(): number;
setCurrentpage(value: number): void;
getTotalitem(): number;
setTotalitem(value: number): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Paginated.AsObject;
static toObject(includeInstance: boolean, msg: Paginated): Paginated.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Paginated, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Paginated;
static deserializeBinaryFromReader(message: Paginated, reader: jspb.BinaryReader): Paginated;
}
declare namespace Paginated {
export type AsObject = {
currentpage: number,
totalitem: number,
}
}
declare class Ordering extends jspb.Message {
getColumn(): string;
setColumn(value: string): void;
getOrder(): string;
setOrder(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Ordering.AsObject;
static toObject(includeInstance: boolean, msg: Ordering): Ordering.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Ordering, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Ordering;
static deserializeBinaryFromReader(message: Ordering, reader: jspb.BinaryReader): Ordering;
}
declare namespace Ordering {
export type AsObject = {
column: string,
order: string,
}
}
declare class User extends jspb.Message {
getId(): string;
setId(value: string): void;
getName(): string;
setName(value: string): void;
getEmail(): string;
setEmail(value: string): void;
getRole(): string;
setRole(value: string): void;
hasCreateddate(): boolean;
clearCreateddate(): void;
getCreateddate(): google_protobuf_timestamp_pb.Timestamp | undefined;
setCreateddate(value?: google_protobuf_timestamp_pb.Timestamp): void;
getStatus(): string;
setStatus(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): User.AsObject;
static toObject(includeInstance: boolean, msg: User): User.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: User, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): User;
static deserializeBinaryFromReader(message: User, reader: jspb.BinaryReader): User;
}
declare namespace User {
export type AsObject = {
id: string,
name: string,
email: string,
role: string,
createddate?: google_protobuf_timestamp_pb.Timestamp.AsObject,
status: string,
}
}
declare class Metadata extends jspb.Message {
getId(): string;
setId(value: string): void;
getKey(): string;
setKey(value: string): void;
getValue(): string;
setValue(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Metadata.AsObject;
static toObject(includeInstance: boolean, msg: Metadata): Metadata.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Metadata, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Metadata;
static deserializeBinaryFromReader(message: Metadata, reader: jspb.BinaryReader): Metadata;
}
declare namespace Metadata {
export type AsObject = {
id: string,
key: string,
value: string,
}
}
declare class Metric extends jspb.Message {
getName(): string;
setName(value: string): void;
getValue(): string;
setValue(value: string): void;
getDescription(): string;
setDescription(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Metric.AsObject;
static toObject(includeInstance: boolean, msg: Metric): Metric.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Metric, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Metric;
static deserializeBinaryFromReader(message: Metric, reader: jspb.BinaryReader): Metric;
}
declare namespace Metric {
export type AsObject = {
name: string,
value: string,
description: string,
}
}
declare class Content extends jspb.Message {
getName(): string;
setName(value: string): void;
getContenttype(): string;
setContenttype(value: string): void;
getContentformat(): string;
setContentformat(value: string): void;
getContent(): Uint8Array | string;
getContent_asU8(): Uint8Array;
getContent_asB64(): string;
setContent(value: Uint8Array | string): void;
hasMeta(): boolean;
clearMeta(): void;
getMeta(): google_protobuf_struct_pb.Struct | undefined;
setMeta(value?: google_protobuf_struct_pb.Struct): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Content.AsObject;
static toObject(includeInstance: boolean, msg: Content): Content.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Content, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Content;
static deserializeBinaryFromReader(message: Content, reader: jspb.BinaryReader): Content;
}
declare namespace Content {
export type AsObject = {
name: string,
contenttype: string,
contentformat: string,
content: Uint8Array | string,
meta?: google_protobuf_struct_pb.Struct.AsObject,
}
}
declare class Message extends jspb.Message {
getRole(): string;
setRole(value: string): void;
clearContentsList(): void;
getContentsList(): Array<Content>;
setContentsList(value: Array<Content>): void;
addContents(value?: Content, index?: number): Content;
clearToolcallsList(): void;
getToolcallsList(): Array<ToolCall>;
setToolcallsList(value: Array<ToolCall>): void;
addToolcalls(value?: ToolCall, index?: number): ToolCall;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Message.AsObject;
static toObject(includeInstance: boolean, msg: Message): Message.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Message, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Message;
static deserializeBinaryFromReader(message: Message, reader: jspb.BinaryReader): Message;
}
declare namespace Message {
export type AsObject = {
role: string,
contentsList: Array<Content.AsObject>,
toolcallsList: Array<ToolCall.AsObject>,
}
}
declare class Event extends jspb.Message {
getName(): string;
setName(value: string): void;
hasMeta(): boolean;
clearMeta(): void;
getMeta(): google_protobuf_struct_pb.Struct | undefined;
setMeta(value?: google_protobuf_struct_pb.Struct): void;
hasTime(): boolean;
clearTime(): void;
getTime(): google_protobuf_timestamp_pb.Timestamp | undefined;
setTime(value?: google_protobuf_timestamp_pb.Timestamp): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Event.AsObject;
static toObject(includeInstance: boolean, msg: Event): Event.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Event, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Event;
static deserializeBinaryFromReader(message: Event, reader: jspb.BinaryReader): Event;
}
declare namespace Event {
export type AsObject = {
name: string,
meta?: google_protobuf_struct_pb.Struct.AsObject,
time?: google_protobuf_timestamp_pb.Timestamp.AsObject,
}
}
declare class ToolCall extends jspb.Message {
getId(): string;
setId(value: string): void;
getType(): string;
setType(value: string): void;
hasFunction(): boolean;
clearFunction(): void;
getFunction(): FunctionCall | undefined;
setFunction(value?: FunctionCall): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ToolCall.AsObject;
static toObject(includeInstance: boolean, msg: ToolCall): ToolCall.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: ToolCall, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): ToolCall;
static deserializeBinaryFromReader(message: ToolCall, reader: jspb.BinaryReader): ToolCall;
}
declare namespace ToolCall {
export type AsObject = {
id: string,
type: string,
pb_function?: FunctionCall.AsObject,
}
}
declare class FunctionCall extends jspb.Message {
getName(): string;
setName(value: string): void;
getArguments(): string;
setArguments(value: string): void;
hasArgs(): boolean;
clearArgs(): void;
getArgs(): google_protobuf_struct_pb.Struct | undefined;
setArgs(value?: google_protobuf_struct_pb.Struct): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): FunctionCall.AsObject;
static toObject(includeInstance: boolean, msg: FunctionCall): FunctionCall.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: FunctionCall, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): FunctionCall;
static deserializeBinaryFromReader(message: FunctionCall, reader: jspb.BinaryReader): FunctionCall;
}
declare namespace FunctionCall {
export type AsObject = {
name: string,
arguments: string,
args?: google_protobuf_struct_pb.Struct.AsObject,
}
}
declare class AssistantMessageStage extends jspb.Message {
getStage(): string;
setStage(value: string): void;
getAdditionaldataMap(): jspb.Map<string, string>;
clearAdditionaldataMap(): void;
getTimetaken(): number;
setTimetaken(value: number): void;
getLifecycleid(): string;
setLifecycleid(value: string): void;
hasStarttimestamp(): boolean;
clearStarttimestamp(): void;
getStarttimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined;
setStarttimestamp(value?: google_protobuf_timestamp_pb.Timestamp): void;
hasEndtimestamp(): boolean;
clearEndtimestamp(): void;
getEndtimestamp(): google_protobuf_timestamp_pb.Timestamp | undefined;
setEndtimestamp(value?: google_protobuf_timestamp_pb.Timestamp): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AssistantMessageStage.AsObject;
static toObject(includeInstance: boolean, msg: AssistantMessageStage): AssistantMessageStage.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AssistantMessageStage, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AssistantMessageStage;
static deserializeBinaryFromReader(message: AssistantMessageStage, reader: jspb.BinaryReader): AssistantMessageStage;
}
declare namespace AssistantMessageStage {
export type AsObject = {
stage: string,
additionaldataMap: Array<[string, string]>,
timetaken: number,
lifecycleid: string,
starttimestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject,
endtimestamp?: google_protobuf_timestamp_pb.Timestamp.AsObject,
}
}
declare class AssistantConversationMessage extends jspb.Message {
getId(): string;
setId(value: string): void;
getMessageid(): string;
setMessageid(value: string): void;
getAssistantconversationid(): string;
setAssistantconversationid(value: string): void;
hasRequest(): boolean;
clearRequest(): void;
getRequest(): Message | undefined;
setRequest(value?: Message): void;
hasResponse(): boolean;
clearResponse(): void;
getResponse(): Message | undefined;
setResponse(value?: Message): void;
getSource(): string;
setSource(value: string): void;
clearMetricsList(): void;
getMetricsList(): Array<Metric>;
setMetricsList(value: Array<Metric>): void;
addMetrics(value?: Metric, index?: number): Metric;
getStatus(): string;
setStatus(value: string): void;
getCreatedby(): string;
setCreatedby(value: string): void;
getUpdatedby(): string;
setUpdatedby(value: string): void;
clearSuggestedquestionsList(): void;
getSuggestedquestionsList(): Array<string>;
setSuggestedquestionsList(value: Array<string>): void;
addSuggestedquestions(value: string, index?: number): string;
clearStagesList(): void;
getStagesList(): Array<AssistantMessageStage>;
setStagesList(value: Array<AssistantMessageStage>): void;
addStages(value?: AssistantMessageStage, index?: number): AssistantMessageStage;
hasCreateddate(): boolean;
clearCreateddate(): void;
getCreateddate(): google_protobuf_timestamp_pb.Timestamp | undefined;
setCreateddate(value?: google_protobuf_timestamp_pb.Timestamp): void;
hasUpdateddate(): boolean;
clearUpdateddate(): void;
getUpdateddate(): google_protobuf_timestamp_pb.Timestamp | undefined;
setUpdateddate(value?: google_protobuf_timestamp_pb.Timestamp): void;
getAssistantid(): string;
setAssistantid(value: string): void;
getAssistantprovidermodelid(): string;
setAssistantprovidermodelid(value: string): void;
clearMetadataList(): void;
getMetadataList(): Array<Metadata>;
setMetadataList(value: Array<Metadata>): void;
addMetadata(value?: Metadata, index?: number): Metadata;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AssistantConversationMessage.AsObject;
static toObject(includeInstance: boolean, msg: AssistantConversationMessage): AssistantConversationMessage.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AssistantConversationMessage, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AssistantConversationMessage;
static deserializeBinaryFromReader(message: AssistantConversationMessage, reader: jspb.BinaryReader): AssistantConversationMessage;
}
declare namespace AssistantConversationMessage {
export type AsObject = {
id: string,
messageid: string,
assistantconversationid: string,
request?: Message.AsObject,
response?: Message.AsObject,
source: string,
metricsList: Array<Metric.AsObject>,
status: string,
createdby: string,
updatedby: string,
suggestedquestionsList: Array<string>,
stagesList: Array<AssistantMessageStage.AsObject>,
createddate?: google_protobuf_timestamp_pb.Timestamp.AsObject,
updateddate?: google_protobuf_timestamp_pb.Timestamp.AsObject,
assistantid: string,
assistantprovidermodelid: string,
metadataList: Array<Metadata.AsObject>,
}
}
declare class AssistantConversationContext extends jspb.Message {
getId(): string;
setId(value: string): void;
getContext(): string;
setContext(value: string): void;
hasMetadata(): boolean;
clearMetadata(): void;
getMetadata(): google_protobuf_struct_pb.Struct | undefined;
setMetadata(value?: google_protobuf_struct_pb.Struct): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AssistantConversationContext.AsObject;
static toObject(includeInstance: boolean, msg: AssistantConversationContext): AssistantConversationContext.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AssistantConversationContext, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AssistantConversationContext;
static deserializeBinaryFromReader(message: AssistantConversationContext, reader: jspb.BinaryReader): AssistantConversationContext;
}
declare namespace AssistantConversationContext {
export type AsObject = {
id: string,
context: string,
metadata?: google_protobuf_struct_pb.Struct.AsObject,
}
}
declare class AssistantConversation extends jspb.Message {
getId(): string;
setId(value: string): void;
getUserid(): string;
setUserid(value: string): void;
getAssistantid(): string;
setAssistantid(value: string): void;
getName(): string;
setName(value: string): void;
getProjectid(): string;
setProjectid(value: string): void;
getOrganizationid(): string;
setOrganizationid(value: string): void;
getSource(): string;
setSource(value: string): void;
getCreatedby(): string;
setCreatedby(value: string): void;
getUpdatedby(): string;
setUpdatedby(value: string): void;
hasUser(): boolean;
clearUser(): void;
getUser(): User | undefined;
setUser(value?: User): void;
getAssistantprovidermodelid(): string;
setAssistantprovidermodelid(value: string): void;
clearAssistantconversationmessageList(): void;
getAssistantconversationmessageList(): Array<AssistantConversationMessage>;
setAssistantconversationmessageList(value: Array<AssistantConversationMessage>): void;
addAssistantconversationmessage(value?: AssistantConversationMessage, index?: number): AssistantConversationMessage;
getIdentifier(): string;
setIdentifier(value: string): void;
getStatus(): string;
setStatus(value: string): void;
hasCreateddate(): boolean;
clearCreateddate(): void;
getCreateddate(): google_protobuf_timestamp_pb.Timestamp | undefined;
setCreateddate(value?: google_protobuf_timestamp_pb.Timestamp): void;
hasUpdateddate(): boolean;
clearUpdateddate(): void;
getUpdateddate(): google_protobuf_timestamp_pb.Timestamp | undefined;
setUpdateddate(value?: google_protobuf_timestamp_pb.Timestamp): void;
clearContextsList(): void;
getContextsList(): Array<AssistantConversationContext>;
setContextsList(value: Array<AssistantConversationContext>): void;
addContexts(value?: AssistantConversationContext, index?: number): AssistantConversationContext;
clearMetricsList(): void;
getMetricsList(): Array<Metric>;
setMetricsList(value: Array<Metric>): void;
addMetrics(value?: Metric, index?: number): Metric;
clearMetadataList(): void;
getMetadataList(): Array<Metadata>;
setMetadataList(value: Array<Metadata>): void;
addMetadata(value?: Metadata, index?: number): Metadata;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AssistantConversation.AsObject;
static toObject(includeInstance: boolean, msg: AssistantConversation): AssistantConversation.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AssistantConversation, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AssistantConversation;
static deserializeBinaryFromReader(message: AssistantConversation, reader: jspb.BinaryReader): AssistantConversation;
}
declare namespace AssistantConversation {
export type AsObject = {
id: string,
userid: string,
assistantid: string,
name: string,
projectid: string,
organizationid: string,
source: string,
createdby: string,
updatedby: string,
user?: User.AsObject,
assistantprovidermodelid: string,
assistantconversationmessageList: Array<AssistantConversationMessage.AsObject>,
identifier: string,
status: string,
createddate?: google_protobuf_timestamp_pb.Timestamp.AsObject,
updateddate?: google_protobuf_timestamp_pb.Timestamp.AsObject,
contextsList: Array<AssistantConversationContext.AsObject>,
metricsList: Array<Metric.AsObject>,
metadataList: Array<Metadata.AsObject>,
}
}
declare class GetAllAssistantConversationRequest extends jspb.Message {
getAssistantid(): string;
setAssistantid(value: string): void;
hasPaginate(): boolean;
clearPaginate(): void;
getPaginate(): Paginate | undefined;
setPaginate(value?: Paginate): void;
clearCriteriasList(): void;
getCriteriasList(): Array<Criteria>;
setCriteriasList(value: Array<Criteria>): void;
addCriterias(value?: Criteria, index?: number): Criteria;
getSource(): SourceMap[keyof SourceMap];
setSource(value: SourceMap[keyof SourceMap]): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetAllAssistantConversationRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetAllAssistantConversationRequest): GetAllAssistantConversationRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetAllAssistantConversationRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetAllAssistantConversationRequest;
static deserializeBinaryFromReader(message: GetAllAssistantConversationRequest, reader: jspb.BinaryReader): GetAllAssistantConversationRequest;
}
declare namespace GetAllAssistantConversationRequest {
export type AsObject = {
assistantid: string,
paginate?: Paginate.AsObject,
criteriasList: Array<Criteria.AsObject>,
source: SourceMap[keyof SourceMap],
}
}
declare class GetAllAssistantConversationResponse extends jspb.Message {
getCode(): number;
setCode(value: number): void;
getSuccess(): boolean;
setSuccess(value: boolean): void;
clearDataList(): void;
getDataList(): Array<AssistantConversation>;
setDataList(value: Array<AssistantConversation>): void;
addData(value?: AssistantConversation, index?: number): AssistantConversation;
hasError(): boolean;
clearError(): void;
getError(): Error$1 | undefined;
setError(value?: Error$1): void;
hasPaginated(): boolean;
clearPaginated(): void;
getPaginated(): Paginated | undefined;
setPaginated(value?: Paginated): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetAllAssistantConversationResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetAllAssistantConversationResponse): GetAllAssistantConversationResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetAllAssistantConversationResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetAllAssistantConversationResponse;
static deserializeBinaryFromReader(message: GetAllAssistantConversationResponse, reader: jspb.BinaryReader): GetAllAssistantConversationResponse;
}
declare namespace GetAllAssistantConversationResponse {
export type AsObject = {
code: number,
success: boolean,
dataList: Array<AssistantConversation.AsObject>,
error?: Error$1.AsObject,
paginated?: Paginated.AsObject,
}
}
declare class GetAllConversationMessageRequest extends jspb.Message {
getAssistantid(): string;
setAssistantid(value: string): void;
getAssistantconversationid(): string;
setAssistantconversationid(value: string): void;
hasPaginate(): boolean;
clearPaginate(): void;
getPaginate(): Paginate | undefined;
setPaginate(value?: Paginate): void;
clearCriteriasList(): void;
getCriteriasList(): Array<Criteria>;
setCriteriasList(value: Array<Criteria>): void;
addCriterias(value?: Criteria, index?: number): Criteria;
hasOrder(): boolean;
clearOrder(): void;
getOrder(): Ordering | undefined;
setOrder(value?: Ordering): void;
getSource(): SourceMap[keyof SourceMap];
setSource(value: SourceMap[keyof SourceMap]): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetAllConversationMessageRequest.AsObject;
static toObject(includeInstance: boolean, msg: GetAllConversationMessageRequest): GetAllConversationMessageRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetAllConversationMessageRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetAllConversationMessageRequest;
static deserializeBinaryFromReader(message: GetAllConversationMessageRequest, reader: jspb.BinaryReader): GetAllConversationMessageRequest;
}
declare namespace GetAllConversationMessageRequest {
export type AsObject = {
assistantid: string,
assistantconversationid: string,
paginate?: Paginate.AsObject,
criteriasList: Array<Criteria.AsObject>,
order?: Ordering.AsObject,
source: SourceMap[keyof SourceMap],
}
}
declare class GetAllConversationMessageResponse extends jspb.Message {
getCode(): number;
setCode(value: number): void;
getSuccess(): boolean;
setSuccess(value: boolean): void;
clearDataList(): void;
getDataList(): Array<AssistantConversationMessage>;
setDataList(value: Array<AssistantConversationMessage>): void;
addData(value?: AssistantConversationMessage, index?: number): AssistantConversationMessage;
hasError(): boolean;
clearError(): void;
getError(): Error$1 | undefined;
setError(value?: Error$1): void;
hasPaginated(): boolean;
clearPaginated(): void;
getPaginated(): Paginated | undefined;
setPaginated(value?: Paginated): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GetAllConversationMessageResponse.AsObject;
static toObject(includeInstance: boolean, msg: GetAllConversationMessageResponse): GetAllConversationMessageResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: GetAllConversationMessageResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): GetAllConversationMessageResponse;
static deserializeBinaryFromReader(message: GetAllConversationMessageResponse, reader: jspb.BinaryReader): GetAllConversationMessageResponse;
}
declare namespace GetAllConversationMessageResponse {
export type AsObject = {
code: number,
success: boolean,
dataList: Array<AssistantConversationMessage.AsObject>,
error?: Error$1.AsObject,
paginated?: Paginated.AsObject,
}
}
interface SourceMap {
WEB_PLUGIN: 0;
RAPIDA_APP: 1;
PYTHON_SDK: 2;
NODE_SDK: 3;
GO_SDK: 4;
TYPESCRIPT_SDK: 5;
JAVA_SDK: 6;
PHP_SDK: 7;
RUST_SDK: 8;
}
// package: talk_api
// file: talk-api.proto
declare class AssistantDefinition extends jspb.Message {
getAssistantid(): string;
setAssistantid(value: string): void;
getVersion(): string;
setVersion(value: string): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AssistantDefinition.AsObject;
static toObject(includeInstance: boolean, msg: AssistantDefinition): AssistantDefinition.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AssistantDefinition, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AssistantDefinition;
static deserializeBinaryFromReader(message: AssistantDefinition, reader: jspb.BinaryReader): AssistantDefinition;
}
declare namespace AssistantDefinition {
export type AsObject = {
assistantid: string,
version: string,
}
}
declare class AssistantMessagingRequest extends jspb.Message {
hasAssistant(): boolean;
clearAssistant(): void;
getAssistant(): AssistantDefinition | undefined;
setAssistant(value?: AssistantDefinition): void;
hasMessage(): boolean;
clearMessage(): void;
getMessage(): Message | undefined;
setMessage(value?: Message): void;
hasAssistantconversationid(): boolean;
clearAssistantconversationid(): void;
getAssistantconversationid(): string;
setAssistantconversationid(value: string): void;
getMetadataMap(): jspb.Map<string, google_protobuf_any_pb.Any>;
clearMetadataMap(): void;
getSource(): SourceMap[keyof SourceMap];
setSource(value: SourceMap[keyof SourceMap]): void;
getArgsMap(): jspb.Map<string, google_protobuf_any_pb.Any>;
clearArgsMap(): void;
getOptionsMap(): jspb.Map<string, google_protobuf_any_pb.Any>;
clearOptionsMap(): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AssistantMessagingRequest.AsObject;
static toObject(includeInstance: boolean, msg: AssistantMessagingRequest): AssistantMessagingRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AssistantMessagingRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AssistantMessagingRequest;
static deserializeBinaryFromReader(message: AssistantMessagingRequest, reader: jspb.BinaryReader): AssistantMessagingRequest;
}
declare namespace AssistantMessagingRequest {
export type AsObject = {
assistant?: AssistantDefinition.AsObject,
message?: Message.AsObject,
assistantconversationid: string,
metadataMap: Array<[string, google_protobuf_any_pb.Any.AsObject]>,
source: SourceMap[keyof SourceMap],
argsMap: Array<[string, google_protobuf_any_pb.Any.AsObject]>,
optionsMap: Array<[string, google_protobuf_any_pb.Any.AsObject]>,
}
}
declare class AssistantMessagingResponse extends jspb.Message {
getCode(): number;
setCode(value: number): void;
getSuccess(): boolean;
setSuccess(value: boolean): void;
hasError(): boolean;
clearError(): void;
getError(): Error$1 | undefined;
setError(value?: Error$1): void;
hasMessage(): boolean;
clearMessage(): void;
getMessage(): AssistantConversationMessage | undefined;
setMessage(value?: AssistantConversationMessage): void;
hasEvent(): boolean;
clearEvent(): void;
getEvent(): Event | undefined;
setEvent(value?: Event): void;
getDataCase(): AssistantMessagingResponse.DataCase;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): AssistantMessagingResponse.AsObject;
static toObject(includeInstance: boolean, msg: AssistantMessagingResponse): AssistantMessagingResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: AssistantMessagingResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): AssistantMessagingResponse;
static deserializeBinaryFromReader(message: AssistantMessagingResponse, reader: jspb.BinaryReader): AssistantMessagingResponse;
}
declare namespace AssistantMessagingResponse {
export type AsObject = {
code: number,
success: boolean,
error?: Error$1.AsObject,
message?: AssistantConversationMessage.AsObject,
event?: Event.AsObject,
}
export enum DataCase {
DATA_NOT_SET = 0,
MESSAGE = 3,
EVENT = 5,
}
}
declare class CreateMessageMetricRequest extends jspb.Message {
getAssistantid(): string;
setAssistantid(value: string): void;
getAssistantconversationid(): string;
setAssistantconversationid(value: string): void;
getMessageid(): string;
setMessageid(value: string): void;
clearMetricsList(): void;
getMetricsList(): Array<Metric>;
setMetricsList(value: Array<Metric>): void;
addMetrics(value?: Metric, index?: number): Metric;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreateMessageMetricRequest.AsObject;
static toObject(includeInstance: boolean, msg: CreateMessageMetricRequest): CreateMessageMetricRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CreateMessageMetricRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreateMessageMetricRequest;
static deserializeBinaryFromReader(message: CreateMessageMetricRequest, reader: jspb.BinaryReader): CreateMessageMetricRequest;
}
declare namespace CreateMessageMetricRequest {
export type AsObject = {
assistantid: string,
assistantconversationid: string,
messageid: string,
metricsList: Array<Metric.AsObject>,
}
}
declare class CreateMessageMetricResponse extends jspb.Message {
getCode(): number;
setCode(value: number): void;
getSuccess(): boolean;
setSuccess(value: boolean): void;
clearDataList(): void;
getDataList(): Array<Metric>;
setDataList(value: Array<Metric>): void;
addData(value?: Metric, index?: number): Metric;
hasError(): boolean;
clearError(): void;
getError(): Error$1 | undefined;
setError(value?: Error$1): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreateMessageMetricResponse.AsObject;
static toObject(includeInstance: boolean, msg: CreateMessageMetricResponse): CreateMessageMetricResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CreateMessageMetricResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreateMessageMetricResponse;
static deserializeBinaryFromReader(message: CreateMessageMetricResponse, reader: jspb.BinaryReader): CreateMessageMetricResponse;
}
declare namespace CreateMessageMetricResponse {
export type AsObject = {
code: number,
success: boolean,
dataList: Array<Metric.AsObject>,
error?: Error$1.AsObject,
}
}
declare class CreateConversationMetricRequest extends jspb.Message {
getAssistantid(): string;
setAssistantid(value: string): void;
getAssistantconversationid(): string;
setAssistantconversationid(value: string): void;
clearMetricsList(): void;
getMetricsList(): Array<Metric>;
setMetricsList(value: Array<Metric>): void;
addMetrics(value?: Metric, index?: number): Metric;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreateConversationMetricRequest.AsObject;
static toObject(includeInstance: boolean, msg: CreateConversationMetricRequest): CreateConversationMetricRequest.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CreateConversationMetricRequest, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreateConversationMetricRequest;
static deserializeBinaryFromReader(message: CreateConversationMetricRequest, reader: jspb.BinaryReader): CreateConversationMetricRequest;
}
declare namespace CreateConversationMetricRequest {
export type AsObject = {
assistantid: string,
assistantconversationid: string,
metricsList: Array<Metric.AsObject>,
}
}
declare class CreateConversationMetricResponse extends jspb.Message {
getCode(): number;
setCode(value: number): void;
getSuccess(): boolean;
setSuccess(value: boolean): void;
clearDataList(): void;
getDataList(): Array<Metric>;
setDataList(value: Array<Metric>): void;
addData(value?: Metric, index?: number): Metric;
hasError(): boolean;
clearError(): void;
getError(): Error$1 | undefined;
setError(value?: Error$1): void;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CreateConversationMetricResponse.AsObject;
static toObject(includeInstance: boolean, msg: CreateConversationMetricResponse): CreateConversationMetricResponse.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: CreateConversationMetricResponse, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): CreateConversationMetricResponse;
static deserializeBinaryFromReader(message: CreateConversationMetricResponse, reader: jspb.BinaryReader): CreateConversationMetricResponse;
}
declare namespace CreateConversationMetricResponse {
export type AsObject = {
code: number,
success: boolean,
dataList: Array<Metric.AsObject>,
error?: Error$1.AsObject,
}
}
/**
* Output of AudioAnalysis for the frequency domain of the audio
*/
type AudioAnalysisOutputType = {
/**
* Amplitude of this frequency between {0, 1} inclusive
*/
values: Float32Array;
/**
* Raw frequency bucket values
*/
frequencies: number[];
/**
* Labels for the frequency bucket values
*/
labels: string[];
};
/**
* Raw wav audio file contents
*/
type WavPackerAudioType = {
blob: Blob;
url: string;
channelCount: number;
sampleRate: number;
duration: number;
};
/**
* Plays audio streams received in raw PCM16 chunks from the browser
* @class
*/
declare class WavStreamPlayer {
/**
* Creates a new WavStreamPlayer instance
* @param {{sampleRate?: number}} options
* @returns {WavStreamPlayer}
*/
constructor({ sampleRate }?: {
sampleRate?: number;
});
scriptSrc: string;
sampleRate: number;
context: AudioContext | null;
stream: AudioWorkletNode | null;
analyser: AnalyserNode | null;
trackSampleOffsets: {};
interruptedTrackIds: {};
/**
* Connects the audio context and enables output to speakers
* @returns {Promise<true>}
*/
connect(deviceId?: string): Promise<true>;
/**
* if user want to change the device id that is needed for the user
* @param deviceId
*/
changeDeviceId(deviceId: any): Promise<void>;
/**
* Gets the current frequency domain data from the playing track
* @param {"frequency"|"music"|"voice"} [analysisType]
* @param {number} [minDecibels] default -100
* @param {number} [maxDecibels] default -30
* @returns {import('./analysis/audio_analysis.js').AudioAnalysisOutputType}
*/
getFrequencies(analysisType?: "frequency" | "music" | "voice", minDecibels?: number, maxDecibels?: number): AudioAnalysisOutputType;
/**
* Starts audio streaming
* @private
* @returns {Promise<true>}
*/
private _start;
/**
* Adds 16BitPCM data to the currently playing audio stream
* You can add chunks beyond the current play point and they will be queued for play
* @param {ArrayBuffer|Int16Array} arrayBuffer
* @param {string} [trackId]
* @returns {Int16Array}
*/
add16BitPCM(arrayBuffer: ArrayBuffer | Int16Array, trackId?: string): Int16Array;
/**
* Gets the offset (sample count) of the currently playing stream
* @param {boolean} [interrupt]
* @returns {{trackId: string|null, offset: number, currentTime: number}}
*/
getTrackSampleOffset(interrupt?: boolean): {
trackId: string | null;
offset: number;
currentTime: number;
};
/**
* Strips the current stream and returns the sample offset of the audio
* @param {boolean} [interrupt]
* @returns {{trackId: string|null, offset: number, currentTime: number}}
*/
interrupt(): {
trackId: string | null;
offset: number;
currentTime: number;
};
}
/**
* Decodes audio into a wav file
* @typedef {Object} DecodedAudioType
* @property {Blob} blob
* @property {string} url
* @property {Float32Array} values
* @property {AudioBuffer} audioBuffer
*/
/**
* Records live stream of user audio as PCM16 "audio/wav" data
* @class
*/
declare class WavRecorder {
/**
* Decodes audio data from multiple formats to a Blob, url, Float32Array and AudioBuffer
* @param {Blob|Float32Array|Int16Array|ArrayBuffer|number[]} audioData
* @param {number} sampleRate
* @param {number} fromSampleRate
* @returns {Promise<DecodedAudioType>}
*/
static decode(audioData: Blob | Float32Array | Int16Array | ArrayBuffer | number[], sampleRate?: number, fromSampleRate?: number): Promise<DecodedAudioType>;
/**
* Create a new WavRecorder instance
* @param {{sampleRate?: number, outputToSpeakers?: boolean, debug?: boolean}} [options]
* @returns {WavRecorder}
*/
constructor({ sampleRate, outputToSpeakers, debug, }?: {
sampleRate?: number;
outputToSpeakers?: boolean;
debug?: boolean;
});
scriptSrc: string;
sampleRate: number;
outputToSpeakers: boolean;
debug: boolean;
_deviceChangeCallback: (() => Promise<void>) | null;
_devices: any[];
stream: MediaStream | null;
processor: AudioWorkletNode | null;
source: MediaStreamAudioSourceNode | null;
node: AudioNode | null;
recording: boolean;
_lastEventId: number;
eventReceipts: {};
eventTimeout: number;
_chunkProcessor: () => void;
_chunkProcessorBuffer: {
raw: ArrayBuffer;
mono: ArrayBuffer;
};
/**
* Logs data in debug mode
* @param {...any} arguments
* @returns {true}
*/
log(...args: any[]): true;
/**
* Retrieves the current sampleRate for the recorder
* @returns {number}
*/
getSampleRate(): number;
/**
* Retrieves the current status of the recording
* @returns {"ended"|"paused"|"recording"}
*/
getStatus(): "ended" | "paused" | "recording";
/**
* Sends an event to the AudioWorklet
* @private
* @param {string} name
* @param {{[key: string]: any}} data
* @param {AudioWorkletNode} [_processor]
* @returns {Promise<{[key: string]: any}>}
*/
private _event;
/**
* Sets device change callback, remove if callback provided is `null`
* @param {(Array<MediaDeviceInfo & {default: boolean}>): void|null} callback
* @returns {true}
*/
listenForDeviceChange(callback: any): true;
/**
* Manually request permission to use the microphone
* @returns {Promise<true>}
*/
requestPermission(): Promise<true>;
/**
* List all eligible devices for recording, will request permission to use microphone
* @returns {Promise<Array<MediaDeviceInfo & {default: boolean}>>}
*/
listDevices(): Promise<Array<MediaDeviceInfo & {
default: boolean;
}>>;
/**
* Begins a recording session and requests microphone permissions if not already granted
* Microphone recording indicator will appear on browser tab but status will be "paused"
* @param {string} [deviceId] if no device provided, default device will be used
* @returns {Promise<true>}
*/
begin(deviceId?: string): Promise<true>;
analyser: AnalyserNode | undefined;
/**
* Gets the current frequency domain data from the recording track
* @param {"frequency"|"music"|"voice"} [analysisType]
* @param {number} [minDecibels] default -100
* @param {number} [maxDecibels] default -30
* @returns {import('./analysis/audio_analysis.js').AudioAnalysisOutputType}
*/
getFrequencies(analysisType?: "frequency" | "music" | "voice", minDecibels?: number, maxDecibels?: number): AudioAnalysisOutputType;
/**
* Pauses the recording
* Keeps microphone stream open but halts storage of audio
* @returns {Promise<true>}
*/
pause(): Promise<true>;
/**
* Start recording stream and storing to memory from the connected audio source
* @param {(data: { mono: Int16Array; raw: Int16Array }) => any} [chunkProcessor]
* @param {number} [chunkSize] chunkProcessor will not be triggered until this size threshold met in mono audio
* @returns {Promise<true>}
*/
record(chunkProcessor?: (data: {
mono: Int16Array;
raw: Int16Array;
}) => any, chunkSize?: number): Promise<true>;
_chunkProcessorSize: number | undefined;
/**
* Clears the audio buffer, empties stored recording
* @returns {Promise<true>}
*/
clear(): Promise<true>;
/**
* Reads the current audio stream data
* @returns {Promise<{meanValues: Float32Array, channels: Array<Float32Array>}>}
*/
read(): Promise<{
meanValues: Float32Array;
channels: Array<Float32Array>;
}>;
/**
* Saves the current audio stream to a file
* @param {boolean} [force] Force saving while still recording
* @returns {Promise<import('./wav_packer.js').WavPackerAudioType>}
*/
save(force?: boolean): Promise<WavPackerAudioType>;
/**
* Ends the current recording session and saves the result
* @returns {Promise<import('./wav_packer.js').WavPackerAudioType>}
*/
end(): Promise<WavPackerAudioType>;
/**
* Performs a full cleanup of WavRecorder instance
* Stops actively listening via microphone and removes existing listeners
* @returns {Promise<true>}
*/
quit(): Promise<true>;
}
/**
* Decodes audio into a wav file
*/
type DecodedAudioType = {
blob: Blob;
url: string;
values: Float32Array;
audioBuffer: AudioBuffer;
};
declare enum Channel {
Text = "text",
Audio = "audio"
}
/**
* Callbacks for agent
*/
interface AgentCallback {
onStart?: (args: google_protobuf_struct_pb.Struct | undefined) => void;
onComplete?: (args: google_protobuf_struct_pb.Struct | undefined) => void;
onTranscript?: (args: google_protobuf_struct_pb.Struct | undefined) => void;
onInterrupt?: (args: google_protobuf_struct_pb.Struct | undefined) => void;
onGeneration?: (args: google_protobuf_struct_pb.Struct | undefined) => void;
onCompleteGeneration?: (args: google_protobuf_struct_pb.Struct | undefined) => void;
onStartConversation?: (args: google_protobuf_struct_pb.Struct | undefined) => void;
onCompleteConversation?: (args: google_protobuf_struct_pb.Struct | undefined) => void;
onMessage?: (arg: AssistantConversationMessage | undefined) => void;
}
/**
*
*/
interface PlayerOptions {
sampleRate: number;
}
/**
*
*/
interface RecorderOptions {
sampleRate: number;
}
/**
*
*/
declare class InputOptions {
/**
* enable channels
*/
channels: Channel[];
/**
* sample rate for player
*/
protected recorderOptions: RecorderOptions;
get recorderOption(): RecorderOptions;
/**
* channel for providing output
*/
protected channel: Channel;
get defaultChannel(): Channel;
/**
* device that will be ouput the media
*/
protected deviceId?: string;
get inputDeviceId(): string;
/**
*
* @param deviceId
*/
setDeviceId(deviceId: string): void;
/**
*
* @param channels
* @param channel
* @param deviceId
*/
constructor(channels: Channel[], channel?: Channel, deviceId?: string);
/**
*
* @param channel
*/
changeChannel(channel: Channel): void;
/**
*
* @param device
*/
changeDevice(device: string): void;
}
declare class OutputOptions {
/**
* enable channels
*/
channels: Channel[];
/**
* sample rate for player
*/
protected playerOptions: PlayerOptions;
get playerOption(): PlayerOptions;
/**
* channel for providing output
*/
protected channel: Channel;
get defaultChannel(): Channel;
/**
* device that will be ouput the media
*/
protected deviceId?: string;
get outputDeviceId(): string;
/**
*
* @param channels
* @param channel
* @param deviceId
*/
constructor(channels: Channel[], channel?: Channel, deviceId?: string);
/**
*
* @param channel
*/
changeChannel(channel: Channel): void;
/**
*
* @param deviceId
*/
setDeviceId(deviceId: string): void;
/**
*
* @param device
*/
changeDevice(device: string): void;
}
/**
* Represents the configuration settings for an agent.
* This includes the agent's unique identifier, version, and configurable arguments.
*/
declare class AgentConfig {
/**
* Unique identifier for the agent.
*/
id: string;
/**
* (Optional) Version number of the agent.
*/
version?: string;
/**
* arguments for assistant
*/
arguments?: Map<string, google_protobuf_any_pb.Any>;
/**
* options for assistants
*/
options?: Map<string, google_protobuf_any_pb.Any>;
/**
* metadata for assistant request
*/
metadata?: Map<string, google_protobuf_any_pb.Any>;
/**
* all the agent callback
*/
callbacks?: AgentCallback;
/**
*
*/
inputOptions: InputOptions;
/**
*
*/
outputOptions: OutputOptions;
/**
* Initializes a new instance of `AgentConfig`.
*
* @param id - Unique identifier for the agent.
* @param version - (Optional) Version number of the agent.
* @param argument - (Optional) Configuration arguments for the agent.
*/
constructor(id: string, inputOptions?: InputOptions, outputOptions?: OutputOptions, version?: string, argument?: Map<string, google_protobuf_any_pb.Any>, options?: Map<string, google_protobuf_any_pb.Any>, metadata?: Map<string, google_protobuf_any_pb.Any>);
/**
* Retrieves the assistant definition for this agent.
*
* @returns {AssistantDefinition} A configured `AssistantDefinition` instance with the agent's details.
*/
get definition(): AssistantDefinition;
/**
* for adding custom dictionary
* it allows user to add custom keywords to given agent it will perform correction
* @param keywords
*/
addKeywords(keywords: string[]): this;
/**
* Want to add other options to override
* @param k
* @param otp
* @returns
*/
addCustomOption(k: string, otp: google_protobuf_any_pb.Any): this;
/**
*
* @param k
* @param meta
* @returns
*/
addMetadata(k: string, meta: google_protobuf_any_pb.Any): this;
/**
*
* @param k
* @param value
* @returns
*/
addArgument(k: string, value: string): this;
/**
* Sets up callback functions for various events in the agent's conversation lifecycle.
*
* @param onStartConversation - Callback function triggered when a conversation starts.
* @param onInterruption - Callback function triggered when the conversation is interrupted.
* @param onListen - Callback function triggered when the agent starts listening.
* @param onComplete - Callback function triggered when a specific action or process is completed.
* @param onReceiveTranscript - Callback function triggered when a transcript is received.
* @param onReceive - Callback function triggered when any message is received.
* @param onSendGeneration - Callback function triggered before sending a generated response.
* @param onCompleteGeneration - Callback function triggered after completing the generation of a response.
* @param onCompleteConversation - Callback function triggered when the entire conversation is completed.
* @returns The current instance of the AgentConfig, allowing for method chaining.
*/
withAgentCallback(cl: AgentCallback): this;
/**
*
* @param response
* @returns
*/
onCallback(response: AssistantMessagingResponse): void;
}
// package: talk_api
// file: talk-api.proto
type ServiceError = { message: string, code: number; metadata: grpc.Metadata }
type Status = { details: string, code: number; metadata: grpc.Metadata }
interface UnaryResponse {
cancel(): void;
}
interface ResponseStream<T> {
cancel(): void;
on(type: 'data', handler: (message: T) => void): ResponseStream<T>;
on(type: 'end', handler: (status?: Status) => void): ResponseStream<T>;
on(type: 'status', handler: (status: Status) => void): ResponseStream<T>;
}
interface BidirectionalStream<ReqT, ResT> {
write(message: ReqT): BidirectionalStream<ReqT, ResT>;
end(): void;
cancel(): void;
on(type: 'data', handler: (message: ResT) => void): BidirectionalStream<ReqT, ResT>;
on(type: 'end', handler: (status?: Status) => void): BidirectionalStream<ReqT, ResT>;
on(type: 'status', handler: (status: Status) => void): BidirectionalStream<ReqT, ResT>;
}
declare class TalkServiceClient {
readonly serviceHost: string;
constructor(serviceHost: string, options?: grpc.RpcOptions);
assistantMessaging(requestMessage: AssistantMessagingRequest, metadata?: grpc.Metadata): ResponseStream<AssistantMessagingResponse>;
assistantTalk(metadata?: grpc.Metadata): BidirectionalStream<AssistantMessagingRequest, AssistantMessagingResponse>;
getAllAssistantConversation(
requestMessage: GetAllAssistantConversationRequest,
metadata: grpc.Metadata,
callback: (error: ServiceError|null, responseMessage: GetAllAssistantConversationResponse|null) => void
): UnaryResponse;
getAllAssistantConversation(
requestMessage: GetAllAssistantConversationRequest,
callback: (error: ServiceError|null, responseMessage: GetAllAssistantConversationResponse|null) => void
): UnaryResponse;
getAllConversationMessage(
requestMessage: GetAllConversationMessageRequest,
metadata: grpc.Metadata,
callback: (error: ServiceError|null, responseMessage: GetAllConversationMessageResponse|null) => void
): UnaryResponse;
getAllConversationMessage(
requestMessage: GetAllConversationMessageRequest,
callback: (error: ServiceError|null, responseMessage: GetAllConversationMessageResponse|null) => void
): UnaryResponse;
createMessageMetric(
requestMessage: CreateMessageMetricRequest,
metadata: grpc.Metadata,
callback: (error: ServiceError|null, responseMessage: CreateMessageMetricResponse|null) => void
): UnaryResponse;
createMessageMetric(
requestMessage: CreateMessageMetricRequest,
callback: (error: ServiceError|null, responseMessage: CreateMessageMetricResponse|null) => void
): UnaryResponse;
createConversationMetric(
requestMessage: CreateConversationMetricRequest,
metadata: grpc.Metadata,
callback: (error: ServiceError|null, responseMessage: CreateConversationMetricResponse|null) => void
): UnaryResponse;
createConversationMetric(
requestMessage: CreateConversationMetricRequest,
callback: (error: ServiceError|null, responseMessage: CreateConversationMetricResponse|null) => void
): UnaryResponse;
}
declare const HEADER_AUTH_ID = "x-auth-id";
declare const HEADER_PROJECT_ID = "x-project-id";
declare const HEADER_API_KEY = "x-api-key";
declare const HEADER_SOURCE_KEY = "x-client-source";
type RapidaSource = 'web-plugin' | 'debugger' | 'rapida-app' | 'node-sdk' | 'go-sdk' | 'typescript-sdk' | 'java-sdk' | 'php-sdk' | 'rust-sdk' | 'python-sdk';
/**
* an client information that will help to create an authentication token and header informatioan
*/
interface UserAuthInfo {
authorization: string;
[HEADER_AUTH_ID]: string;
[HEADER_PROJECT_ID]?: string;
[HEADER_SOURCE_KEY]?: RapidaSource;
}
interface ClientAuthInfo {
[HEADER_API_KEY]: string;
[HEADER_AUTH_ID]?: string;
[HEADER_SOURCE_KEY]?: RapidaSource;
}
declare enum ConnectionState {
Disconnected = "disconnected",
Connected = "connected"
}
/**
*
*/
interface ConnectionCallback {
/**
*
* @returns
*/
onError?: () => void;
/**
*
* @returns
*/
onConnect?: () => void;
/**
*
* @returns
*/
onDisconnect?: () => void;
}
/**
* Represents a connection to the TalkService, providing both a conversation client
* and a streaming client for real-time communication.
*/
declare class ConnectionConfig {
/**
* gRPC client for handling real-time streaming interactions.
*/
streamClient: TalkServiceClient;
/**
* gRPC client for handling standard conversation requests.
*/
conversationClient: TalkServiceClient;
/**
* Authentication information for the client, supporting both client and user authentication.
*/
auth: ClientAuthInfo | UserAuthInfo;
/**
*
*/
callbacks?: ConnectionCallback;
/**
* Creates a new Connection instance, initializing the conversation and streaming clients.
*
* @param auth - Authentication information for the connection.
* @param endpoint - (Optional) Custom API endpoint for connecting to the TalkService.
* If not provided, it defaults to `ASSISTANT_API`.
*/
constructor(auth: ClientAuthInfo | UserAuthInfo, endpoint?: string);
/**
* Only for testing
* @returns
*/
withLocal(): this;
/**
* On premise deployment options
* @param endpoint
* @returns
*/
withCustomEndpoint(endpoint: string): this;
/**
* Configures connection callbacks for the TalkService clients.
*
* @param onConnect - A callback function to be executed when a connection is established.
* @param onDisconnect - A callback function to be executed when the connection is terminated.
* @param onError - A callback function to be executed when the connection is terminated.
*
* @returns - The current instance of `ConnectionConfig` for method chaining.
*
* @example
* ```typescript
* const connection = new ConnectionConfig(auth);
* connection.withConnectionCallback(
* () => { console.log("Connected to the TalkService"); },
* () => { console.log("Disconnected from the TalkService"); }
* );
* ```
*/
withConnectionCallback(cl: ConnectionCallback): this;
onConnectionChange(connection: ConnectionState): void;
}
/**
* Enum representing various server events related to agent interactions.
* These events are used to track and manage different stages of a conversation
* or interaction between an agent and a user.
*/
declare enum AgentServerEvent {
Interruption = "talk.onInterrupt",
Transcript = "talk.onTranscript",
Start = "talk.onStart",
Complete = "talk.onComplete",
Generation = "talk.onGeneration",
CompleteGeneration = "talk.onCompleteGeneration",
StartConversation = "talk.onStartConversation",
CompleteConversation = "talk.onCompleteConversation"
}
/**
* Defines the structure for callback functions used in voice agent events.
*
* This type encapsulates various event handlers that can be triggered during
* the lifecycle of a voice agent connection. It includes callbacks for:
*
* - Connection establishment and termination
* - Data reception
* - Active device changes
* - Mute status changes
* - Connection state updates
* - Server-side events
*
* These callbacks allow for fine-grained control and monitoring of the voice
* agent's state and interactions, enabling developers to build responsive
* and interactive voice-enabled applications.
*/
type AgentEventCallback = {
onConnected: () => void;
onDisconnected: () => void;
onConnectionChanged: (state: ConnectionState) => void;
onDataReceived: () => void;
onInputMediaDeviceChanged: (deviceId: string) => void;
onOutputMediaDeviceChanged: (deviceId: string) => void;
onAudioInputMuteToggle: (isMuted: boolean) => void;
onAudioOutputMuteToggle: (isMuted: boolean) => void;
onInputChannelSwitch: (cnl: Channel) => void;
onOutputChannelSwitch: (cnl: Channel) => void;
onServerEvent: (eventType: AgentServerEvent, event: Event) => void;
onMessageFeedback: (feedback: Feedback) => void;
onConversationFeedback: (feedback: Feedback) => void;
};
declare const Agent_base: new () => TypedEmitter<AgentEventCallback>;
declare class Agent extends Agent_base {
/**
* connection state default connection is disconnected
*/
state: ConnectionState;
/**
* conversation id
*/
protected agentMessagingId: string | undefined;
get conversationId(): string | undefined;
/**
*
* @param assistantConversationId
* @returns
*/
protected onChangeConversation: (assistantConversationId: string) => void;
/**
* an connection for talking client
* when you are conversing with agent then this client will get used
* work with bi-driectional request <> response
*/
protected talkingConnection: any;
protected agentConfig: AgentConfig;
protected connectionConfig: ConnectionConfig;
/**
*
*/
protected agentEvents: Event[];
get events(): Event[];
/**
*
*/
protected agentMessages: Message$1[];
get messages(): Message$1[];
/**
*
*/
protected agentTranscript: string;
get transcript(): string;
/**
*
* @param connection
* @param agentConfig
* @param onRecieve
*/
protected constructor(connection: ConnectionConfig, agentConfig: AgentConfig);
/**
* Message builder
* @param role
* @param contents
* @returns
*/
protected createAssistantRequest: (role: string, contents: Content[]) => AssistantMessagingRequest;
/**
* After changing connection emit the connection change event with curent state of connection
* @param state
* @returns
*/
protected setAndEmitConnectionState(state: ConnectionState): boolean;
/**
*
* @param messageId
* @param metrics
*/
createMessageMetric(messageId: string, metrics: {
name: string;
description: string;
value: string;
}[]): void;
/**
*
* @param metrics
*/
createConversationMetric(metrics: {
name: string;
description: string;
value: string;
}[]): void;
/**
*
* @param event
* @param args
* @returns
*/
emit<E extends keyof AgentEventCallback>(event: E, ...args: Parameters<AgentEventCallback[E]>): boolean;
/**
*
*/
get isConnected(): boolean;
/**
*
*/
protected connectAgent: () => Promise<void>;
protected disconnectAgent: () => Promise<void>;
/**
* call it when end of stream
*/
private onEnd;
private onStatusChange;
/**
*
* @param response
* @returns
*/
protected onDataChange: (response: AssistantMessagingResponse) => Promise<void>;
/**
*
* @param response
*/
onRecieve(_: AssistantMessagingResponse): void;
}
declare class VoiceAgent extends Agent {
/**
* input media device id
*/
inputChannel: Channel;
private audioInputPaused;
private inputDeviceId;
get inputMediaDevice(): string;
private audioRecorder;
get recorder(): WavRecorder;
/**
* output media device id
*/
private outputChannel;
private audioOutputPaused;
private outputDeviceId;
get outputMediaDevice(): string;
private audioPlayer;
get player(): WavStreamPlayer;
/**
* Creates a new Room, the primary construct for a LiveKit session.
* @param options
*/
constructor(connection: ConnectionConfig, agentConfig: AgentConfig);
disconnect(): Promise<void>;
connect: () => Promise<void>;
/**
*
* Audio recording stop and start function controlling jus when audio will start and stop
* doesn't mean connect
* start the reocrding for audio recorder
* @param clear
*/
private startRecording;
private stopRecording;
/**
*
* @param text
*/
onSendText: (text: string) => Promise<void>;
/**
*
* @param mono
*/
private onSendAudio;
private createAudioMessage;
base64ToArrayBuffer(base64: any): ArrayBuffer;
/**
*
* @param float32Array
* @returns
*/
floatTo16BitPCM(float32Array: any): ArrayBuffer;
/**
* Converts an ArrayBuffer, Int16Array or Float32Array to a base64 string
* @param {ArrayBuffer|Int16Array|Float32Array} arrayBuffer
* @returns {string}
*/
private arrayBufferToUint8;
/**
* Getting all the list of deviceid
* @param kind
* @param requestPermissions
* @returns
*/
static getLocalDevices(kind?: MediaDeviceKind, requestPermissions?: boolean): Promise<MediaDeviceInfo[]>;
/**
* changing the deviceid
* @param deviceId the device id
*/
setOutputMediaDevice: (deviceId: string) => Promise<void>;
/**
* Changing media device id
* @param deviceId
* @returns
*/
setInputMediaDevice: (deviceId: string) => Promise<void>;
/**
*
* @param input
* @returns
*/
setInputChannel: (input: Channel) => Promise<void>;
/**
*
* @param output
* @returns
*/
setOutputChannel(output: Channel): void;
/**
* Input for the voice agent
* to check if audio in or text in
*/
toggelAudioInput: () => Promise<void>;
get isAudioInput(): boolean;
get isAudioInputEnable(): boolean;
/**
* if text channel enable
*/
get isTextInput(): boolean;
/**
* output for voice agent
*/
toggelAudioOutput: () => Promise<void>;
/**
* if ouput audio is enabled
*/
get isAudioOutput(): boolean;
get isAudioOutputEnable(): boolean;
get isTextOutput(): boolean;
onRecieve: (response: AssistantMessagingResponse) => Promise<void>;
}
/** @public */
declare const VoiceAgentContext: React.Context<VoiceAgent | undefined>;
/**
* Returns the room context if it exists, otherwise undefined.
* @public
*/
declare function useMaybeVoiceAgent(): VoiceAgent | undefined;
/**
* Ensures that a room is provided, either via context or explicitly as a parameter.
* If no room is provided, an error is thrown.
* @public
*/
declare function useEnsureVoiceAgent(agent?: VoiceAgent): VoiceAgent;
/**
* Custom hook for managing agent connection in a voice system.
* @returns An object containing the connection handler and connection status.
*/
declare function useMessageFeedback(): {
handleMessageFeedback: (messageId: string, name: string, description: string, value: string) => Promise<void>;
handleHelpfulnessFeedback: (messageId: string, value: Feedback) => Promise<void>;
};
/**
* Custom hook for managing agent connection in a voice system.
* @returns An object containing the connection handler and connection status.
*/
declare function useConversationFeedback(): {
handleHelpfulnessFeedback: (value: Feedback) => Promise<void>;
handleConversationFeedback: (name: string, description: string, value: string) => Promise<void>;
};
/**
* Custom hook for managing agent connection in a voice system.
* @returns An object containing the connection handler and connection status.
*/
declare function useConnectAgent(): {
handleConnectAgent: (agent: VoiceAgent) => Promise<void>;
handleDisconnectAgent: (agent: VoiceAgent) => Promise<void>;
isConnected: boolean;
};
declare function useInputModeToggleAgent(): {
handleTextToggle: (agent: VoiceAgent) => Promise<void>;
handleVoiceToggle: (agent: VoiceAgent) => Promise<void>;
channel: Channel;
};
/**
* use speaker toggle agent
* @returns
*/
declare function useSpeakerOuputToggleAgent(): {
handleSpeakerOuputToggleAgent: (agent: VoiceAgent) => Promise<void>;
isEnable: boolean;
};
/** @public */
interface UseMediaDeviceSelectProps {
/**
* this will call getUserMedia if the permissions are not yet given to enumerate the devices with device labels.
* in some browsers multiple calls to getUserMedia result in multiple permission prompts.
* It's generally advised only flip this to true, once a (preview) track has been acquired successfully with the
* appropriate permissions.
*
* @see {@link MediaDeviceMenu}
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices | MDN enumerateDevices}
*/
requestPermissions?: boolean;
/**
* this callback gets called if an error is thrown when failing to select a device and also if a user
* denied permissions, eventhough the `requestPermissions` option is set to `true`.
* Most commonly this will emit a MediaDeviceError
*/
onError?: (e: Error) => void;
}
/**
* The `useMediaDeviceSelect` hook is used to implement the `MediaDeviceSelect` component and
* returns o.a. the list of devices of a given kind (audioinput or videoinput), the currently active device
* and a function to set the the active device.
*
* @example
* ```tsx
* const { devices, activeDeviceId, setActiveMediaDevice } = useMediaDeviceSelect({kind: 'audioinput'});
* ```
* @public
*/
declare function useSelectInputDeviceAgent({ requestPermissions, onError, }: UseMediaDeviceSelectProps): {
devices: MediaDeviceInfo[];
className: string;
activeDeviceId: string;
setActiveMediaDevice: (id: string) => Promise<void>;
};
declare enum MediaDeviceFailure {
PermissionDenied = "PermissionDenied",
NotFound = "NotFound",
DeviceInUse = "DeviceInUse",
Other = "Other"
}
/**
* The function `useMultibandSpeakerTrackVolume` calculates and updates frequency bands based on audio
* player data at regular intervals.
* @param {number} [bands=5] - The `bands` parameter in the `useMultibandSpeakerTrackVolume` function
* determines the number of frequency bands that the audio signal will be divided into for processing.
* This parameter allows you to specify how many bands you want to split the frequency spectrum into.
* @param {number} [loPass=0.1] - The `loPass` parameter in the `useMultibandSpeakerTrackVolume`
* function represents the lower passband frequency limit. It is used to filter out frequencies below a
* certain threshold in the audio signal. In the provided code snippet, the `loPass` parameter is set
* to a default value of
* @param {number} [hiPass=1.0] - The `hiPass` parameter in the `useMultibandSpeakerTrackVolume`
* function represents the upper limit frequency value for filtering the audio frequencies. It is used
* to define the range of frequencies that will be included in the analysis and processing of the audio
* data. In the provided code snippet, the `
* @returns The `useMultibandSpeakerTrackVolume` custom hook returns an array of `Float32Array`
* frequency bands that have been calculated based on the audio frequencies received from the audio
* player. The number of bands, low-pass and high-pass values are used to divide and normalize the
* frequencies into the specified bands. The hook continuously updates the frequency bands at an
* interval of 100ms.
*/
declare const useMultibandMicrophoneTrackVolume: (bands?: number, loPass?: number, hiPass?: number) => number[][];
declare const useMultiband3DSpeakerTrackVolume: (bands?: number, loPass?: number, hiPass?: number) => {
xNorm: number;
yNorm: number;
zNorm: number;
elapsedTimeSec: number;
frequencyBands: number[][];
};
export { AgentConfig, Channel, ConnectionConfig, ConnectionState, Feedback, InputOptions, MediaDeviceFailure, Message$1 as Message, OutputOptions, VoiceAgent, VoiceAgentContext, useConnectAgent, useConversationFeedback, useEnsureVoiceAgent, useInputModeToggleAgent, useMaybeVoiceAgent, useMessageFeedback, useMultiband3DSpeakerTrackVolume, useMultibandMicrophoneTrackVolume, useSelectInputDeviceAgent, useSpeakerOuputToggleAgent };