@haylee-ai/chat-sdk 1.0.3 → 1.0.4
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 +83 -75
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -112,7 +112,7 @@ await client.messages.stream(
|
|
|
112
112
|
|
|
113
113
|
# Class: AuthenticationError
|
|
114
114
|
|
|
115
|
-
Defined in: [src/errors/authentication.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
115
|
+
Defined in: [src/errors/authentication.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/authentication.error.ts#L3)
|
|
116
116
|
|
|
117
117
|
## Extends
|
|
118
118
|
|
|
@@ -124,7 +124,7 @@ Defined in: [src/errors/authentication.error.ts:3](https://github.com/vonuyvicoo
|
|
|
124
124
|
|
|
125
125
|
> **new AuthenticationError**(`message`): `AuthenticationError`
|
|
126
126
|
|
|
127
|
-
Defined in: [src/errors/authentication.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
127
|
+
Defined in: [src/errors/authentication.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/authentication.error.ts#L6)
|
|
128
128
|
|
|
129
129
|
#### Parameters
|
|
130
130
|
|
|
@@ -170,7 +170,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
170
170
|
|
|
171
171
|
> `readonly` **name**: `string` = `"AuthenticationError"`
|
|
172
172
|
|
|
173
|
-
Defined in: [src/errors/authentication.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
173
|
+
Defined in: [src/errors/authentication.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/authentication.error.ts#L4)
|
|
174
174
|
|
|
175
175
|
#### Overrides
|
|
176
176
|
|
|
@@ -321,7 +321,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
321
321
|
|
|
322
322
|
# Class: AuthorizationError
|
|
323
323
|
|
|
324
|
-
Defined in: [src/errors/authorization.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
324
|
+
Defined in: [src/errors/authorization.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/authorization.error.ts#L3)
|
|
325
325
|
|
|
326
326
|
## Extends
|
|
327
327
|
|
|
@@ -333,7 +333,7 @@ Defined in: [src/errors/authorization.error.ts:3](https://github.com/vonuyvicoo/
|
|
|
333
333
|
|
|
334
334
|
> **new AuthorizationError**(`message`): `AuthorizationError`
|
|
335
335
|
|
|
336
|
-
Defined in: [src/errors/authorization.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
336
|
+
Defined in: [src/errors/authorization.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/authorization.error.ts#L6)
|
|
337
337
|
|
|
338
338
|
#### Parameters
|
|
339
339
|
|
|
@@ -379,7 +379,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
379
379
|
|
|
380
380
|
> `readonly` **name**: `string` = `"AuthorizationError"`
|
|
381
381
|
|
|
382
|
-
Defined in: [src/errors/authorization.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
382
|
+
Defined in: [src/errors/authorization.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/authorization.error.ts#L4)
|
|
383
383
|
|
|
384
384
|
#### Overrides
|
|
385
385
|
|
|
@@ -530,7 +530,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
530
530
|
|
|
531
531
|
# Class: BaseEvent
|
|
532
532
|
|
|
533
|
-
Defined in: [src/messages/types.ts:12](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
533
|
+
Defined in: [src/messages/types.ts:12](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L12)
|
|
534
534
|
|
|
535
535
|
Base event for Streaming
|
|
536
536
|
BaseEvent
|
|
@@ -556,7 +556,7 @@ Base event for Streaming
|
|
|
556
556
|
|
|
557
557
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
558
558
|
|
|
559
|
-
Defined in: [src/messages/types.ts:16](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
559
|
+
Defined in: [src/messages/types.ts:16](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L16)
|
|
560
560
|
|
|
561
561
|
Used to separate streams
|
|
562
562
|
|
|
@@ -566,7 +566,7 @@ Used to separate streams
|
|
|
566
566
|
|
|
567
567
|
> **node**: `string`
|
|
568
568
|
|
|
569
|
-
Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
569
|
+
Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L20)
|
|
570
570
|
|
|
571
571
|
Source node in langgraph
|
|
572
572
|
|
|
@@ -581,7 +581,7 @@ Source node in langgraph
|
|
|
581
581
|
|
|
582
582
|
# Class: CreateMessageDto
|
|
583
583
|
|
|
584
|
-
Defined in: [src/types/chat.interface.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
584
|
+
Defined in: [src/types/chat.interface.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/types/chat.interface.ts#L8)
|
|
585
585
|
|
|
586
586
|
DTO for creating a message
|
|
587
587
|
|
|
@@ -597,11 +597,19 @@ DTO for creating a message
|
|
|
597
597
|
|
|
598
598
|
## Properties
|
|
599
599
|
|
|
600
|
+
### conversation\_id?
|
|
601
|
+
|
|
602
|
+
> `optional` **conversation\_id**: `string`
|
|
603
|
+
|
|
604
|
+
Defined in: [src/types/chat.interface.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/types/chat.interface.ts#L13)
|
|
605
|
+
|
|
606
|
+
***
|
|
607
|
+
|
|
600
608
|
### message
|
|
601
609
|
|
|
602
610
|
> **message**: `string`
|
|
603
611
|
|
|
604
|
-
Defined in: [src/types/chat.interface.ts:11](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
612
|
+
Defined in: [src/types/chat.interface.ts:11](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/types/chat.interface.ts#L11)
|
|
605
613
|
|
|
606
614
|
User message
|
|
607
615
|
|
|
@@ -616,7 +624,7 @@ User message
|
|
|
616
624
|
|
|
617
625
|
# Class: EndEvent
|
|
618
626
|
|
|
619
|
-
Defined in: [src/messages/types.ts:49](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
627
|
+
Defined in: [src/messages/types.ts:49](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L49)
|
|
620
628
|
|
|
621
629
|
## Constructors
|
|
622
630
|
|
|
@@ -634,7 +642,7 @@ Defined in: [src/messages/types.ts:49](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
634
642
|
|
|
635
643
|
> **success**: `boolean`
|
|
636
644
|
|
|
637
|
-
Defined in: [src/messages/types.ts:50](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
645
|
+
Defined in: [src/messages/types.ts:50](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L50)
|
|
638
646
|
|
|
639
647
|
|
|
640
648
|
<a name="classeshayleeaimd"></a>
|
|
@@ -647,7 +655,7 @@ Defined in: [src/messages/types.ts:50](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
647
655
|
|
|
648
656
|
# Class: HayleeAI
|
|
649
657
|
|
|
650
|
-
Defined in: [src/index.ts:7](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
658
|
+
Defined in: [src/index.ts:7](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/index.ts#L7)
|
|
651
659
|
|
|
652
660
|
Instantiate a new HayleeAI connection
|
|
653
661
|
|
|
@@ -661,7 +669,7 @@ Instantiate a new HayleeAI connection
|
|
|
661
669
|
|
|
662
670
|
> **new HayleeAI**(`options`): `HayleeAI`
|
|
663
671
|
|
|
664
|
-
Defined in: [src/index.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
672
|
+
Defined in: [src/index.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/index.ts#L13)
|
|
665
673
|
|
|
666
674
|
#### Parameters
|
|
667
675
|
|
|
@@ -685,7 +693,7 @@ HayleeAIChatClientOptions
|
|
|
685
693
|
|
|
686
694
|
> **messages**: [`MessageService`](#classesmessageservicemd)
|
|
687
695
|
|
|
688
|
-
Defined in: [src/index.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
696
|
+
Defined in: [src/index.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/index.ts#L8)
|
|
689
697
|
|
|
690
698
|
## Methods
|
|
691
699
|
|
|
@@ -693,7 +701,7 @@ Defined in: [src/index.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/bl
|
|
|
693
701
|
|
|
694
702
|
> **\_stream**(`payload`, `signal?`): `AsyncGenerator`\<`string`, `void`, `unknown`\>
|
|
695
703
|
|
|
696
|
-
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
704
|
+
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/_internal/client.ts#L35)
|
|
697
705
|
|
|
698
706
|
Internal stream callout
|
|
699
707
|
|
|
@@ -730,7 +738,7 @@ Abort signal
|
|
|
730
738
|
|
|
731
739
|
# Class: HayleeAIClient
|
|
732
740
|
|
|
733
|
-
Defined in: [src/\_internal/client.ts:18](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
741
|
+
Defined in: [src/\_internal/client.ts:18](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/_internal/client.ts#L18)
|
|
734
742
|
|
|
735
743
|
Internal HayleeAI Client. Do not use unless necessary.
|
|
736
744
|
HayleeAIClient
|
|
@@ -745,7 +753,7 @@ Internal HayleeAI Client. Do not use unless necessary.
|
|
|
745
753
|
|
|
746
754
|
> **new HayleeAIClient**(`options`): `HayleeAIClient`
|
|
747
755
|
|
|
748
|
-
Defined in: [src/\_internal/client.ts:26](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
756
|
+
Defined in: [src/\_internal/client.ts:26](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/_internal/client.ts#L26)
|
|
749
757
|
|
|
750
758
|
#### Parameters
|
|
751
759
|
|
|
@@ -765,7 +773,7 @@ Auth, and baseURL
|
|
|
765
773
|
|
|
766
774
|
> **\_stream**(`payload`, `signal?`): `AsyncGenerator`\<`string`, `void`, `unknown`\>
|
|
767
775
|
|
|
768
|
-
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
776
|
+
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/_internal/client.ts#L35)
|
|
769
777
|
|
|
770
778
|
Internal stream callout
|
|
771
779
|
|
|
@@ -798,7 +806,7 @@ Abort signal
|
|
|
798
806
|
|
|
799
807
|
# Class: HayleeAIError
|
|
800
808
|
|
|
801
|
-
Defined in: [src/errors/base.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
809
|
+
Defined in: [src/errors/base.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/base.ts#L1)
|
|
802
810
|
|
|
803
811
|
## Extends
|
|
804
812
|
|
|
@@ -817,7 +825,7 @@ Defined in: [src/errors/base.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-
|
|
|
817
825
|
|
|
818
826
|
> **new HayleeAIError**(`message`): `HayleeAIError`
|
|
819
827
|
|
|
820
|
-
Defined in: [src/errors/base.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
828
|
+
Defined in: [src/errors/base.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/base.ts#L4)
|
|
821
829
|
|
|
822
830
|
#### Parameters
|
|
823
831
|
|
|
@@ -863,7 +871,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
863
871
|
|
|
864
872
|
> `readonly` **name**: `string` = `"HayleeAIError"`
|
|
865
873
|
|
|
866
|
-
Defined in: [src/errors/base.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
874
|
+
Defined in: [src/errors/base.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/base.ts#L2)
|
|
867
875
|
|
|
868
876
|
#### Overrides
|
|
869
877
|
|
|
@@ -1014,7 +1022,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1014
1022
|
|
|
1015
1023
|
# Class: LlmTokenContent
|
|
1016
1024
|
|
|
1017
|
-
Defined in: [src/messages/types.ts:27](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1025
|
+
Defined in: [src/messages/types.ts:27](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L27)
|
|
1018
1026
|
|
|
1019
1027
|
LLmTokenContent
|
|
1020
1028
|
|
|
@@ -1034,7 +1042,7 @@ LLmTokenContent
|
|
|
1034
1042
|
|
|
1035
1043
|
> **text**: `string`
|
|
1036
1044
|
|
|
1037
|
-
Defined in: [src/messages/types.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1045
|
+
Defined in: [src/messages/types.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L35)
|
|
1038
1046
|
|
|
1039
1047
|
***
|
|
1040
1048
|
|
|
@@ -1042,7 +1050,7 @@ Defined in: [src/messages/types.ts:35](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1042
1050
|
|
|
1043
1051
|
> **type**: `"text"`
|
|
1044
1052
|
|
|
1045
|
-
Defined in: [src/messages/types.ts:31](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1053
|
+
Defined in: [src/messages/types.ts:31](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L31)
|
|
1046
1054
|
|
|
1047
1055
|
|
|
1048
1056
|
<a name="classesllmtokeneventmd"></a>
|
|
@@ -1055,7 +1063,7 @@ Defined in: [src/messages/types.ts:31](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1055
1063
|
|
|
1056
1064
|
# Class: LlmTokenEvent
|
|
1057
1065
|
|
|
1058
|
-
Defined in: [src/messages/types.ts:38](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1066
|
+
Defined in: [src/messages/types.ts:38](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L38)
|
|
1059
1067
|
|
|
1060
1068
|
Base event for Streaming
|
|
1061
1069
|
BaseEvent
|
|
@@ -1084,7 +1092,7 @@ Base event for Streaming
|
|
|
1084
1092
|
|
|
1085
1093
|
> **content**: [`LlmTokenContent`](#classesllmtokencontentmd)[]
|
|
1086
1094
|
|
|
1087
|
-
Defined in: [src/messages/types.ts:42](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1095
|
+
Defined in: [src/messages/types.ts:42](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L42)
|
|
1088
1096
|
|
|
1089
1097
|
***
|
|
1090
1098
|
|
|
@@ -1092,7 +1100,7 @@ Defined in: [src/messages/types.ts:42](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1092
1100
|
|
|
1093
1101
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
1094
1102
|
|
|
1095
|
-
Defined in: [src/messages/types.ts:16](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1103
|
+
Defined in: [src/messages/types.ts:16](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L16)
|
|
1096
1104
|
|
|
1097
1105
|
Used to separate streams
|
|
1098
1106
|
|
|
@@ -1106,7 +1114,7 @@ Used to separate streams
|
|
|
1106
1114
|
|
|
1107
1115
|
> **model**: `string`
|
|
1108
1116
|
|
|
1109
|
-
Defined in: [src/messages/types.ts:46](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1117
|
+
Defined in: [src/messages/types.ts:46](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L46)
|
|
1110
1118
|
|
|
1111
1119
|
***
|
|
1112
1120
|
|
|
@@ -1114,7 +1122,7 @@ Defined in: [src/messages/types.ts:46](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1114
1122
|
|
|
1115
1123
|
> **node**: `string`
|
|
1116
1124
|
|
|
1117
|
-
Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1125
|
+
Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L20)
|
|
1118
1126
|
|
|
1119
1127
|
#### Inherited from
|
|
1120
1128
|
|
|
@@ -1131,7 +1139,7 @@ Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1131
1139
|
|
|
1132
1140
|
# Class: MessageService
|
|
1133
1141
|
|
|
1134
|
-
Defined in: [src/messages/message.service.ts:49](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1142
|
+
Defined in: [src/messages/message.service.ts:49](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/message.service.ts#L49)
|
|
1135
1143
|
|
|
1136
1144
|
## Constructors
|
|
1137
1145
|
|
|
@@ -1139,7 +1147,7 @@ Defined in: [src/messages/message.service.ts:49](https://github.com/vonuyvicoo/h
|
|
|
1139
1147
|
|
|
1140
1148
|
> **new MessageService**(`client`): `MessageService`
|
|
1141
1149
|
|
|
1142
|
-
Defined in: [src/messages/message.service.ts:51](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1150
|
+
Defined in: [src/messages/message.service.ts:51](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/message.service.ts#L51)
|
|
1143
1151
|
|
|
1144
1152
|
#### Parameters
|
|
1145
1153
|
|
|
@@ -1157,7 +1165,7 @@ Defined in: [src/messages/message.service.ts:51](https://github.com/vonuyvicoo/h
|
|
|
1157
1165
|
|
|
1158
1166
|
> **stream**(`payload`, `options?`): `Promise`\<`void`\>
|
|
1159
1167
|
|
|
1160
|
-
Defined in: [src/messages/message.service.ts:57](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1168
|
+
Defined in: [src/messages/message.service.ts:57](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/message.service.ts#L57)
|
|
1161
1169
|
|
|
1162
1170
|
#### Parameters
|
|
1163
1171
|
|
|
@@ -1188,7 +1196,7 @@ Config for streaming
|
|
|
1188
1196
|
|
|
1189
1197
|
# Class: NotFoundError
|
|
1190
1198
|
|
|
1191
|
-
Defined in: [src/errors/not-found.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1199
|
+
Defined in: [src/errors/not-found.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/not-found.error.ts#L3)
|
|
1192
1200
|
|
|
1193
1201
|
## Extends
|
|
1194
1202
|
|
|
@@ -1200,7 +1208,7 @@ Defined in: [src/errors/not-found.error.ts:3](https://github.com/vonuyvicoo/hayl
|
|
|
1200
1208
|
|
|
1201
1209
|
> **new NotFoundError**(`message`): `NotFoundError`
|
|
1202
1210
|
|
|
1203
|
-
Defined in: [src/errors/not-found.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1211
|
+
Defined in: [src/errors/not-found.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/not-found.error.ts#L6)
|
|
1204
1212
|
|
|
1205
1213
|
#### Parameters
|
|
1206
1214
|
|
|
@@ -1246,7 +1254,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1246
1254
|
|
|
1247
1255
|
> `readonly` **name**: `string` = `"NotFoundError"`
|
|
1248
1256
|
|
|
1249
|
-
Defined in: [src/errors/not-found.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1257
|
+
Defined in: [src/errors/not-found.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/not-found.error.ts#L4)
|
|
1250
1258
|
|
|
1251
1259
|
#### Overrides
|
|
1252
1260
|
|
|
@@ -1397,7 +1405,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1397
1405
|
|
|
1398
1406
|
# Class: ValidationError
|
|
1399
1407
|
|
|
1400
|
-
Defined in: [src/errors/validation.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1408
|
+
Defined in: [src/errors/validation.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/validation.error.ts#L3)
|
|
1401
1409
|
|
|
1402
1410
|
## Extends
|
|
1403
1411
|
|
|
@@ -1409,7 +1417,7 @@ Defined in: [src/errors/validation.error.ts:3](https://github.com/vonuyvicoo/hay
|
|
|
1409
1417
|
|
|
1410
1418
|
> **new ValidationError**(`message`, `details?`): `ValidationError`
|
|
1411
1419
|
|
|
1412
|
-
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1420
|
+
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/validation.error.ts#L5)
|
|
1413
1421
|
|
|
1414
1422
|
#### Parameters
|
|
1415
1423
|
|
|
@@ -1447,7 +1455,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1447
1455
|
|
|
1448
1456
|
> `optional` **details**: `any`
|
|
1449
1457
|
|
|
1450
|
-
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1458
|
+
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/validation.error.ts#L5)
|
|
1451
1459
|
|
|
1452
1460
|
***
|
|
1453
1461
|
|
|
@@ -1467,7 +1475,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1467
1475
|
|
|
1468
1476
|
> `readonly` **name**: `string` = `"ValidationError"`
|
|
1469
1477
|
|
|
1470
|
-
Defined in: [src/errors/validation.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1478
|
+
Defined in: [src/errors/validation.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/errors/validation.error.ts#L4)
|
|
1471
1479
|
|
|
1472
1480
|
#### Overrides
|
|
1473
1481
|
|
|
@@ -1618,7 +1626,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1618
1626
|
|
|
1619
1627
|
# Enumeration: EventKind
|
|
1620
1628
|
|
|
1621
|
-
Defined in: [src/messages/types.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1629
|
+
Defined in: [src/messages/types.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L1)
|
|
1622
1630
|
|
|
1623
1631
|
## Enumeration Members
|
|
1624
1632
|
|
|
@@ -1626,7 +1634,7 @@ Defined in: [src/messages/types.ts:1](https://github.com/vonuyvicoo/haylee-ai-ch
|
|
|
1626
1634
|
|
|
1627
1635
|
> **LLM\_TOKEN**: `"llm_token"`
|
|
1628
1636
|
|
|
1629
|
-
Defined in: [src/messages/types.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1637
|
+
Defined in: [src/messages/types.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L2)
|
|
1630
1638
|
|
|
1631
1639
|
***
|
|
1632
1640
|
|
|
@@ -1634,7 +1642,7 @@ Defined in: [src/messages/types.ts:2](https://github.com/vonuyvicoo/haylee-ai-ch
|
|
|
1634
1642
|
|
|
1635
1643
|
> **TOOLS**: `"tools"`
|
|
1636
1644
|
|
|
1637
|
-
Defined in: [src/messages/types.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1645
|
+
Defined in: [src/messages/types.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L3)
|
|
1638
1646
|
|
|
1639
1647
|
|
|
1640
1648
|
<a name="enumerationsrolemd"></a>
|
|
@@ -1647,7 +1655,7 @@ Defined in: [src/messages/types.ts:3](https://github.com/vonuyvicoo/haylee-ai-ch
|
|
|
1647
1655
|
|
|
1648
1656
|
# Enumeration: Role
|
|
1649
1657
|
|
|
1650
|
-
Defined in: [src/types/chat.interface.ts:
|
|
1658
|
+
Defined in: [src/types/chat.interface.ts:19](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/types/chat.interface.ts#L19)
|
|
1651
1659
|
|
|
1652
1660
|
## Enumeration Members
|
|
1653
1661
|
|
|
@@ -1655,7 +1663,7 @@ Defined in: [src/types/chat.interface.ts:17](https://github.com/vonuyvicoo/hayle
|
|
|
1655
1663
|
|
|
1656
1664
|
> **AI**: `"ai"`
|
|
1657
1665
|
|
|
1658
|
-
Defined in: [src/types/chat.interface.ts:
|
|
1666
|
+
Defined in: [src/types/chat.interface.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/types/chat.interface.ts#L21)
|
|
1659
1667
|
|
|
1660
1668
|
***
|
|
1661
1669
|
|
|
@@ -1663,7 +1671,7 @@ Defined in: [src/types/chat.interface.ts:19](https://github.com/vonuyvicoo/hayle
|
|
|
1663
1671
|
|
|
1664
1672
|
> **HUMAN**: `"human"`
|
|
1665
1673
|
|
|
1666
|
-
Defined in: [src/types/chat.interface.ts:
|
|
1674
|
+
Defined in: [src/types/chat.interface.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/types/chat.interface.ts#L20)
|
|
1667
1675
|
|
|
1668
1676
|
|
|
1669
1677
|
<a name="enumerationstoolstatusmd"></a>
|
|
@@ -1676,7 +1684,7 @@ Defined in: [src/types/chat.interface.ts:18](https://github.com/vonuyvicoo/hayle
|
|
|
1676
1684
|
|
|
1677
1685
|
# Enumeration: ToolStatus
|
|
1678
1686
|
|
|
1679
|
-
Defined in: [src/messages/types.ts:62](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1687
|
+
Defined in: [src/messages/types.ts:62](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L62)
|
|
1680
1688
|
|
|
1681
1689
|
## Enumeration Members
|
|
1682
1690
|
|
|
@@ -1684,7 +1692,7 @@ Defined in: [src/messages/types.ts:62](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1684
1692
|
|
|
1685
1693
|
> **END**: `"END"`
|
|
1686
1694
|
|
|
1687
|
-
Defined in: [src/messages/types.ts:64](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1695
|
+
Defined in: [src/messages/types.ts:64](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L64)
|
|
1688
1696
|
|
|
1689
1697
|
***
|
|
1690
1698
|
|
|
@@ -1692,7 +1700,7 @@ Defined in: [src/messages/types.ts:64](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1692
1700
|
|
|
1693
1701
|
> **ERROR**: `"ERROR"`
|
|
1694
1702
|
|
|
1695
|
-
Defined in: [src/messages/types.ts:65](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1703
|
+
Defined in: [src/messages/types.ts:65](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L65)
|
|
1696
1704
|
|
|
1697
1705
|
***
|
|
1698
1706
|
|
|
@@ -1700,7 +1708,7 @@ Defined in: [src/messages/types.ts:65](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1700
1708
|
|
|
1701
1709
|
> **START**: `"START"`
|
|
1702
1710
|
|
|
1703
|
-
Defined in: [src/messages/types.ts:63](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1711
|
+
Defined in: [src/messages/types.ts:63](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L63)
|
|
1704
1712
|
|
|
1705
1713
|
|
|
1706
1714
|
<a name="interfacesmessageserviceoptionsmd"></a>
|
|
@@ -1713,7 +1721,7 @@ Defined in: [src/messages/types.ts:63](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1713
1721
|
|
|
1714
1722
|
# Interface: MessageServiceOptions
|
|
1715
1723
|
|
|
1716
|
-
Defined in: [src/messages/message.service.ts:12](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1724
|
+
Defined in: [src/messages/message.service.ts:12](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/message.service.ts#L12)
|
|
1717
1725
|
|
|
1718
1726
|
## Properties
|
|
1719
1727
|
|
|
@@ -1721,7 +1729,7 @@ Defined in: [src/messages/message.service.ts:12](https://github.com/vonuyvicoo/h
|
|
|
1721
1729
|
|
|
1722
1730
|
> `optional` **signal**: `AbortSignal`
|
|
1723
1731
|
|
|
1724
|
-
Defined in: [src/messages/message.service.ts:46](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1732
|
+
Defined in: [src/messages/message.service.ts:46](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/message.service.ts#L46)
|
|
1725
1733
|
|
|
1726
1734
|
AbortSignal for terminating the upstream stream
|
|
1727
1735
|
|
|
@@ -1731,7 +1739,7 @@ AbortSignal for terminating the upstream stream
|
|
|
1731
1739
|
|
|
1732
1740
|
> `optional` **onEnd**(`ev`): `void`
|
|
1733
1741
|
|
|
1734
|
-
Defined in: [src/messages/message.service.ts:22](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1742
|
+
Defined in: [src/messages/message.service.ts:22](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/message.service.ts#L22)
|
|
1735
1743
|
|
|
1736
1744
|
triggers upon stream end
|
|
1737
1745
|
|
|
@@ -1753,7 +1761,7 @@ EndEvent
|
|
|
1753
1761
|
|
|
1754
1762
|
> `optional` **onError**(`err`): `void`
|
|
1755
1763
|
|
|
1756
|
-
Defined in: [src/messages/message.service.ts:42](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1764
|
+
Defined in: [src/messages/message.service.ts:42](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/message.service.ts#L42)
|
|
1757
1765
|
|
|
1758
1766
|
Streams errors on runtime
|
|
1759
1767
|
|
|
@@ -1773,7 +1781,7 @@ Streams errors on runtime
|
|
|
1773
1781
|
|
|
1774
1782
|
> `optional` **onLlmToken**(`ev`): `void`
|
|
1775
1783
|
|
|
1776
|
-
Defined in: [src/messages/message.service.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1784
|
+
Defined in: [src/messages/message.service.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/message.service.ts#L17)
|
|
1777
1785
|
|
|
1778
1786
|
Streams llm tokens for output
|
|
1779
1787
|
|
|
@@ -1793,7 +1801,7 @@ Streams llm tokens for output
|
|
|
1793
1801
|
|
|
1794
1802
|
> `optional` **onToolEnd**(`ev`): `void`
|
|
1795
1803
|
|
|
1796
|
-
Defined in: [src/messages/message.service.ts:32](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1804
|
+
Defined in: [src/messages/message.service.ts:32](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/message.service.ts#L32)
|
|
1797
1805
|
|
|
1798
1806
|
Streams tool end updates
|
|
1799
1807
|
|
|
@@ -1815,7 +1823,7 @@ ToolEvent
|
|
|
1815
1823
|
|
|
1816
1824
|
> `optional` **onToolError**(`ev`): `void`
|
|
1817
1825
|
|
|
1818
|
-
Defined in: [src/messages/message.service.ts:37](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1826
|
+
Defined in: [src/messages/message.service.ts:37](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/message.service.ts#L37)
|
|
1819
1827
|
|
|
1820
1828
|
Streams tool errors
|
|
1821
1829
|
|
|
@@ -1837,7 +1845,7 @@ ToolEvent
|
|
|
1837
1845
|
|
|
1838
1846
|
> `optional` **onToolStart**(`ev`): `void`
|
|
1839
1847
|
|
|
1840
|
-
Defined in: [src/messages/message.service.ts:27](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1848
|
+
Defined in: [src/messages/message.service.ts:27](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/message.service.ts#L27)
|
|
1841
1849
|
|
|
1842
1850
|
Streams tool start updates
|
|
1843
1851
|
|
|
@@ -1864,7 +1872,7 @@ ToolEvent
|
|
|
1864
1872
|
|
|
1865
1873
|
# Interface: ToolContent
|
|
1866
1874
|
|
|
1867
|
-
Defined in: [src/messages/types.ts:68](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1875
|
+
Defined in: [src/messages/types.ts:68](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L68)
|
|
1868
1876
|
|
|
1869
1877
|
## Properties
|
|
1870
1878
|
|
|
@@ -1872,7 +1880,7 @@ Defined in: [src/messages/types.ts:68](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1872
1880
|
|
|
1873
1881
|
> **params**: `unknown`
|
|
1874
1882
|
|
|
1875
|
-
Defined in: [src/messages/types.ts:69](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1883
|
+
Defined in: [src/messages/types.ts:69](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L69)
|
|
1876
1884
|
|
|
1877
1885
|
|
|
1878
1886
|
<a name="interfacestooleventmd"></a>
|
|
@@ -1885,7 +1893,7 @@ Defined in: [src/messages/types.ts:69](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1885
1893
|
|
|
1886
1894
|
# Interface: ToolEvent
|
|
1887
1895
|
|
|
1888
|
-
Defined in: [src/messages/types.ts:53](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1896
|
+
Defined in: [src/messages/types.ts:53](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L53)
|
|
1889
1897
|
|
|
1890
1898
|
Base event for Streaming
|
|
1891
1899
|
BaseEvent
|
|
@@ -1900,7 +1908,7 @@ Base event for Streaming
|
|
|
1900
1908
|
|
|
1901
1909
|
> `optional` **content**: [`ToolContent`](#interfacestoolcontentmd)
|
|
1902
1910
|
|
|
1903
|
-
Defined in: [src/messages/types.ts:54](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1911
|
+
Defined in: [src/messages/types.ts:54](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L54)
|
|
1904
1912
|
|
|
1905
1913
|
***
|
|
1906
1914
|
|
|
@@ -1908,7 +1916,7 @@ Defined in: [src/messages/types.ts:54](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1908
1916
|
|
|
1909
1917
|
> `optional` **error**: `unknown`
|
|
1910
1918
|
|
|
1911
|
-
Defined in: [src/messages/types.ts:59](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1919
|
+
Defined in: [src/messages/types.ts:59](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L59)
|
|
1912
1920
|
|
|
1913
1921
|
***
|
|
1914
1922
|
|
|
@@ -1916,7 +1924,7 @@ Defined in: [src/messages/types.ts:59](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1916
1924
|
|
|
1917
1925
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
1918
1926
|
|
|
1919
|
-
Defined in: [src/messages/types.ts:16](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1927
|
+
Defined in: [src/messages/types.ts:16](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L16)
|
|
1920
1928
|
|
|
1921
1929
|
Used to separate streams
|
|
1922
1930
|
|
|
@@ -1930,7 +1938,7 @@ Used to separate streams
|
|
|
1930
1938
|
|
|
1931
1939
|
> **name**: `string`
|
|
1932
1940
|
|
|
1933
|
-
Defined in: [src/messages/types.ts:55](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1941
|
+
Defined in: [src/messages/types.ts:55](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L55)
|
|
1934
1942
|
|
|
1935
1943
|
***
|
|
1936
1944
|
|
|
@@ -1938,7 +1946,7 @@ Defined in: [src/messages/types.ts:55](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1938
1946
|
|
|
1939
1947
|
> **node**: `string`
|
|
1940
1948
|
|
|
1941
|
-
Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1949
|
+
Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L20)
|
|
1942
1950
|
|
|
1943
1951
|
#### Inherited from
|
|
1944
1952
|
|
|
@@ -1950,7 +1958,7 @@ Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1950
1958
|
|
|
1951
1959
|
> **results**: [`ToolResultContent`](#interfacestoolresultcontentmd)[]
|
|
1952
1960
|
|
|
1953
|
-
Defined in: [src/messages/types.ts:58](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1961
|
+
Defined in: [src/messages/types.ts:58](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L58)
|
|
1954
1962
|
|
|
1955
1963
|
***
|
|
1956
1964
|
|
|
@@ -1958,7 +1966,7 @@ Defined in: [src/messages/types.ts:58](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1958
1966
|
|
|
1959
1967
|
> **status**: [`ToolStatus`](#enumerationstoolstatusmd)
|
|
1960
1968
|
|
|
1961
|
-
Defined in: [src/messages/types.ts:57](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1969
|
+
Defined in: [src/messages/types.ts:57](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L57)
|
|
1962
1970
|
|
|
1963
1971
|
***
|
|
1964
1972
|
|
|
@@ -1966,7 +1974,7 @@ Defined in: [src/messages/types.ts:57](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1966
1974
|
|
|
1967
1975
|
> `optional` **tool\_call\_id**: `string`
|
|
1968
1976
|
|
|
1969
|
-
Defined in: [src/messages/types.ts:56](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1977
|
+
Defined in: [src/messages/types.ts:56](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L56)
|
|
1970
1978
|
|
|
1971
1979
|
|
|
1972
1980
|
<a name="interfacestoolresultcontentmd"></a>
|
|
@@ -1979,7 +1987,7 @@ Defined in: [src/messages/types.ts:56](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1979
1987
|
|
|
1980
1988
|
# Interface: ToolResultContent
|
|
1981
1989
|
|
|
1982
|
-
Defined in: [src/messages/types.ts:72](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1990
|
+
Defined in: [src/messages/types.ts:72](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L72)
|
|
1983
1991
|
|
|
1984
1992
|
## Properties
|
|
1985
1993
|
|
|
@@ -1987,7 +1995,7 @@ Defined in: [src/messages/types.ts:72](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1987
1995
|
|
|
1988
1996
|
> **content**: `any`
|
|
1989
1997
|
|
|
1990
|
-
Defined in: [src/messages/types.ts:76](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1998
|
+
Defined in: [src/messages/types.ts:76](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L76)
|
|
1991
1999
|
|
|
1992
2000
|
***
|
|
1993
2001
|
|
|
@@ -1995,7 +2003,7 @@ Defined in: [src/messages/types.ts:76](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1995
2003
|
|
|
1996
2004
|
> **type**: `string`
|
|
1997
2005
|
|
|
1998
|
-
Defined in: [src/messages/types.ts:74](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
2006
|
+
Defined in: [src/messages/types.ts:74](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/messages/types.ts#L74)
|
|
1999
2007
|
|
|
2000
2008
|
|
|
2001
2009
|
<a name="type-aliaseshayleeaichatclientoptionsmd"></a>
|
|
@@ -2010,7 +2018,7 @@ Defined in: [src/messages/types.ts:74](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
2010
2018
|
|
|
2011
2019
|
> **HayleeAIChatClientOptions** = `object`
|
|
2012
2020
|
|
|
2013
|
-
Defined in: [src/\_internal/client.ts:9](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
2021
|
+
Defined in: [src/\_internal/client.ts:9](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/_internal/client.ts#L9)
|
|
2014
2022
|
|
|
2015
2023
|
Options for the HayleeAI Client
|
|
2016
2024
|
|
|
@@ -2020,6 +2028,6 @@ Options for the HayleeAI Client
|
|
|
2020
2028
|
|
|
2021
2029
|
> `optional` **baseUrl**: `string`
|
|
2022
2030
|
|
|
2023
|
-
Defined in: [src/\_internal/client.ts:10](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
2031
|
+
Defined in: [src/\_internal/client.ts:10](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/018702b4a1a1d71cf27b821e9dea5ad0b3aa5d5b/src/_internal/client.ts#L10)
|
|
2024
2032
|
|
|
2025
2033
|
Optional base URL, defaults to production
|
package/dist/index.cjs
CHANGED
|
@@ -267,10 +267,14 @@ var AuthenticationError = class _AuthenticationError extends HayleeAIError {
|
|
|
267
267
|
var import_class_validator = require("class-validator");
|
|
268
268
|
var CreateMessageDto = class {
|
|
269
269
|
message;
|
|
270
|
+
conversation_id;
|
|
270
271
|
};
|
|
271
272
|
__decorateClass([
|
|
272
273
|
(0, import_class_validator.IsString)()
|
|
273
274
|
], CreateMessageDto.prototype, "message", 2);
|
|
275
|
+
__decorateClass([
|
|
276
|
+
(0, import_class_validator.IsOptional)()
|
|
277
|
+
], CreateMessageDto.prototype, "conversation_id", 2);
|
|
274
278
|
var Role = /* @__PURE__ */ ((Role2) => {
|
|
275
279
|
Role2["HUMAN"] = "human";
|
|
276
280
|
Role2["AI"] = "ai";
|
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 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\";\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 { 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}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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,I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AAS;AAAA,EACvD;AACJ;;;ACPO,IAAM,qBAAN,MAAM,4BAA2B,cAAc;AAAA,EAClC,OAAe;AAAA,EAE/B,YAAY,SAAiB;AACzB,UAAM,OAAO;AACb,WAAO,eAAe,MAAM,oBAAmB,SAAS;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,6BAAyB;AAOlB,IAAM,mBAAN,MAAuB;AAAA,EAG1B;AACJ;AADI;AAAA,MADC,iCAAS;AAAA,GAFD,iBAGT;AAMG,IAAK,OAAL,kBAAKC,UAAL;AACH,EAAAA,MAAA,WAAQ;AACR,EAAAA,MAAA,QAAK;AAFG,SAAAA;AAAA,GAAA;;;AXVZ,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"]}
|
|
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 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\";\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 { IsOptional, 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 @IsOptional()\n conversation_id?: string;\n}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAA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;AACJ;","names":["EventKind","ToolStatus","Role"]}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -226,13 +226,17 @@ var AuthenticationError = class _AuthenticationError extends HayleeAIError {
|
|
|
226
226
|
};
|
|
227
227
|
|
|
228
228
|
// src/types/chat.interface.ts
|
|
229
|
-
import { IsString } from "class-validator";
|
|
229
|
+
import { IsOptional, IsString } from "class-validator";
|
|
230
230
|
var CreateMessageDto = class {
|
|
231
231
|
message;
|
|
232
|
+
conversation_id;
|
|
232
233
|
};
|
|
233
234
|
__decorateClass([
|
|
234
235
|
IsString()
|
|
235
236
|
], CreateMessageDto.prototype, "message", 2);
|
|
237
|
+
__decorateClass([
|
|
238
|
+
IsOptional()
|
|
239
|
+
], CreateMessageDto.prototype, "conversation_id", 2);
|
|
236
240
|
var Role = /* @__PURE__ */ ((Role2) => {
|
|
237
241
|
Role2["HUMAN"] = "human";
|
|
238
242
|
Role2["AI"] = "ai";
|
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 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\";\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 { 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}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\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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eAAe,MAAM,iBAAgB,SAAS;AAAA,EACzD;AAAA,EAJgB,OAAe;AAKnC;;;ACNO,IAAM,gBAAN,MAAM,uBAAsB,cAAc;AAAA,EAC7B,OAAe;AAAA,EAE/B,YAAY,SAAiB;AACzB,UAAM,OAAO;AACb,WAAO,eAAe,MAAM,eAAc,SAAS;AAAA,EACvD;AACJ;;;ACPO,IAAM,qBAAN,MAAM,4BAA2B,cAAc;AAAA,EAClC,OAAe;AAAA,EAE/B,YAAY,SAAiB;AACzB,UAAM,OAAO;AACb,WAAO,eAAe,MAAM,oBAAmB,SAAS;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,SAAS,gBAAgB;AAOlB,IAAM,mBAAN,MAAuB;AAAA,EAG1B;AACJ;AADI;AAAA,EADC,SAAS;AAAA,GAFD,iBAGT;AAMG,IAAK,OAAL,kBAAKC,UAAL;AACH,EAAAA,MAAA,WAAQ;AACR,EAAAA,MAAA,QAAK;AAFG,SAAAA;AAAA,GAAA;;;ACVZ,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"]}
|
|
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\";\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 { IsOptional, 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 @IsOptional()\n conversation_id?: string;\n}\n\n/*\n * @enum Role - Role of message\n */\nexport enum Role {\n HUMAN = \"human\",\n AI = \"ai\"\n}\n\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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