@haylee-ai/chat-sdk 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -77
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ await client.messages.stream(
|
|
|
113
113
|
|
|
114
114
|
# Class: AuthenticationError
|
|
115
115
|
|
|
116
|
-
Defined in: src/errors/authentication.error.ts:3
|
|
116
|
+
Defined in: [src/errors/authentication.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/authentication.error.ts#L3)
|
|
117
117
|
|
|
118
118
|
## Extends
|
|
119
119
|
|
|
@@ -125,7 +125,7 @@ Defined in: src/errors/authentication.error.ts:3
|
|
|
125
125
|
|
|
126
126
|
> **new AuthenticationError**(`message`): `AuthenticationError`
|
|
127
127
|
|
|
128
|
-
Defined in: src/errors/authentication.error.ts:6
|
|
128
|
+
Defined in: [src/errors/authentication.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/authentication.error.ts#L6)
|
|
129
129
|
|
|
130
130
|
#### Parameters
|
|
131
131
|
|
|
@@ -171,7 +171,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
171
171
|
|
|
172
172
|
> `readonly` **name**: `string` = `"AuthenticationError"`
|
|
173
173
|
|
|
174
|
-
Defined in: src/errors/authentication.error.ts:4
|
|
174
|
+
Defined in: [src/errors/authentication.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/authentication.error.ts#L4)
|
|
175
175
|
|
|
176
176
|
#### Overrides
|
|
177
177
|
|
|
@@ -322,7 +322,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
322
322
|
|
|
323
323
|
# Class: AuthorizationError
|
|
324
324
|
|
|
325
|
-
Defined in: src/errors/authorization.error.ts:3
|
|
325
|
+
Defined in: [src/errors/authorization.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/authorization.error.ts#L3)
|
|
326
326
|
|
|
327
327
|
## Extends
|
|
328
328
|
|
|
@@ -334,7 +334,7 @@ Defined in: src/errors/authorization.error.ts:3
|
|
|
334
334
|
|
|
335
335
|
> **new AuthorizationError**(`message`): `AuthorizationError`
|
|
336
336
|
|
|
337
|
-
Defined in: src/errors/authorization.error.ts:6
|
|
337
|
+
Defined in: [src/errors/authorization.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/authorization.error.ts#L6)
|
|
338
338
|
|
|
339
339
|
#### Parameters
|
|
340
340
|
|
|
@@ -380,7 +380,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
380
380
|
|
|
381
381
|
> `readonly` **name**: `string` = `"AuthorizationError"`
|
|
382
382
|
|
|
383
|
-
Defined in: src/errors/authorization.error.ts:4
|
|
383
|
+
Defined in: [src/errors/authorization.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/authorization.error.ts#L4)
|
|
384
384
|
|
|
385
385
|
#### Overrides
|
|
386
386
|
|
|
@@ -531,7 +531,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
531
531
|
|
|
532
532
|
# Class: BaseEvent
|
|
533
533
|
|
|
534
|
-
Defined in: src/messages/types.ts:12
|
|
534
|
+
Defined in: [src/messages/types.ts:12](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L12)
|
|
535
535
|
|
|
536
536
|
Base event for Streaming
|
|
537
537
|
BaseEvent
|
|
@@ -557,7 +557,7 @@ Base event for Streaming
|
|
|
557
557
|
|
|
558
558
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
559
559
|
|
|
560
|
-
Defined in: src/messages/types.ts:16
|
|
560
|
+
Defined in: [src/messages/types.ts:16](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L16)
|
|
561
561
|
|
|
562
562
|
Used to separate streams
|
|
563
563
|
|
|
@@ -567,7 +567,7 @@ Used to separate streams
|
|
|
567
567
|
|
|
568
568
|
> **node**: `string`
|
|
569
569
|
|
|
570
|
-
Defined in: src/messages/types.ts:20
|
|
570
|
+
Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L20)
|
|
571
571
|
|
|
572
572
|
Source node in langgraph
|
|
573
573
|
|
|
@@ -582,7 +582,7 @@ Source node in langgraph
|
|
|
582
582
|
|
|
583
583
|
# Class: CreateMessageDto
|
|
584
584
|
|
|
585
|
-
Defined in: src/types/chat.interface.ts:8
|
|
585
|
+
Defined in: [src/types/chat.interface.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/types/chat.interface.ts#L8)
|
|
586
586
|
|
|
587
587
|
DTO for creating a message
|
|
588
588
|
|
|
@@ -602,7 +602,7 @@ DTO for creating a message
|
|
|
602
602
|
|
|
603
603
|
> **conversation\_history**: [`IHistoryPayload`](#classesihistorypayloadmd)[]
|
|
604
604
|
|
|
605
|
-
Defined in: src/types/chat.interface.ts:13
|
|
605
|
+
Defined in: [src/types/chat.interface.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/types/chat.interface.ts#L13)
|
|
606
606
|
|
|
607
607
|
Array of messages
|
|
608
608
|
|
|
@@ -612,7 +612,7 @@ Array of messages
|
|
|
612
612
|
|
|
613
613
|
> **message**: `string`
|
|
614
614
|
|
|
615
|
-
Defined in: src/types/chat.interface.ts:11
|
|
615
|
+
Defined in: [src/types/chat.interface.ts:11](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/types/chat.interface.ts#L11)
|
|
616
616
|
|
|
617
617
|
User message
|
|
618
618
|
|
|
@@ -627,7 +627,7 @@ User message
|
|
|
627
627
|
|
|
628
628
|
# Class: EndEvent
|
|
629
629
|
|
|
630
|
-
Defined in: src/messages/types.ts:49
|
|
630
|
+
Defined in: [src/messages/types.ts:49](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L49)
|
|
631
631
|
|
|
632
632
|
## Constructors
|
|
633
633
|
|
|
@@ -645,7 +645,7 @@ Defined in: src/messages/types.ts:49
|
|
|
645
645
|
|
|
646
646
|
> **success**: `boolean`
|
|
647
647
|
|
|
648
|
-
Defined in: src/messages/types.ts:50
|
|
648
|
+
Defined in: [src/messages/types.ts:50](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L50)
|
|
649
649
|
|
|
650
650
|
|
|
651
651
|
<a name="classeshayleeaimd"></a>
|
|
@@ -658,7 +658,7 @@ Defined in: src/messages/types.ts:50
|
|
|
658
658
|
|
|
659
659
|
# Class: HayleeAI
|
|
660
660
|
|
|
661
|
-
Defined in: src/index.ts:7
|
|
661
|
+
Defined in: [src/index.ts:7](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/index.ts#L7)
|
|
662
662
|
|
|
663
663
|
Instantiate a new HayleeAI connection
|
|
664
664
|
|
|
@@ -672,7 +672,7 @@ Instantiate a new HayleeAI connection
|
|
|
672
672
|
|
|
673
673
|
> **new HayleeAI**(`options`): `HayleeAI`
|
|
674
674
|
|
|
675
|
-
Defined in: src/index.ts:13
|
|
675
|
+
Defined in: [src/index.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/index.ts#L13)
|
|
676
676
|
|
|
677
677
|
#### Parameters
|
|
678
678
|
|
|
@@ -696,7 +696,7 @@ HayleeAIChatClientOptions
|
|
|
696
696
|
|
|
697
697
|
> **messages**: [`MessageService`](#classesmessageservicemd)
|
|
698
698
|
|
|
699
|
-
Defined in: src/index.ts:8
|
|
699
|
+
Defined in: [src/index.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/index.ts#L8)
|
|
700
700
|
|
|
701
701
|
## Methods
|
|
702
702
|
|
|
@@ -704,7 +704,7 @@ Defined in: src/index.ts:8
|
|
|
704
704
|
|
|
705
705
|
> **\_stream**(`payload`, `signal?`): `AsyncGenerator`\<`string`, `void`, `unknown`\>
|
|
706
706
|
|
|
707
|
-
Defined in: src/\_internal/client.ts:35
|
|
707
|
+
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/_internal/client.ts#L35)
|
|
708
708
|
|
|
709
709
|
Internal stream callout
|
|
710
710
|
|
|
@@ -741,7 +741,7 @@ Abort signal
|
|
|
741
741
|
|
|
742
742
|
# Class: HayleeAIClient
|
|
743
743
|
|
|
744
|
-
Defined in: src/\_internal/client.ts:18
|
|
744
|
+
Defined in: [src/\_internal/client.ts:18](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/_internal/client.ts#L18)
|
|
745
745
|
|
|
746
746
|
Internal HayleeAI Client. Do not use unless necessary.
|
|
747
747
|
HayleeAIClient
|
|
@@ -756,7 +756,7 @@ Internal HayleeAI Client. Do not use unless necessary.
|
|
|
756
756
|
|
|
757
757
|
> **new HayleeAIClient**(`options`): `HayleeAIClient`
|
|
758
758
|
|
|
759
|
-
Defined in: src/\_internal/client.ts:26
|
|
759
|
+
Defined in: [src/\_internal/client.ts:26](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/_internal/client.ts#L26)
|
|
760
760
|
|
|
761
761
|
#### Parameters
|
|
762
762
|
|
|
@@ -776,7 +776,7 @@ Auth, and baseURL
|
|
|
776
776
|
|
|
777
777
|
> **\_stream**(`payload`, `signal?`): `AsyncGenerator`\<`string`, `void`, `unknown`\>
|
|
778
778
|
|
|
779
|
-
Defined in: src/\_internal/client.ts:35
|
|
779
|
+
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/_internal/client.ts#L35)
|
|
780
780
|
|
|
781
781
|
Internal stream callout
|
|
782
782
|
|
|
@@ -809,7 +809,7 @@ Abort signal
|
|
|
809
809
|
|
|
810
810
|
# Class: HayleeAIError
|
|
811
811
|
|
|
812
|
-
Defined in: src/errors/base.ts:1
|
|
812
|
+
Defined in: [src/errors/base.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/base.ts#L1)
|
|
813
813
|
|
|
814
814
|
## Extends
|
|
815
815
|
|
|
@@ -828,7 +828,7 @@ Defined in: src/errors/base.ts:1
|
|
|
828
828
|
|
|
829
829
|
> **new HayleeAIError**(`message`): `HayleeAIError`
|
|
830
830
|
|
|
831
|
-
Defined in: src/errors/base.ts:4
|
|
831
|
+
Defined in: [src/errors/base.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/base.ts#L4)
|
|
832
832
|
|
|
833
833
|
#### Parameters
|
|
834
834
|
|
|
@@ -874,7 +874,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
874
874
|
|
|
875
875
|
> `readonly` **name**: `string` = `"HayleeAIError"`
|
|
876
876
|
|
|
877
|
-
Defined in: src/errors/base.ts:2
|
|
877
|
+
Defined in: [src/errors/base.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/base.ts#L2)
|
|
878
878
|
|
|
879
879
|
#### Overrides
|
|
880
880
|
|
|
@@ -1025,7 +1025,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1025
1025
|
|
|
1026
1026
|
# Class: IHistoryPayload
|
|
1027
1027
|
|
|
1028
|
-
Defined in: src/types/chat.interface.ts:30
|
|
1028
|
+
Defined in: [src/types/chat.interface.ts:30](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/types/chat.interface.ts#L30)
|
|
1029
1029
|
|
|
1030
1030
|
History payload
|
|
1031
1031
|
|
|
@@ -1045,7 +1045,7 @@ History payload
|
|
|
1045
1045
|
|
|
1046
1046
|
> **content**: `string`
|
|
1047
1047
|
|
|
1048
|
-
Defined in: src/types/chat.interface.ts:34
|
|
1048
|
+
Defined in: [src/types/chat.interface.ts:34](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/types/chat.interface.ts#L34)
|
|
1049
1049
|
|
|
1050
1050
|
Content of message
|
|
1051
1051
|
|
|
@@ -1055,7 +1055,7 @@ Content of message
|
|
|
1055
1055
|
|
|
1056
1056
|
> **role**: [`Role`](#enumerationsrolemd)
|
|
1057
1057
|
|
|
1058
|
-
Defined in: src/types/chat.interface.ts:32
|
|
1058
|
+
Defined in: [src/types/chat.interface.ts:32](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/types/chat.interface.ts#L32)
|
|
1059
1059
|
|
|
1060
1060
|
Role of message sender
|
|
1061
1061
|
|
|
@@ -1070,7 +1070,7 @@ Role of message sender
|
|
|
1070
1070
|
|
|
1071
1071
|
# Class: LlmTokenContent
|
|
1072
1072
|
|
|
1073
|
-
Defined in: src/messages/types.ts:27
|
|
1073
|
+
Defined in: [src/messages/types.ts:27](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L27)
|
|
1074
1074
|
|
|
1075
1075
|
LLmTokenContent
|
|
1076
1076
|
|
|
@@ -1090,7 +1090,7 @@ LLmTokenContent
|
|
|
1090
1090
|
|
|
1091
1091
|
> **text**: `string`
|
|
1092
1092
|
|
|
1093
|
-
Defined in: src/messages/types.ts:35
|
|
1093
|
+
Defined in: [src/messages/types.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L35)
|
|
1094
1094
|
|
|
1095
1095
|
***
|
|
1096
1096
|
|
|
@@ -1098,7 +1098,7 @@ Defined in: src/messages/types.ts:35
|
|
|
1098
1098
|
|
|
1099
1099
|
> **type**: `"text"`
|
|
1100
1100
|
|
|
1101
|
-
Defined in: src/messages/types.ts:31
|
|
1101
|
+
Defined in: [src/messages/types.ts:31](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L31)
|
|
1102
1102
|
|
|
1103
1103
|
|
|
1104
1104
|
<a name="classesllmtokeneventmd"></a>
|
|
@@ -1111,7 +1111,7 @@ Defined in: src/messages/types.ts:31
|
|
|
1111
1111
|
|
|
1112
1112
|
# Class: LlmTokenEvent
|
|
1113
1113
|
|
|
1114
|
-
Defined in: src/messages/types.ts:38
|
|
1114
|
+
Defined in: [src/messages/types.ts:38](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L38)
|
|
1115
1115
|
|
|
1116
1116
|
Base event for Streaming
|
|
1117
1117
|
BaseEvent
|
|
@@ -1140,7 +1140,7 @@ Base event for Streaming
|
|
|
1140
1140
|
|
|
1141
1141
|
> **content**: [`LlmTokenContent`](#classesllmtokencontentmd)[]
|
|
1142
1142
|
|
|
1143
|
-
Defined in: src/messages/types.ts:42
|
|
1143
|
+
Defined in: [src/messages/types.ts:42](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L42)
|
|
1144
1144
|
|
|
1145
1145
|
***
|
|
1146
1146
|
|
|
@@ -1148,7 +1148,7 @@ Defined in: src/messages/types.ts:42
|
|
|
1148
1148
|
|
|
1149
1149
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
1150
1150
|
|
|
1151
|
-
Defined in: src/messages/types.ts:16
|
|
1151
|
+
Defined in: [src/messages/types.ts:16](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L16)
|
|
1152
1152
|
|
|
1153
1153
|
Used to separate streams
|
|
1154
1154
|
|
|
@@ -1162,7 +1162,7 @@ Used to separate streams
|
|
|
1162
1162
|
|
|
1163
1163
|
> **model**: `string`
|
|
1164
1164
|
|
|
1165
|
-
Defined in: src/messages/types.ts:46
|
|
1165
|
+
Defined in: [src/messages/types.ts:46](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L46)
|
|
1166
1166
|
|
|
1167
1167
|
***
|
|
1168
1168
|
|
|
@@ -1170,7 +1170,7 @@ Defined in: src/messages/types.ts:46
|
|
|
1170
1170
|
|
|
1171
1171
|
> **node**: `string`
|
|
1172
1172
|
|
|
1173
|
-
Defined in: src/messages/types.ts:20
|
|
1173
|
+
Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L20)
|
|
1174
1174
|
|
|
1175
1175
|
#### Inherited from
|
|
1176
1176
|
|
|
@@ -1187,7 +1187,7 @@ Defined in: src/messages/types.ts:20
|
|
|
1187
1187
|
|
|
1188
1188
|
# Class: MessageService
|
|
1189
1189
|
|
|
1190
|
-
Defined in: src/messages/message.service.ts:
|
|
1190
|
+
Defined in: [src/messages/message.service.ts:50](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/message.service.ts#L50)
|
|
1191
1191
|
|
|
1192
1192
|
## Constructors
|
|
1193
1193
|
|
|
@@ -1195,7 +1195,7 @@ Defined in: src/messages/message.service.ts:44
|
|
|
1195
1195
|
|
|
1196
1196
|
> **new MessageService**(`client`): `MessageService`
|
|
1197
1197
|
|
|
1198
|
-
Defined in: src/messages/message.service.ts:
|
|
1198
|
+
Defined in: [src/messages/message.service.ts:52](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/message.service.ts#L52)
|
|
1199
1199
|
|
|
1200
1200
|
#### Parameters
|
|
1201
1201
|
|
|
@@ -1213,7 +1213,7 @@ Defined in: src/messages/message.service.ts:46
|
|
|
1213
1213
|
|
|
1214
1214
|
> **stream**(`payload`, `options?`): `Promise`\<`void`\>
|
|
1215
1215
|
|
|
1216
|
-
Defined in: src/messages/message.service.ts:
|
|
1216
|
+
Defined in: [src/messages/message.service.ts:58](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/message.service.ts#L58)
|
|
1217
1217
|
|
|
1218
1218
|
#### Parameters
|
|
1219
1219
|
|
|
@@ -1244,7 +1244,7 @@ Config for streaming
|
|
|
1244
1244
|
|
|
1245
1245
|
# Class: NotFoundError
|
|
1246
1246
|
|
|
1247
|
-
Defined in: src/errors/not-found.error.ts:3
|
|
1247
|
+
Defined in: [src/errors/not-found.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/not-found.error.ts#L3)
|
|
1248
1248
|
|
|
1249
1249
|
## Extends
|
|
1250
1250
|
|
|
@@ -1256,7 +1256,7 @@ Defined in: src/errors/not-found.error.ts:3
|
|
|
1256
1256
|
|
|
1257
1257
|
> **new NotFoundError**(`message`): `NotFoundError`
|
|
1258
1258
|
|
|
1259
|
-
Defined in: src/errors/not-found.error.ts:6
|
|
1259
|
+
Defined in: [src/errors/not-found.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/not-found.error.ts#L6)
|
|
1260
1260
|
|
|
1261
1261
|
#### Parameters
|
|
1262
1262
|
|
|
@@ -1302,7 +1302,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1302
1302
|
|
|
1303
1303
|
> `readonly` **name**: `string` = `"NotFoundError"`
|
|
1304
1304
|
|
|
1305
|
-
Defined in: src/errors/not-found.error.ts:4
|
|
1305
|
+
Defined in: [src/errors/not-found.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/not-found.error.ts#L4)
|
|
1306
1306
|
|
|
1307
1307
|
#### Overrides
|
|
1308
1308
|
|
|
@@ -1453,7 +1453,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1453
1453
|
|
|
1454
1454
|
# Class: ValidationError
|
|
1455
1455
|
|
|
1456
|
-
Defined in: src/errors/validation.error.ts:3
|
|
1456
|
+
Defined in: [src/errors/validation.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/validation.error.ts#L3)
|
|
1457
1457
|
|
|
1458
1458
|
## Extends
|
|
1459
1459
|
|
|
@@ -1465,7 +1465,7 @@ Defined in: src/errors/validation.error.ts:3
|
|
|
1465
1465
|
|
|
1466
1466
|
> **new ValidationError**(`message`, `details?`): `ValidationError`
|
|
1467
1467
|
|
|
1468
|
-
Defined in: src/errors/validation.error.ts:5
|
|
1468
|
+
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/validation.error.ts#L5)
|
|
1469
1469
|
|
|
1470
1470
|
#### Parameters
|
|
1471
1471
|
|
|
@@ -1503,7 +1503,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1503
1503
|
|
|
1504
1504
|
> `optional` **details**: `any`
|
|
1505
1505
|
|
|
1506
|
-
Defined in: src/errors/validation.error.ts:5
|
|
1506
|
+
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/validation.error.ts#L5)
|
|
1507
1507
|
|
|
1508
1508
|
***
|
|
1509
1509
|
|
|
@@ -1523,7 +1523,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1523
1523
|
|
|
1524
1524
|
> `readonly` **name**: `string` = `"ValidationError"`
|
|
1525
1525
|
|
|
1526
|
-
Defined in: src/errors/validation.error.ts:4
|
|
1526
|
+
Defined in: [src/errors/validation.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/errors/validation.error.ts#L4)
|
|
1527
1527
|
|
|
1528
1528
|
#### Overrides
|
|
1529
1529
|
|
|
@@ -1674,7 +1674,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1674
1674
|
|
|
1675
1675
|
# Enumeration: EventKind
|
|
1676
1676
|
|
|
1677
|
-
Defined in: src/messages/types.ts:1
|
|
1677
|
+
Defined in: [src/messages/types.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L1)
|
|
1678
1678
|
|
|
1679
1679
|
## Enumeration Members
|
|
1680
1680
|
|
|
@@ -1682,7 +1682,7 @@ Defined in: src/messages/types.ts:1
|
|
|
1682
1682
|
|
|
1683
1683
|
> **LLM\_TOKEN**: `"llm_token"`
|
|
1684
1684
|
|
|
1685
|
-
Defined in: src/messages/types.ts:2
|
|
1685
|
+
Defined in: [src/messages/types.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L2)
|
|
1686
1686
|
|
|
1687
1687
|
***
|
|
1688
1688
|
|
|
@@ -1690,7 +1690,7 @@ Defined in: src/messages/types.ts:2
|
|
|
1690
1690
|
|
|
1691
1691
|
> **TOOLS**: `"tools"`
|
|
1692
1692
|
|
|
1693
|
-
Defined in: src/messages/types.ts:3
|
|
1693
|
+
Defined in: [src/messages/types.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L3)
|
|
1694
1694
|
|
|
1695
1695
|
|
|
1696
1696
|
<a name="enumerationsrolemd"></a>
|
|
@@ -1703,7 +1703,7 @@ Defined in: src/messages/types.ts:3
|
|
|
1703
1703
|
|
|
1704
1704
|
# Enumeration: Role
|
|
1705
1705
|
|
|
1706
|
-
Defined in: src/types/chat.interface.ts:19
|
|
1706
|
+
Defined in: [src/types/chat.interface.ts:19](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/types/chat.interface.ts#L19)
|
|
1707
1707
|
|
|
1708
1708
|
## Enumeration Members
|
|
1709
1709
|
|
|
@@ -1711,7 +1711,7 @@ Defined in: src/types/chat.interface.ts:19
|
|
|
1711
1711
|
|
|
1712
1712
|
> **AI**: `"ai"`
|
|
1713
1713
|
|
|
1714
|
-
Defined in: src/types/chat.interface.ts:21
|
|
1714
|
+
Defined in: [src/types/chat.interface.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/types/chat.interface.ts#L21)
|
|
1715
1715
|
|
|
1716
1716
|
***
|
|
1717
1717
|
|
|
@@ -1719,7 +1719,7 @@ Defined in: src/types/chat.interface.ts:21
|
|
|
1719
1719
|
|
|
1720
1720
|
> **HUMAN**: `"human"`
|
|
1721
1721
|
|
|
1722
|
-
Defined in: src/types/chat.interface.ts:20
|
|
1722
|
+
Defined in: [src/types/chat.interface.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/types/chat.interface.ts#L20)
|
|
1723
1723
|
|
|
1724
1724
|
|
|
1725
1725
|
<a name="enumerationstoolstatusmd"></a>
|
|
@@ -1732,7 +1732,7 @@ Defined in: src/types/chat.interface.ts:20
|
|
|
1732
1732
|
|
|
1733
1733
|
# Enumeration: ToolStatus
|
|
1734
1734
|
|
|
1735
|
-
Defined in: src/messages/types.ts:
|
|
1735
|
+
Defined in: [src/messages/types.ts:62](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L62)
|
|
1736
1736
|
|
|
1737
1737
|
## Enumeration Members
|
|
1738
1738
|
|
|
@@ -1740,7 +1740,7 @@ Defined in: src/messages/types.ts:61
|
|
|
1740
1740
|
|
|
1741
1741
|
> **END**: `"END"`
|
|
1742
1742
|
|
|
1743
|
-
Defined in: src/messages/types.ts:
|
|
1743
|
+
Defined in: [src/messages/types.ts:64](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L64)
|
|
1744
1744
|
|
|
1745
1745
|
***
|
|
1746
1746
|
|
|
@@ -1748,7 +1748,7 @@ Defined in: src/messages/types.ts:63
|
|
|
1748
1748
|
|
|
1749
1749
|
> **ERROR**: `"ERROR"`
|
|
1750
1750
|
|
|
1751
|
-
Defined in: src/messages/types.ts:
|
|
1751
|
+
Defined in: [src/messages/types.ts:65](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L65)
|
|
1752
1752
|
|
|
1753
1753
|
***
|
|
1754
1754
|
|
|
@@ -1756,7 +1756,7 @@ Defined in: src/messages/types.ts:64
|
|
|
1756
1756
|
|
|
1757
1757
|
> **START**: `"START"`
|
|
1758
1758
|
|
|
1759
|
-
Defined in: src/messages/types.ts:
|
|
1759
|
+
Defined in: [src/messages/types.ts:63](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L63)
|
|
1760
1760
|
|
|
1761
1761
|
|
|
1762
1762
|
<a name="interfacesmessageserviceoptionsmd"></a>
|
|
@@ -1769,7 +1769,7 @@ Defined in: src/messages/types.ts:62
|
|
|
1769
1769
|
|
|
1770
1770
|
# Interface: MessageServiceOptions
|
|
1771
1771
|
|
|
1772
|
-
Defined in: src/messages/message.service.ts:
|
|
1772
|
+
Defined in: [src/messages/message.service.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/message.service.ts#L13)
|
|
1773
1773
|
|
|
1774
1774
|
## Properties
|
|
1775
1775
|
|
|
@@ -1777,7 +1777,7 @@ Defined in: src/messages/message.service.ts:12
|
|
|
1777
1777
|
|
|
1778
1778
|
> `optional` **signal**: `AbortSignal`
|
|
1779
1779
|
|
|
1780
|
-
Defined in: src/messages/message.service.ts:
|
|
1780
|
+
Defined in: [src/messages/message.service.ts:47](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/message.service.ts#L47)
|
|
1781
1781
|
|
|
1782
1782
|
AbortSignal for terminating the upstream stream
|
|
1783
1783
|
|
|
@@ -1787,7 +1787,7 @@ AbortSignal for terminating the upstream stream
|
|
|
1787
1787
|
|
|
1788
1788
|
> `optional` **onEnd**(`ev`): `void`
|
|
1789
1789
|
|
|
1790
|
-
Defined in: src/messages/message.service.ts:
|
|
1790
|
+
Defined in: [src/messages/message.service.ts:23](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/message.service.ts#L23)
|
|
1791
1791
|
|
|
1792
1792
|
triggers upon stream end
|
|
1793
1793
|
|
|
@@ -1809,7 +1809,7 @@ EndEvent
|
|
|
1809
1809
|
|
|
1810
1810
|
> `optional` **onError**(`err`): `void`
|
|
1811
1811
|
|
|
1812
|
-
Defined in: src/messages/message.service.ts:
|
|
1812
|
+
Defined in: [src/messages/message.service.ts:43](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/message.service.ts#L43)
|
|
1813
1813
|
|
|
1814
1814
|
Streams errors on runtime
|
|
1815
1815
|
|
|
@@ -1829,7 +1829,7 @@ Streams errors on runtime
|
|
|
1829
1829
|
|
|
1830
1830
|
> `optional` **onLlmToken**(`ev`): `void`
|
|
1831
1831
|
|
|
1832
|
-
Defined in: src/messages/message.service.ts:
|
|
1832
|
+
Defined in: [src/messages/message.service.ts:18](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/message.service.ts#L18)
|
|
1833
1833
|
|
|
1834
1834
|
Streams llm tokens for output
|
|
1835
1835
|
|
|
@@ -1849,7 +1849,7 @@ Streams llm tokens for output
|
|
|
1849
1849
|
|
|
1850
1850
|
> `optional` **onToolEnd**(`ev`): `void`
|
|
1851
1851
|
|
|
1852
|
-
Defined in: src/messages/message.service.ts:
|
|
1852
|
+
Defined in: [src/messages/message.service.ts:33](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/message.service.ts#L33)
|
|
1853
1853
|
|
|
1854
1854
|
Streams tool end updates
|
|
1855
1855
|
|
|
@@ -1867,11 +1867,33 @@ ToolEvent
|
|
|
1867
1867
|
|
|
1868
1868
|
***
|
|
1869
1869
|
|
|
1870
|
+
### onToolError()?
|
|
1871
|
+
|
|
1872
|
+
> `optional` **onToolError**(`ev`): `void`
|
|
1873
|
+
|
|
1874
|
+
Defined in: [src/messages/message.service.ts:38](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/message.service.ts#L38)
|
|
1875
|
+
|
|
1876
|
+
Streams tool errors
|
|
1877
|
+
|
|
1878
|
+
#### Parameters
|
|
1879
|
+
|
|
1880
|
+
##### ev
|
|
1881
|
+
|
|
1882
|
+
[`ToolEvent`](#interfacestooleventmd)
|
|
1883
|
+
|
|
1884
|
+
ToolEvent
|
|
1885
|
+
|
|
1886
|
+
#### Returns
|
|
1887
|
+
|
|
1888
|
+
`void`
|
|
1889
|
+
|
|
1890
|
+
***
|
|
1891
|
+
|
|
1870
1892
|
### onToolStart()?
|
|
1871
1893
|
|
|
1872
1894
|
> `optional` **onToolStart**(`ev`): `void`
|
|
1873
1895
|
|
|
1874
|
-
Defined in: src/messages/message.service.ts:
|
|
1896
|
+
Defined in: [src/messages/message.service.ts:28](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/message.service.ts#L28)
|
|
1875
1897
|
|
|
1876
1898
|
Streams tool start updates
|
|
1877
1899
|
|
|
@@ -1898,7 +1920,7 @@ ToolEvent
|
|
|
1898
1920
|
|
|
1899
1921
|
# Interface: ToolContent
|
|
1900
1922
|
|
|
1901
|
-
Defined in: src/messages/types.ts:
|
|
1923
|
+
Defined in: [src/messages/types.ts:68](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L68)
|
|
1902
1924
|
|
|
1903
1925
|
## Properties
|
|
1904
1926
|
|
|
@@ -1906,7 +1928,7 @@ Defined in: src/messages/types.ts:67
|
|
|
1906
1928
|
|
|
1907
1929
|
> **params**: `unknown`
|
|
1908
1930
|
|
|
1909
|
-
Defined in: src/messages/types.ts:
|
|
1931
|
+
Defined in: [src/messages/types.ts:69](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L69)
|
|
1910
1932
|
|
|
1911
1933
|
|
|
1912
1934
|
<a name="interfacestooleventmd"></a>
|
|
@@ -1919,7 +1941,7 @@ Defined in: src/messages/types.ts:68
|
|
|
1919
1941
|
|
|
1920
1942
|
# Interface: ToolEvent
|
|
1921
1943
|
|
|
1922
|
-
Defined in: src/messages/types.ts:53
|
|
1944
|
+
Defined in: [src/messages/types.ts:53](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L53)
|
|
1923
1945
|
|
|
1924
1946
|
Base event for Streaming
|
|
1925
1947
|
BaseEvent
|
|
@@ -1934,7 +1956,15 @@ Base event for Streaming
|
|
|
1934
1956
|
|
|
1935
1957
|
> `optional` **content**: [`ToolContent`](#interfacestoolcontentmd)
|
|
1936
1958
|
|
|
1937
|
-
Defined in: src/messages/types.ts:54
|
|
1959
|
+
Defined in: [src/messages/types.ts:54](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L54)
|
|
1960
|
+
|
|
1961
|
+
***
|
|
1962
|
+
|
|
1963
|
+
### error?
|
|
1964
|
+
|
|
1965
|
+
> `optional` **error**: `unknown`
|
|
1966
|
+
|
|
1967
|
+
Defined in: [src/messages/types.ts:59](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L59)
|
|
1938
1968
|
|
|
1939
1969
|
***
|
|
1940
1970
|
|
|
@@ -1942,7 +1972,7 @@ Defined in: src/messages/types.ts:54
|
|
|
1942
1972
|
|
|
1943
1973
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
1944
1974
|
|
|
1945
|
-
Defined in: src/messages/types.ts:16
|
|
1975
|
+
Defined in: [src/messages/types.ts:16](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L16)
|
|
1946
1976
|
|
|
1947
1977
|
Used to separate streams
|
|
1948
1978
|
|
|
@@ -1956,7 +1986,7 @@ Used to separate streams
|
|
|
1956
1986
|
|
|
1957
1987
|
> **name**: `string`
|
|
1958
1988
|
|
|
1959
|
-
Defined in: src/messages/types.ts:55
|
|
1989
|
+
Defined in: [src/messages/types.ts:55](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L55)
|
|
1960
1990
|
|
|
1961
1991
|
***
|
|
1962
1992
|
|
|
@@ -1964,7 +1994,7 @@ Defined in: src/messages/types.ts:55
|
|
|
1964
1994
|
|
|
1965
1995
|
> **node**: `string`
|
|
1966
1996
|
|
|
1967
|
-
Defined in: src/messages/types.ts:20
|
|
1997
|
+
Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L20)
|
|
1968
1998
|
|
|
1969
1999
|
#### Inherited from
|
|
1970
2000
|
|
|
@@ -1976,7 +2006,7 @@ Defined in: src/messages/types.ts:20
|
|
|
1976
2006
|
|
|
1977
2007
|
> **results**: [`ToolResultContent`](#interfacestoolresultcontentmd)[]
|
|
1978
2008
|
|
|
1979
|
-
Defined in: src/messages/types.ts:58
|
|
2009
|
+
Defined in: [src/messages/types.ts:58](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L58)
|
|
1980
2010
|
|
|
1981
2011
|
***
|
|
1982
2012
|
|
|
@@ -1984,7 +2014,7 @@ Defined in: src/messages/types.ts:58
|
|
|
1984
2014
|
|
|
1985
2015
|
> **status**: [`ToolStatus`](#enumerationstoolstatusmd)
|
|
1986
2016
|
|
|
1987
|
-
Defined in: src/messages/types.ts:57
|
|
2017
|
+
Defined in: [src/messages/types.ts:57](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L57)
|
|
1988
2018
|
|
|
1989
2019
|
***
|
|
1990
2020
|
|
|
@@ -1992,7 +2022,7 @@ Defined in: src/messages/types.ts:57
|
|
|
1992
2022
|
|
|
1993
2023
|
> `optional` **tool\_call\_id**: `string`
|
|
1994
2024
|
|
|
1995
|
-
Defined in: src/messages/types.ts:56
|
|
2025
|
+
Defined in: [src/messages/types.ts:56](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L56)
|
|
1996
2026
|
|
|
1997
2027
|
|
|
1998
2028
|
<a name="interfacestoolresultcontentmd"></a>
|
|
@@ -2005,7 +2035,7 @@ Defined in: src/messages/types.ts:56
|
|
|
2005
2035
|
|
|
2006
2036
|
# Interface: ToolResultContent
|
|
2007
2037
|
|
|
2008
|
-
Defined in: src/messages/types.ts:
|
|
2038
|
+
Defined in: [src/messages/types.ts:72](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L72)
|
|
2009
2039
|
|
|
2010
2040
|
## Properties
|
|
2011
2041
|
|
|
@@ -2013,7 +2043,7 @@ Defined in: src/messages/types.ts:71
|
|
|
2013
2043
|
|
|
2014
2044
|
> **content**: `any`
|
|
2015
2045
|
|
|
2016
|
-
Defined in: src/messages/types.ts:
|
|
2046
|
+
Defined in: [src/messages/types.ts:76](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L76)
|
|
2017
2047
|
|
|
2018
2048
|
***
|
|
2019
2049
|
|
|
@@ -2021,7 +2051,7 @@ Defined in: src/messages/types.ts:75
|
|
|
2021
2051
|
|
|
2022
2052
|
> **type**: `string`
|
|
2023
2053
|
|
|
2024
|
-
Defined in: src/messages/types.ts:
|
|
2054
|
+
Defined in: [src/messages/types.ts:74](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/messages/types.ts#L74)
|
|
2025
2055
|
|
|
2026
2056
|
|
|
2027
2057
|
<a name="type-aliaseshayleeaichatclientoptionsmd"></a>
|
|
@@ -2036,7 +2066,7 @@ Defined in: src/messages/types.ts:73
|
|
|
2036
2066
|
|
|
2037
2067
|
> **HayleeAIChatClientOptions** = `object`
|
|
2038
2068
|
|
|
2039
|
-
Defined in: src/\_internal/client.ts:9
|
|
2069
|
+
Defined in: [src/\_internal/client.ts:9](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/_internal/client.ts#L9)
|
|
2040
2070
|
|
|
2041
2071
|
Options for the HayleeAI Client
|
|
2042
2072
|
|
|
@@ -2046,6 +2076,6 @@ Options for the HayleeAI Client
|
|
|
2046
2076
|
|
|
2047
2077
|
> `optional` **baseUrl**: `string`
|
|
2048
2078
|
|
|
2049
|
-
Defined in: src/\_internal/client.ts:10
|
|
2079
|
+
Defined in: [src/\_internal/client.ts:10](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/59c8fa0cba19cdc5e1906fd5e3e644b622e90950/src/_internal/client.ts#L10)
|
|
2050
2080
|
|
|
2051
2081
|
Optional base URL, defaults to production
|
package/dist/index.cjs
CHANGED
|
@@ -211,6 +211,8 @@ var MessageService = class {
|
|
|
211
211
|
options?.onToolStart?.(typedEvent);
|
|
212
212
|
} else if (typedEvent.status == "END" /* END */) {
|
|
213
213
|
options?.onToolEnd?.(typedEvent);
|
|
214
|
+
} else if (typedEvent.status == "ERROR" /* ERROR */) {
|
|
215
|
+
options?.onToolError?.(typedEvent);
|
|
214
216
|
}
|
|
215
217
|
break;
|
|
216
218
|
}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/_internal/client.ts","../src/messages/types.ts","../src/errors/base.ts","../src/errors/parse.error.ts","../src/_shared/parse.helper.ts","../src/messages/message.service.ts","../src/errors/validation.error.ts","../src/errors/not-found.error.ts","../src/errors/authorization.error.ts","../src/errors/authentication.error.ts","../src/types/chat.interface.ts"],"sourcesContent":["import { HayleeAIClient, HayleeAIChatClientOptions } from \"./_internal/client\";\nimport { MessageService } from \"./messages\";\n\n/**\n * Instantiate a new HayleeAI connection\n */\nclass HayleeAI extends HayleeAIClient {\n public messages: MessageService;\n\n /**\n * @param options - HayleeAIChatClientOptions \n */\n constructor(options: HayleeAIChatClientOptions){\n super(options);\n this.messages = new MessageService(this);\n }\n}\n\nexport {\n HayleeAI,\n HayleeAIChatClientOptions \n}\nexport * from \"./errors\";\nexport * from \"./messages\";\nexport * from \"./types/chat.interface\";\nexport * from \"./_internal/client\";\n","import { CreateMessageDto } from \"@/types/chat.interface\";\nimport { fetchEventSource } from \"@microsoft/fetch-event-source\";\n\n/**\n * Options for the HayleeAI Client \n * @property apiKey - API key for authentication\n * @property baseUrl - Optional base URL, defaults to production\n */\nexport type HayleeAIChatClientOptions = {\n baseUrl?: string;\n}\n\n/**\n * Internal HayleeAI Client. Do not use unless necessary.\n * @class HayleeAIClient \n * @property baseURL - Base URL to make requests to\n */\nexport class HayleeAIClient {\n /**\n * @property baseURL - the base URL to make requests to\n */\n private baseURL: string;\n /**\n * @param options - Auth, and baseURL\n */\n constructor(options: HayleeAIChatClientOptions) {\n this.baseURL = options.baseUrl || \"http://localhost:3000/api/v1/chat\";\n }\n\n /**\n * Internal stream callout\n * @param payload - Message DTO\n * @param [signal] - Abort signal\n */\n async *_stream(payload: CreateMessageDto, signal?: AbortSignal) {\n const queue: string[] = [];\n let resolve: (() => void) | null = null;\n let done = false;\n\n fetchEventSource(`${this.baseURL}`, {\n headers: {\n 'Content-Type': 'application/json',\n },\n credentials: 'include',\n method: 'POST',\n body: JSON.stringify(payload),\n openWhenHidden: true,\n onmessage(ev) {\n queue.push(ev.data);\n resolve?.(); // wake up the generator\n },\n onclose() {\n done = true;\n resolve?.();\n },\n onerror(err) {\n done = true;\n resolve?.();\n throw err;\n },\n signal\n });\n\n if (signal) {\n signal.addEventListener(\"abort\", () => {\n done = true;\n resolve?.();\n });\n }\n\n while (!done || queue.length > 0) {\n if (queue.length === 0) {\n //wait until onmessage pushes something\n await new Promise<void>(r => { resolve = r; });\n }\n while (queue.length > 0) {\n yield queue.shift()!;\n }\n }\n }}\n","export enum EventKind {\n LLM_TOKEN = \"llm_token\",\n TOOLS = \"tools\"\n}\n\n/**\n * Base event for Streaming\n * @class BaseEvent\n * @property kind - Used to separate streams\n * @property node - Source node in langgraph\n */\nexport class BaseEvent {\n /*\n * @property kind - Used to separate streams\n */\n kind!: EventKind;\n /**\n * @property node - Source node in langgraph\n */\n node!: string;\n}\n\n\n/**\n * @class LLmTokenContent\n */\nexport class LlmTokenContent {\n /**\n * @property type - Always text\n */\n type!: \"text\";\n /**\n * @property text - The text content\n */\n text!: string;\n}\n\nexport class LlmTokenEvent extends BaseEvent {\n /**\n * @property content - An array of LlmTokenContent. Always an array. Non-empty or empty. Make sure to handle all items in the array.\n */\n content!: LlmTokenContent[];\n /**\n * @property model - The LLM model used.\n */\n model!: string;\n}\n\nexport class EndEvent {\n success!: boolean;\n}\n\nexport interface ToolEvent extends BaseEvent {\n content?: ToolContent;\n name: string;\n tool_call_id?: string;\n status: ToolStatus;\n results: ToolResultContent[];\n}\n\nexport enum ToolStatus {\n START = \"START\",\n END = \"END\",\n ERROR = \"ERROR\"\n}\n\nexport interface ToolContent {\n params: unknown;\n}\n\nexport interface ToolResultContent {\n /* type is text or json */\n type: string;\n /* can be string or object or array, ANY */\n content: any;\n}\n\n","export class HayleeAIError extends Error {\n public readonly name: string = \"HayleeAIError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, HayleeAIError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ParseError extends HayleeAIError {\n public readonly name: string = \"ParseError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ParseError.prototype);\n }\n}\n","import { ParseError } from \"@/errors/parse.error\";\n\nexport function parseEvent<T>(data: string): T {\n try {\n return JSON.parse(data) as T;\n } catch {\n throw new ParseError(\"Failed to parse event data to JSON.\");\n }\n}\n","import { CreateMessageDto } from \"../types/chat.interface\";\nimport { parseEvent } from \"@/_shared/parse.helper\";\nimport { BaseEvent, EndEvent, EventKind, LlmTokenEvent, ToolEvent, ToolStatus } from \"./types\";\nimport { HayleeAIClient } from \"@/_internal/client\";\n\n/**\n * @property onLlmToken - Streams llm tokens for output\n * @property onSearchUpdate - Streams pending / done updates along with search results if status is DONE\n * @property onError - Streams errors on runtime\n * @property signal - AbortSignal for terminating the upstream stream\n */\nexport interface MessageServiceOptions {\n /**\n * Streams llm tokens for output\n * @param ev - LlmTokenEvent\n */\n onLlmToken?(ev: LlmTokenEvent): void;\n /**\n * triggers upon stream end\n * @param ev - EndEvent\n * */\n onEnd?(ev: EndEvent): void;\n /**\n * Streams tool start updates\n * @param ev - ToolEvent\n */\n onToolStart?(ev: ToolEvent): void;\n /**\n * Streams tool end updates\n * @param ev - ToolEvent\n */\n onToolEnd?(ev: ToolEvent): void;\n /**\n * Streams errors on runtime\n * @param err - Error or unknown value\n */\n onError?(err: unknown): void;\n /**\n * @property signal - Abort signal to abort the stream\n */\n signal?: AbortSignal;\n}\n\nexport class MessageService {\n\n constructor(private readonly client: HayleeAIClient) {}\n\n /**\n * @param payload - The create message payload\n * @param options - Config for streaming\n */\n async stream(payload: CreateMessageDto, options?: MessageServiceOptions) {\n\n for await (const ev of this.client._stream(payload, options?.signal)) {\n if(!ev || !ev.trim()) continue;\n try {\n const event = parseEvent<BaseEvent>(ev);\n\n switch(event.kind) {\n case EventKind.LLM_TOKEN: {\n options?.onLlmToken?.(event as LlmTokenEvent);\n break;\n }\n case EventKind.TOOLS: {\n const typedEvent = event as ToolEvent;\n if(typedEvent.status == ToolStatus.START) {\n options?.onToolStart?.(typedEvent);\n } else if (typedEvent.status == ToolStatus.END) {\n options?.onToolEnd?.(typedEvent);\n }\n break;\n }\n }\n } catch (err) {\n options?.onEnd?.({ success: false });\n //throw new ParseError(\"Failed to parse event data to JSON.\")\n console.error(\"Failed to parse event data to JSON.\", err);\n options?.onError?.(err);\n }\n }\n options?.onEnd?.({ success: true });\n }\n\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ValidationError extends HayleeAIError {\n public readonly name: string = \"ValidationError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class NotFoundError extends HayleeAIError {\n public readonly name: string = \"NotFoundError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthorizationError extends HayleeAIError {\n public readonly name: string = \"AuthorizationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthorizationError.prototype);\n }\n}\n\n\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthenticationError extends HayleeAIError {\n public readonly name: string = \"AuthenticationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\n","import { IsEnum, IsString } from \"class-validator\";\n\n/** \n * DTO for creating a message\n * @property message - User message\n * @property conversation_history - Array of messages\n */\nexport class CreateMessageDto {\n /* Message to send */\n @IsString()\n message!: string;\n /* Array of messages */\n conversation_history!: IHistoryPayload[];\n}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\n\n/**\n * History payload\n * @property role - Role of message sender\n * @property content - Content of message\n */\nexport class IHistoryPayload {\n @IsEnum(Role)\n role!: Role;\n @IsString()\n content!: string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,gCAAiC;AAgB1B,IAAM,iBAAN,MAAqB;AAAA;AAAA;AAAA;AAAA,EAIhB;AAAA;AAAA;AAAA;AAAA,EAIR,YAAY,SAAoC;AAC5C,SAAK,UAAU,QAAQ,WAAW;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,QAAQ,SAA2B,QAAsB;AAC5D,UAAM,QAAkB,CAAC;AACzB,QAAI,UAA+B;AACnC,QAAI,OAAO;AAEX,oDAAiB,GAAG,KAAK,OAAO,IAAI;AAAA,MAChC,SAAS;AAAA,QACL,gBAAgB;AAAA,MACpB;AAAA,MACA,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,MAAM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+
{"version":3,"sources":["../src/index.ts","../src/_internal/client.ts","../src/messages/types.ts","../src/errors/base.ts","../src/errors/parse.error.ts","../src/_shared/parse.helper.ts","../src/messages/message.service.ts","../src/errors/validation.error.ts","../src/errors/not-found.error.ts","../src/errors/authorization.error.ts","../src/errors/authentication.error.ts","../src/types/chat.interface.ts"],"sourcesContent":["import { HayleeAIClient, HayleeAIChatClientOptions } from \"./_internal/client\";\nimport { MessageService } from \"./messages\";\n\n/**\n * Instantiate a new HayleeAI connection\n */\nclass HayleeAI extends HayleeAIClient {\n public messages: MessageService;\n\n /**\n * @param options - HayleeAIChatClientOptions \n */\n constructor(options: HayleeAIChatClientOptions){\n super(options);\n this.messages = new MessageService(this);\n }\n}\n\nexport {\n HayleeAI,\n HayleeAIChatClientOptions \n}\nexport * from \"./errors\";\nexport * from \"./messages\";\nexport * from \"./types/chat.interface\";\nexport * from \"./_internal/client\";\n","import { CreateMessageDto } from \"@/types/chat.interface\";\nimport { fetchEventSource } from \"@microsoft/fetch-event-source\";\n\n/**\n * Options for the HayleeAI Client \n * @property apiKey - API key for authentication\n * @property baseUrl - Optional base URL, defaults to production\n */\nexport type HayleeAIChatClientOptions = {\n baseUrl?: string;\n}\n\n/**\n * Internal HayleeAI Client. Do not use unless necessary.\n * @class HayleeAIClient \n * @property baseURL - Base URL to make requests to\n */\nexport class HayleeAIClient {\n /**\n * @property baseURL - the base URL to make requests to\n */\n private baseURL: string;\n /**\n * @param options - Auth, and baseURL\n */\n constructor(options: HayleeAIChatClientOptions) {\n this.baseURL = options.baseUrl || \"http://localhost:3000/api/v1/chat\";\n }\n\n /**\n * Internal stream callout\n * @param payload - Message DTO\n * @param [signal] - Abort signal\n */\n async *_stream(payload: CreateMessageDto, signal?: AbortSignal) {\n const queue: string[] = [];\n let resolve: (() => void) | null = null;\n let done = false;\n\n fetchEventSource(`${this.baseURL}`, {\n headers: {\n 'Content-Type': 'application/json',\n },\n credentials: 'include',\n method: 'POST',\n body: JSON.stringify(payload),\n openWhenHidden: true,\n onmessage(ev) {\n queue.push(ev.data);\n resolve?.(); // wake up the generator\n },\n onclose() {\n done = true;\n resolve?.();\n },\n onerror(err) {\n done = true;\n resolve?.();\n throw err;\n },\n signal\n });\n\n if (signal) {\n signal.addEventListener(\"abort\", () => {\n done = true;\n resolve?.();\n });\n }\n\n while (!done || queue.length > 0) {\n if (queue.length === 0) {\n //wait until onmessage pushes something\n await new Promise<void>(r => { resolve = r; });\n }\n while (queue.length > 0) {\n yield queue.shift()!;\n }\n }\n }}\n","export enum EventKind {\n LLM_TOKEN = \"llm_token\",\n TOOLS = \"tools\"\n}\n\n/**\n * Base event for Streaming\n * @class BaseEvent\n * @property kind - Used to separate streams\n * @property node - Source node in langgraph\n */\nexport class BaseEvent {\n /*\n * @property kind - Used to separate streams\n */\n kind!: EventKind;\n /**\n * @property node - Source node in langgraph\n */\n node!: string;\n}\n\n\n/**\n * @class LLmTokenContent\n */\nexport class LlmTokenContent {\n /**\n * @property type - Always text\n */\n type!: \"text\";\n /**\n * @property text - The text content\n */\n text!: string;\n}\n\nexport class LlmTokenEvent extends BaseEvent {\n /**\n * @property content - An array of LlmTokenContent. Always an array. Non-empty or empty. Make sure to handle all items in the array.\n */\n content!: LlmTokenContent[];\n /**\n * @property model - The LLM model used.\n */\n model!: string;\n}\n\nexport class EndEvent {\n success!: boolean;\n}\n\nexport interface ToolEvent extends BaseEvent {\n content?: ToolContent;\n name: string;\n tool_call_id?: string;\n status: ToolStatus;\n results: ToolResultContent[];\n error?: unknown;\n}\n\nexport enum ToolStatus {\n START = \"START\",\n END = \"END\",\n ERROR = \"ERROR\"\n}\n\nexport interface ToolContent {\n params: unknown;\n}\n\nexport interface ToolResultContent {\n /* type is text or json */\n type: string;\n /* can be string or object or array, ANY */\n content: any;\n}\n\n","export class HayleeAIError extends Error {\n public readonly name: string = \"HayleeAIError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, HayleeAIError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ParseError extends HayleeAIError {\n public readonly name: string = \"ParseError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ParseError.prototype);\n }\n}\n","import { ParseError } from \"@/errors/parse.error\";\n\nexport function parseEvent<T>(data: string): T {\n try {\n return JSON.parse(data) as T;\n } catch {\n throw new ParseError(\"Failed to parse event data to JSON.\");\n }\n}\n","import { CreateMessageDto } from \"../types/chat.interface\";\nimport { parseEvent } from \"@/_shared/parse.helper\";\nimport { BaseEvent, EndEvent, EventKind, LlmTokenEvent, ToolEvent, ToolStatus } from \"./types\";\nimport { HayleeAIClient } from \"@/_internal/client\";\nimport { type } from \"os\";\n\n/**\n * @property onLlmToken - Streams llm tokens for output\n * @property onSearchUpdate - Streams pending / done updates along with search results if status is DONE\n * @property onError - Streams errors on runtime\n * @property signal - AbortSignal for terminating the upstream stream\n */\nexport interface MessageServiceOptions {\n /**\n * Streams llm tokens for output\n * @param ev - LlmTokenEvent\n */\n onLlmToken?(ev: LlmTokenEvent): void;\n /**\n * triggers upon stream end\n * @param ev - EndEvent\n * */\n onEnd?(ev: EndEvent): void;\n /**\n * Streams tool start updates\n * @param ev - ToolEvent\n */\n onToolStart?(ev: ToolEvent): void;\n /**\n * Streams tool end updates\n * @param ev - ToolEvent\n */\n onToolEnd?(ev: ToolEvent): void;\n /**\n * Streams tool errors\n * @param ev - ToolEvent\n */\n onToolError?(ev: ToolEvent): void;\n /**\n * Streams errors on runtime\n * @param err - Error or unknown value\n */\n onError?(err: unknown): void;\n /**\n * @property signal - Abort signal to abort the stream\n */\n signal?: AbortSignal;\n}\n\nexport class MessageService {\n\n constructor(private readonly client: HayleeAIClient) {}\n\n /**\n * @param payload - The create message payload\n * @param options - Config for streaming\n */\n async stream(payload: CreateMessageDto, options?: MessageServiceOptions) {\n\n for await (const ev of this.client._stream(payload, options?.signal)) {\n if(!ev || !ev.trim()) continue;\n try {\n const event = parseEvent<BaseEvent>(ev);\n\n switch(event.kind) {\n case EventKind.LLM_TOKEN: {\n options?.onLlmToken?.(event as LlmTokenEvent);\n break;\n }\n case EventKind.TOOLS: {\n const typedEvent = event as ToolEvent;\n if(typedEvent.status == ToolStatus.START) {\n options?.onToolStart?.(typedEvent);\n } else if (typedEvent.status == ToolStatus.END) {\n options?.onToolEnd?.(typedEvent);\n } else if(typedEvent.status == ToolStatus.ERROR) {\n options?.onToolError?.(typedEvent);\n }\n break;\n }\n }\n } catch (err) {\n options?.onEnd?.({ success: false });\n //throw new ParseError(\"Failed to parse event data to JSON.\")\n console.error(\"Failed to parse event data to JSON.\", err);\n options?.onError?.(err);\n }\n }\n options?.onEnd?.({ success: true });\n }\n\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ValidationError extends HayleeAIError {\n public readonly name: string = \"ValidationError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class NotFoundError extends HayleeAIError {\n public readonly name: string = \"NotFoundError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthorizationError extends HayleeAIError {\n public readonly name: string = \"AuthorizationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthorizationError.prototype);\n }\n}\n\n\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthenticationError extends HayleeAIError {\n public readonly name: string = \"AuthenticationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\n","import { IsEnum, IsString } from \"class-validator\";\n\n/** \n * DTO for creating a message\n * @property message - User message\n * @property conversation_history - Array of messages\n */\nexport class CreateMessageDto {\n /* Message to send */\n @IsString()\n message!: string;\n /* Array of messages */\n conversation_history!: IHistoryPayload[];\n}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\n\n/**\n * History payload\n * @property role - Role of message sender\n * @property content - Content of message\n */\nexport class IHistoryPayload {\n @IsEnum(Role)\n role!: Role;\n @IsString()\n content!: string;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,gCAAiC;AAgB1B,IAAM,iBAAN,MAAqB;AAAA;AAAA;AAAA;AAAA,EAIhB;AAAA;AAAA;AAAA;AAAA,EAIR,YAAY,SAAoC;AAC5C,SAAK,UAAU,QAAQ,WAAW;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,QAAQ,SAA2B,QAAsB;AAC5D,UAAM,QAAkB,CAAC;AACzB,QAAI,UAA+B;AACnC,QAAI,OAAO;AAEX,oDAAiB,GAAG,KAAK,OAAO,IAAI;AAAA,MAChC,SAAS;AAAA,QACL,gBAAgB;AAAA,MACpB;AAAA,MACA,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,MAAM,KAAK,UAAU,OAAO;AAAA,MAC5B,gBAAgB;AAAA,MAChB,UAAU,IAAI;AACV,cAAM,KAAK,GAAG,IAAI;AAClB,kBAAU;AAAA,MACd;AAAA,MACA,UAAU;AACN,eAAO;AACP,kBAAU;AAAA,MACd;AAAA,MACA,QAAQ,KAAK;AACT,eAAO;AACP,kBAAU;AACV,cAAM;AAAA,MACV;AAAA,MACA;AAAA,IACJ,CAAC;AAED,QAAI,QAAQ;AACR,aAAO,iBAAiB,SAAS,MAAM;AACnC,eAAO;AACP,kBAAU;AAAA,MACd,CAAC;AAAA,IACL;AAEA,WAAO,CAAC,QAAQ,MAAM,SAAS,GAAG;AAC9B,UAAI,MAAM,WAAW,GAAG;AAEpB,cAAM,IAAI,QAAc,OAAK;AAAE,oBAAU;AAAA,QAAG,CAAC;AAAA,MACjD;AACA,aAA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AS;AAAA,EAC5D;AACJ;;;ACPO,IAAM,sBAAN,MAAM,6BAA4B,cAAc;AAAA,EACnC,OAAe;AAAA,EAE/B,YAAY,SAAiB;AACzB,UAAM,OAAO;AACb,WAAO,eAAe,MAAM,qBAAoB,SAAS;AAAA,EAC7D;AACJ;;;ACTA,6BAAiC;AAO1B,IAAM,mBAAN,MAAuB;AAAA,EAG1B;AAAA;AAAA,EAEA;AACJ;AAHI;AAAA,MADC,iCAAS;AAAA,GAFD,iBAGT;AAQG,IAAK,OAAL,kBAAKC,UAAL;AACH,EAAAA,MAAA,WAAQ;AACR,EAAAA,MAAA,QAAK;AAFG,SAAAA;AAAA,GAAA;AAWL,IAAM,kBAAN,MAAsB;AAAA,EAEzB;AAAA,EAEA;AACJ;AAHI;AAAA,MADC,+BAAO,IAAI;AAAA,GADH,gBAET;AAEA;AAAA,MADC,iCAAS;AAAA,GAHD,gBAIT;;;AX3BJ,IAAM,WAAN,cAAuB,eAAe;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA,EAKP,YAAY,SAAmC;AAC3C,UAAM,OAAO;AACb,SAAK,WAAW,IAAI,eAAe,IAAI;AAAA,EAC3C;AACJ;","names":["EventKind","ToolStatus","Role"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -100,6 +100,7 @@ interface ToolEvent extends BaseEvent {
|
|
|
100
100
|
tool_call_id?: string;
|
|
101
101
|
status: ToolStatus;
|
|
102
102
|
results: ToolResultContent[];
|
|
103
|
+
error?: unknown;
|
|
103
104
|
}
|
|
104
105
|
declare enum ToolStatus {
|
|
105
106
|
START = "START",
|
|
@@ -141,6 +142,11 @@ interface MessageServiceOptions {
|
|
|
141
142
|
* @param ev - ToolEvent
|
|
142
143
|
*/
|
|
143
144
|
onToolEnd?(ev: ToolEvent): void;
|
|
145
|
+
/**
|
|
146
|
+
* Streams tool errors
|
|
147
|
+
* @param ev - ToolEvent
|
|
148
|
+
*/
|
|
149
|
+
onToolError?(ev: ToolEvent): void;
|
|
144
150
|
/**
|
|
145
151
|
* Streams errors on runtime
|
|
146
152
|
* @param err - Error or unknown value
|
package/dist/index.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ interface ToolEvent extends BaseEvent {
|
|
|
100
100
|
tool_call_id?: string;
|
|
101
101
|
status: ToolStatus;
|
|
102
102
|
results: ToolResultContent[];
|
|
103
|
+
error?: unknown;
|
|
103
104
|
}
|
|
104
105
|
declare enum ToolStatus {
|
|
105
106
|
START = "START",
|
|
@@ -141,6 +142,11 @@ interface MessageServiceOptions {
|
|
|
141
142
|
* @param ev - ToolEvent
|
|
142
143
|
*/
|
|
143
144
|
onToolEnd?(ev: ToolEvent): void;
|
|
145
|
+
/**
|
|
146
|
+
* Streams tool errors
|
|
147
|
+
* @param ev - ToolEvent
|
|
148
|
+
*/
|
|
149
|
+
onToolError?(ev: ToolEvent): void;
|
|
144
150
|
/**
|
|
145
151
|
* Streams errors on runtime
|
|
146
152
|
* @param err - Error or unknown value
|
package/dist/index.js
CHANGED
|
@@ -172,6 +172,8 @@ var MessageService = class {
|
|
|
172
172
|
options?.onToolStart?.(typedEvent);
|
|
173
173
|
} else if (typedEvent.status == "END" /* END */) {
|
|
174
174
|
options?.onToolEnd?.(typedEvent);
|
|
175
|
+
} else if (typedEvent.status == "ERROR" /* ERROR */) {
|
|
176
|
+
options?.onToolError?.(typedEvent);
|
|
175
177
|
}
|
|
176
178
|
break;
|
|
177
179
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/_internal/client.ts","../src/messages/types.ts","../src/errors/base.ts","../src/errors/parse.error.ts","../src/_shared/parse.helper.ts","../src/messages/message.service.ts","../src/errors/validation.error.ts","../src/errors/not-found.error.ts","../src/errors/authorization.error.ts","../src/errors/authentication.error.ts","../src/types/chat.interface.ts","../src/index.ts"],"sourcesContent":["import { CreateMessageDto } from \"@/types/chat.interface\";\nimport { fetchEventSource } from \"@microsoft/fetch-event-source\";\n\n/**\n * Options for the HayleeAI Client \n * @property apiKey - API key for authentication\n * @property baseUrl - Optional base URL, defaults to production\n */\nexport type HayleeAIChatClientOptions = {\n baseUrl?: string;\n}\n\n/**\n * Internal HayleeAI Client. Do not use unless necessary.\n * @class HayleeAIClient \n * @property baseURL - Base URL to make requests to\n */\nexport class HayleeAIClient {\n /**\n * @property baseURL - the base URL to make requests to\n */\n private baseURL: string;\n /**\n * @param options - Auth, and baseURL\n */\n constructor(options: HayleeAIChatClientOptions) {\n this.baseURL = options.baseUrl || \"http://localhost:3000/api/v1/chat\";\n }\n\n /**\n * Internal stream callout\n * @param payload - Message DTO\n * @param [signal] - Abort signal\n */\n async *_stream(payload: CreateMessageDto, signal?: AbortSignal) {\n const queue: string[] = [];\n let resolve: (() => void) | null = null;\n let done = false;\n\n fetchEventSource(`${this.baseURL}`, {\n headers: {\n 'Content-Type': 'application/json',\n },\n credentials: 'include',\n method: 'POST',\n body: JSON.stringify(payload),\n openWhenHidden: true,\n onmessage(ev) {\n queue.push(ev.data);\n resolve?.(); // wake up the generator\n },\n onclose() {\n done = true;\n resolve?.();\n },\n onerror(err) {\n done = true;\n resolve?.();\n throw err;\n },\n signal\n });\n\n if (signal) {\n signal.addEventListener(\"abort\", () => {\n done = true;\n resolve?.();\n });\n }\n\n while (!done || queue.length > 0) {\n if (queue.length === 0) {\n //wait until onmessage pushes something\n await new Promise<void>(r => { resolve = r; });\n }\n while (queue.length > 0) {\n yield queue.shift()!;\n }\n }\n }}\n","export enum EventKind {\n LLM_TOKEN = \"llm_token\",\n TOOLS = \"tools\"\n}\n\n/**\n * Base event for Streaming\n * @class BaseEvent\n * @property kind - Used to separate streams\n * @property node - Source node in langgraph\n */\nexport class BaseEvent {\n /*\n * @property kind - Used to separate streams\n */\n kind!: EventKind;\n /**\n * @property node - Source node in langgraph\n */\n node!: string;\n}\n\n\n/**\n * @class LLmTokenContent\n */\nexport class LlmTokenContent {\n /**\n * @property type - Always text\n */\n type!: \"text\";\n /**\n * @property text - The text content\n */\n text!: string;\n}\n\nexport class LlmTokenEvent extends BaseEvent {\n /**\n * @property content - An array of LlmTokenContent. Always an array. Non-empty or empty. Make sure to handle all items in the array.\n */\n content!: LlmTokenContent[];\n /**\n * @property model - The LLM model used.\n */\n model!: string;\n}\n\nexport class EndEvent {\n success!: boolean;\n}\n\nexport interface ToolEvent extends BaseEvent {\n content?: ToolContent;\n name: string;\n tool_call_id?: string;\n status: ToolStatus;\n results: ToolResultContent[];\n}\n\nexport enum ToolStatus {\n START = \"START\",\n END = \"END\",\n ERROR = \"ERROR\"\n}\n\nexport interface ToolContent {\n params: unknown;\n}\n\nexport interface ToolResultContent {\n /* type is text or json */\n type: string;\n /* can be string or object or array, ANY */\n content: any;\n}\n\n","export class HayleeAIError extends Error {\n public readonly name: string = \"HayleeAIError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, HayleeAIError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ParseError extends HayleeAIError {\n public readonly name: string = \"ParseError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ParseError.prototype);\n }\n}\n","import { ParseError } from \"@/errors/parse.error\";\n\nexport function parseEvent<T>(data: string): T {\n try {\n return JSON.parse(data) as T;\n } catch {\n throw new ParseError(\"Failed to parse event data to JSON.\");\n }\n}\n","import { CreateMessageDto } from \"../types/chat.interface\";\nimport { parseEvent } from \"@/_shared/parse.helper\";\nimport { BaseEvent, EndEvent, EventKind, LlmTokenEvent, ToolEvent, ToolStatus } from \"./types\";\nimport { HayleeAIClient } from \"@/_internal/client\";\n\n/**\n * @property onLlmToken - Streams llm tokens for output\n * @property onSearchUpdate - Streams pending / done updates along with search results if status is DONE\n * @property onError - Streams errors on runtime\n * @property signal - AbortSignal for terminating the upstream stream\n */\nexport interface MessageServiceOptions {\n /**\n * Streams llm tokens for output\n * @param ev - LlmTokenEvent\n */\n onLlmToken?(ev: LlmTokenEvent): void;\n /**\n * triggers upon stream end\n * @param ev - EndEvent\n * */\n onEnd?(ev: EndEvent): void;\n /**\n * Streams tool start updates\n * @param ev - ToolEvent\n */\n onToolStart?(ev: ToolEvent): void;\n /**\n * Streams tool end updates\n * @param ev - ToolEvent\n */\n onToolEnd?(ev: ToolEvent): void;\n /**\n * Streams errors on runtime\n * @param err - Error or unknown value\n */\n onError?(err: unknown): void;\n /**\n * @property signal - Abort signal to abort the stream\n */\n signal?: AbortSignal;\n}\n\nexport class MessageService {\n\n constructor(private readonly client: HayleeAIClient) {}\n\n /**\n * @param payload - The create message payload\n * @param options - Config for streaming\n */\n async stream(payload: CreateMessageDto, options?: MessageServiceOptions) {\n\n for await (const ev of this.client._stream(payload, options?.signal)) {\n if(!ev || !ev.trim()) continue;\n try {\n const event = parseEvent<BaseEvent>(ev);\n\n switch(event.kind) {\n case EventKind.LLM_TOKEN: {\n options?.onLlmToken?.(event as LlmTokenEvent);\n break;\n }\n case EventKind.TOOLS: {\n const typedEvent = event as ToolEvent;\n if(typedEvent.status == ToolStatus.START) {\n options?.onToolStart?.(typedEvent);\n } else if (typedEvent.status == ToolStatus.END) {\n options?.onToolEnd?.(typedEvent);\n }\n break;\n }\n }\n } catch (err) {\n options?.onEnd?.({ success: false });\n //throw new ParseError(\"Failed to parse event data to JSON.\")\n console.error(\"Failed to parse event data to JSON.\", err);\n options?.onError?.(err);\n }\n }\n options?.onEnd?.({ success: true });\n }\n\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ValidationError extends HayleeAIError {\n public readonly name: string = \"ValidationError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class NotFoundError extends HayleeAIError {\n public readonly name: string = \"NotFoundError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthorizationError extends HayleeAIError {\n public readonly name: string = \"AuthorizationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthorizationError.prototype);\n }\n}\n\n\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthenticationError extends HayleeAIError {\n public readonly name: string = \"AuthenticationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\n","import { IsEnum, IsString } from \"class-validator\";\n\n/** \n * DTO for creating a message\n * @property message - User message\n * @property conversation_history - Array of messages\n */\nexport class CreateMessageDto {\n /* Message to send */\n @IsString()\n message!: string;\n /* Array of messages */\n conversation_history!: IHistoryPayload[];\n}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\n\n/**\n * History payload\n * @property role - Role of message sender\n * @property content - Content of message\n */\nexport class IHistoryPayload {\n @IsEnum(Role)\n role!: Role;\n @IsString()\n content!: string;\n};\n","import { HayleeAIClient, HayleeAIChatClientOptions } from \"./_internal/client\";\nimport { MessageService } from \"./messages\";\n\n/**\n * Instantiate a new HayleeAI connection\n */\nclass HayleeAI extends HayleeAIClient {\n public messages: MessageService;\n\n /**\n * @param options - HayleeAIChatClientOptions \n */\n constructor(options: HayleeAIChatClientOptions){\n super(options);\n this.messages = new MessageService(this);\n }\n}\n\nexport {\n HayleeAI,\n HayleeAIChatClientOptions \n}\nexport * from \"./errors\";\nexport * from \"./messages\";\nexport * from \"./types/chat.interface\";\nexport * from \"./_internal/client\";\n"],"mappings":";;;;;;;;;;;;AACA,SAAS,wBAAwB;AAgB1B,IAAM,iBAAN,MAAqB;AAAA;AAAA;AAAA;AAAA,EAIhB;AAAA;AAAA;AAAA;AAAA,EAIR,YAAY,SAAoC;AAC5C,SAAK,UAAU,QAAQ,WAAW;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,QAAQ,SAA2B,QAAsB;AAC5D,UAAM,QAAkB,CAAC;AACzB,QAAI,UAA+B;AACnC,QAAI,OAAO;AAEX,qBAAiB,G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AA,EAKP,YAAY,SAAmC;AAC3C,UAAM,OAAO;AACb,SAAK,WAAW,IAAI,eAAe,IAAI;AAAA,EAC3C;AACJ;","names":["EventKind","ToolStatus","Role"]}
|
|
1
|
+
{"version":3,"sources":["../src/_internal/client.ts","../src/messages/types.ts","../src/errors/base.ts","../src/errors/parse.error.ts","../src/_shared/parse.helper.ts","../src/messages/message.service.ts","../src/errors/validation.error.ts","../src/errors/not-found.error.ts","../src/errors/authorization.error.ts","../src/errors/authentication.error.ts","../src/types/chat.interface.ts","../src/index.ts"],"sourcesContent":["import { CreateMessageDto } from \"@/types/chat.interface\";\nimport { fetchEventSource } from \"@microsoft/fetch-event-source\";\n\n/**\n * Options for the HayleeAI Client \n * @property apiKey - API key for authentication\n * @property baseUrl - Optional base URL, defaults to production\n */\nexport type HayleeAIChatClientOptions = {\n baseUrl?: string;\n}\n\n/**\n * Internal HayleeAI Client. Do not use unless necessary.\n * @class HayleeAIClient \n * @property baseURL - Base URL to make requests to\n */\nexport class HayleeAIClient {\n /**\n * @property baseURL - the base URL to make requests to\n */\n private baseURL: string;\n /**\n * @param options - Auth, and baseURL\n */\n constructor(options: HayleeAIChatClientOptions) {\n this.baseURL = options.baseUrl || \"http://localhost:3000/api/v1/chat\";\n }\n\n /**\n * Internal stream callout\n * @param payload - Message DTO\n * @param [signal] - Abort signal\n */\n async *_stream(payload: CreateMessageDto, signal?: AbortSignal) {\n const queue: string[] = [];\n let resolve: (() => void) | null = null;\n let done = false;\n\n fetchEventSource(`${this.baseURL}`, {\n headers: {\n 'Content-Type': 'application/json',\n },\n credentials: 'include',\n method: 'POST',\n body: JSON.stringify(payload),\n openWhenHidden: true,\n onmessage(ev) {\n queue.push(ev.data);\n resolve?.(); // wake up the generator\n },\n onclose() {\n done = true;\n resolve?.();\n },\n onerror(err) {\n done = true;\n resolve?.();\n throw err;\n },\n signal\n });\n\n if (signal) {\n signal.addEventListener(\"abort\", () => {\n done = true;\n resolve?.();\n });\n }\n\n while (!done || queue.length > 0) {\n if (queue.length === 0) {\n //wait until onmessage pushes something\n await new Promise<void>(r => { resolve = r; });\n }\n while (queue.length > 0) {\n yield queue.shift()!;\n }\n }\n }}\n","export enum EventKind {\n LLM_TOKEN = \"llm_token\",\n TOOLS = \"tools\"\n}\n\n/**\n * Base event for Streaming\n * @class BaseEvent\n * @property kind - Used to separate streams\n * @property node - Source node in langgraph\n */\nexport class BaseEvent {\n /*\n * @property kind - Used to separate streams\n */\n kind!: EventKind;\n /**\n * @property node - Source node in langgraph\n */\n node!: string;\n}\n\n\n/**\n * @class LLmTokenContent\n */\nexport class LlmTokenContent {\n /**\n * @property type - Always text\n */\n type!: \"text\";\n /**\n * @property text - The text content\n */\n text!: string;\n}\n\nexport class LlmTokenEvent extends BaseEvent {\n /**\n * @property content - An array of LlmTokenContent. Always an array. Non-empty or empty. Make sure to handle all items in the array.\n */\n content!: LlmTokenContent[];\n /**\n * @property model - The LLM model used.\n */\n model!: string;\n}\n\nexport class EndEvent {\n success!: boolean;\n}\n\nexport interface ToolEvent extends BaseEvent {\n content?: ToolContent;\n name: string;\n tool_call_id?: string;\n status: ToolStatus;\n results: ToolResultContent[];\n error?: unknown;\n}\n\nexport enum ToolStatus {\n START = \"START\",\n END = \"END\",\n ERROR = \"ERROR\"\n}\n\nexport interface ToolContent {\n params: unknown;\n}\n\nexport interface ToolResultContent {\n /* type is text or json */\n type: string;\n /* can be string or object or array, ANY */\n content: any;\n}\n\n","export class HayleeAIError extends Error {\n public readonly name: string = \"HayleeAIError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, HayleeAIError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ParseError extends HayleeAIError {\n public readonly name: string = \"ParseError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ParseError.prototype);\n }\n}\n","import { ParseError } from \"@/errors/parse.error\";\n\nexport function parseEvent<T>(data: string): T {\n try {\n return JSON.parse(data) as T;\n } catch {\n throw new ParseError(\"Failed to parse event data to JSON.\");\n }\n}\n","import { CreateMessageDto } from \"../types/chat.interface\";\nimport { parseEvent } from \"@/_shared/parse.helper\";\nimport { BaseEvent, EndEvent, EventKind, LlmTokenEvent, ToolEvent, ToolStatus } from \"./types\";\nimport { HayleeAIClient } from \"@/_internal/client\";\nimport { type } from \"os\";\n\n/**\n * @property onLlmToken - Streams llm tokens for output\n * @property onSearchUpdate - Streams pending / done updates along with search results if status is DONE\n * @property onError - Streams errors on runtime\n * @property signal - AbortSignal for terminating the upstream stream\n */\nexport interface MessageServiceOptions {\n /**\n * Streams llm tokens for output\n * @param ev - LlmTokenEvent\n */\n onLlmToken?(ev: LlmTokenEvent): void;\n /**\n * triggers upon stream end\n * @param ev - EndEvent\n * */\n onEnd?(ev: EndEvent): void;\n /**\n * Streams tool start updates\n * @param ev - ToolEvent\n */\n onToolStart?(ev: ToolEvent): void;\n /**\n * Streams tool end updates\n * @param ev - ToolEvent\n */\n onToolEnd?(ev: ToolEvent): void;\n /**\n * Streams tool errors\n * @param ev - ToolEvent\n */\n onToolError?(ev: ToolEvent): void;\n /**\n * Streams errors on runtime\n * @param err - Error or unknown value\n */\n onError?(err: unknown): void;\n /**\n * @property signal - Abort signal to abort the stream\n */\n signal?: AbortSignal;\n}\n\nexport class MessageService {\n\n constructor(private readonly client: HayleeAIClient) {}\n\n /**\n * @param payload - The create message payload\n * @param options - Config for streaming\n */\n async stream(payload: CreateMessageDto, options?: MessageServiceOptions) {\n\n for await (const ev of this.client._stream(payload, options?.signal)) {\n if(!ev || !ev.trim()) continue;\n try {\n const event = parseEvent<BaseEvent>(ev);\n\n switch(event.kind) {\n case EventKind.LLM_TOKEN: {\n options?.onLlmToken?.(event as LlmTokenEvent);\n break;\n }\n case EventKind.TOOLS: {\n const typedEvent = event as ToolEvent;\n if(typedEvent.status == ToolStatus.START) {\n options?.onToolStart?.(typedEvent);\n } else if (typedEvent.status == ToolStatus.END) {\n options?.onToolEnd?.(typedEvent);\n } else if(typedEvent.status == ToolStatus.ERROR) {\n options?.onToolError?.(typedEvent);\n }\n break;\n }\n }\n } catch (err) {\n options?.onEnd?.({ success: false });\n //throw new ParseError(\"Failed to parse event data to JSON.\")\n console.error(\"Failed to parse event data to JSON.\", err);\n options?.onError?.(err);\n }\n }\n options?.onEnd?.({ success: true });\n }\n\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class ValidationError extends HayleeAIError {\n public readonly name: string = \"ValidationError\";\n constructor(message: string, public details?: any){\n super(message);\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class NotFoundError extends HayleeAIError {\n public readonly name: string = \"NotFoundError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthorizationError extends HayleeAIError {\n public readonly name: string = \"AuthorizationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthorizationError.prototype);\n }\n}\n\n\n","import { HayleeAIError } from \"./base\";\n\nexport class AuthenticationError extends HayleeAIError {\n public readonly name: string = \"AuthenticationError\";\n\n constructor(message: string) {\n super(message);\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\n","import { IsEnum, IsString } from \"class-validator\";\n\n/** \n * DTO for creating a message\n * @property message - User message\n * @property conversation_history - Array of messages\n */\nexport class CreateMessageDto {\n /* Message to send */\n @IsString()\n message!: string;\n /* Array of messages */\n conversation_history!: IHistoryPayload[];\n}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\n\n/**\n * History payload\n * @property role - Role of message sender\n * @property content - Content of message\n */\nexport class IHistoryPayload {\n @IsEnum(Role)\n role!: Role;\n @IsString()\n content!: string;\n};\n","import { HayleeAIClient, HayleeAIChatClientOptions } from \"./_internal/client\";\nimport { MessageService } from \"./messages\";\n\n/**\n * Instantiate a new HayleeAI connection\n */\nclass HayleeAI extends HayleeAIClient {\n public messages: MessageService;\n\n /**\n * @param options - HayleeAIChatClientOptions \n */\n constructor(options: HayleeAIChatClientOptions){\n super(options);\n this.messages = new MessageService(this);\n }\n}\n\nexport {\n HayleeAI,\n HayleeAIChatClientOptions \n}\nexport * from \"./errors\";\nexport * from \"./messages\";\nexport * from \"./types/chat.interface\";\nexport * from \"./_internal/client\";\n"],"mappings":";;;;;;;;;;;;AACA,SAAS,wBAAwB;AAgB1B,IAAM,iBAAN,MAAqB;AAAA;AAAA;AAAA;AAAA,EAIhB;AAAA;AAAA;AAAA;AAAA,EAIR,YAAY,SAAoC;AAC5C,SAAK,UAAU,QAAQ,WAAW;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAO,QAAQ,SAA2B,QAAsB;AAC5D,UAAM,QAAkB,CAAC;AACzB,QAAI,UAA+B;AACnC,QAAI,OAAO;AAEX,qBAAiB,GAAG,KAAK,OAAO,IAAI;AAAA,MAChC,SAAS;AAAA,QACL,gBAAgB;AAAA,MACpB;AAAA,MACA,aAAa;AAAA,MACb,QAAQ;AAAA,MACR,MAAM,KAAK,UAAU,OAAO;AAAA,MAC5B,gBAAgB;AAAA,MAChB,UAAU,IAAI;AACV,cAAM,KAAK,GAAG,IAAI;AAClB,kBAAU;AAAA,MACd;AAAA,MACA,UAAU;AACN,eAAO;AACP,kBAAU;AAAA,MACd;AAAA,MACA,QAAQ,KAAK;AACT,eAAO;AACP,kBAAU;AACV,cAAM;AAAA,MACV;AAAA,MACA;AAAA,IACJ,CAAC;AAED,QAAI,QAAQ;AACR,aAAO,iBAAiB,SAAS,MAAM;AACnC,eAAO;AACP,kBAAU;AAAA,MACd,CAAC;AAAA,IACL;AAEA,WAAO,CAAC,QAAQ,MAAM,SAAS,GAAG;AAC9B,UAAI,MAAM,WAAW,GAAG;AAEpB,cAAM,IAAI,QAAc,OAAK;AAAE,oBAAU;AAAA,QAAG,CAAC;AAAA,MACjD;AACA,aAAO,MAAM,SA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