@haylee-ai/chat-sdk 1.0.4 → 1.0.5
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 +238 -76
- package/dist/index.cjs +21 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,6 +79,8 @@ await client.messages.stream(
|
|
|
79
79
|
- [AuthenticationError](#classesauthenticationerrormd)
|
|
80
80
|
- [AuthorizationError](#classesauthorizationerrormd)
|
|
81
81
|
- [BaseEvent](#classesbaseeventmd)
|
|
82
|
+
- [ConversationInfoContent](#classesconversationinfocontentmd)
|
|
83
|
+
- [ConversationInfoEvent](#classesconversationinfoeventmd)
|
|
82
84
|
- [CreateMessageDto](#classescreatemessagedtomd)
|
|
83
85
|
- [EndEvent](#classesendeventmd)
|
|
84
86
|
- [HayleeAI](#classeshayleeaimd)
|
|
@@ -112,7 +114,7 @@ await client.messages.stream(
|
|
|
112
114
|
|
|
113
115
|
# Class: AuthenticationError
|
|
114
116
|
|
|
115
|
-
Defined in: [src/errors/authentication.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
117
|
+
Defined in: [src/errors/authentication.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authentication.error.ts#L3)
|
|
116
118
|
|
|
117
119
|
## Extends
|
|
118
120
|
|
|
@@ -124,7 +126,7 @@ Defined in: [src/errors/authentication.error.ts:3](https://github.com/vonuyvicoo
|
|
|
124
126
|
|
|
125
127
|
> **new AuthenticationError**(`message`): `AuthenticationError`
|
|
126
128
|
|
|
127
|
-
Defined in: [src/errors/authentication.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
129
|
+
Defined in: [src/errors/authentication.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authentication.error.ts#L6)
|
|
128
130
|
|
|
129
131
|
#### Parameters
|
|
130
132
|
|
|
@@ -170,7 +172,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
170
172
|
|
|
171
173
|
> `readonly` **name**: `string` = `"AuthenticationError"`
|
|
172
174
|
|
|
173
|
-
Defined in: [src/errors/authentication.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
175
|
+
Defined in: [src/errors/authentication.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authentication.error.ts#L4)
|
|
174
176
|
|
|
175
177
|
#### Overrides
|
|
176
178
|
|
|
@@ -321,7 +323,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
321
323
|
|
|
322
324
|
# Class: AuthorizationError
|
|
323
325
|
|
|
324
|
-
Defined in: [src/errors/authorization.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
326
|
+
Defined in: [src/errors/authorization.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authorization.error.ts#L3)
|
|
325
327
|
|
|
326
328
|
## Extends
|
|
327
329
|
|
|
@@ -333,7 +335,7 @@ Defined in: [src/errors/authorization.error.ts:3](https://github.com/vonuyvicoo/
|
|
|
333
335
|
|
|
334
336
|
> **new AuthorizationError**(`message`): `AuthorizationError`
|
|
335
337
|
|
|
336
|
-
Defined in: [src/errors/authorization.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
338
|
+
Defined in: [src/errors/authorization.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authorization.error.ts#L6)
|
|
337
339
|
|
|
338
340
|
#### Parameters
|
|
339
341
|
|
|
@@ -379,7 +381,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
379
381
|
|
|
380
382
|
> `readonly` **name**: `string` = `"AuthorizationError"`
|
|
381
383
|
|
|
382
|
-
Defined in: [src/errors/authorization.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
384
|
+
Defined in: [src/errors/authorization.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/authorization.error.ts#L4)
|
|
383
385
|
|
|
384
386
|
#### Overrides
|
|
385
387
|
|
|
@@ -530,7 +532,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
530
532
|
|
|
531
533
|
# Class: BaseEvent
|
|
532
534
|
|
|
533
|
-
Defined in: [src/messages/types.ts:
|
|
535
|
+
Defined in: [src/messages/types.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L13)
|
|
534
536
|
|
|
535
537
|
Base event for Streaming
|
|
536
538
|
BaseEvent
|
|
@@ -538,6 +540,7 @@ Base event for Streaming
|
|
|
538
540
|
## Extended by
|
|
539
541
|
|
|
540
542
|
- [`LlmTokenEvent`](#classesllmtokeneventmd)
|
|
543
|
+
- [`ConversationInfoEvent`](#classesconversationinfoeventmd)
|
|
541
544
|
- [`ToolEvent`](#interfacestooleventmd)
|
|
542
545
|
|
|
543
546
|
## Constructors
|
|
@@ -556,7 +559,7 @@ Base event for Streaming
|
|
|
556
559
|
|
|
557
560
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
558
561
|
|
|
559
|
-
Defined in: [src/messages/types.ts:
|
|
562
|
+
Defined in: [src/messages/types.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L17)
|
|
560
563
|
|
|
561
564
|
Used to separate streams
|
|
562
565
|
|
|
@@ -566,11 +569,118 @@ Used to separate streams
|
|
|
566
569
|
|
|
567
570
|
> **node**: `string`
|
|
568
571
|
|
|
569
|
-
Defined in: [src/messages/types.ts:
|
|
572
|
+
Defined in: [src/messages/types.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L21)
|
|
570
573
|
|
|
571
574
|
Source node in langgraph
|
|
572
575
|
|
|
573
576
|
|
|
577
|
+
<a name="classesconversationinfocontentmd"></a>
|
|
578
|
+
|
|
579
|
+
[**@haylee-ai/chat-sdk v1.0.0**](#readmemd)
|
|
580
|
+
|
|
581
|
+
***
|
|
582
|
+
|
|
583
|
+
[@haylee-ai/chat-sdk](#readmemd) / ConversationInfoContent
|
|
584
|
+
|
|
585
|
+
# Class: ConversationInfoContent
|
|
586
|
+
|
|
587
|
+
Defined in: [src/messages/types.ts:55](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L55)
|
|
588
|
+
|
|
589
|
+
## Constructors
|
|
590
|
+
|
|
591
|
+
### Constructor
|
|
592
|
+
|
|
593
|
+
> **new ConversationInfoContent**(): `ConversationInfoContent`
|
|
594
|
+
|
|
595
|
+
#### Returns
|
|
596
|
+
|
|
597
|
+
`ConversationInfoContent`
|
|
598
|
+
|
|
599
|
+
## Properties
|
|
600
|
+
|
|
601
|
+
### subject
|
|
602
|
+
|
|
603
|
+
> **subject**: `string`
|
|
604
|
+
|
|
605
|
+
Defined in: [src/messages/types.ts:57](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L57)
|
|
606
|
+
|
|
607
|
+
***
|
|
608
|
+
|
|
609
|
+
### type
|
|
610
|
+
|
|
611
|
+
> **type**: `"created"` \| `"updated"` \| `"deleted"` \| `"error"`
|
|
612
|
+
|
|
613
|
+
Defined in: [src/messages/types.ts:56](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L56)
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
<a name="classesconversationinfoeventmd"></a>
|
|
617
|
+
|
|
618
|
+
[**@haylee-ai/chat-sdk v1.0.0**](#readmemd)
|
|
619
|
+
|
|
620
|
+
***
|
|
621
|
+
|
|
622
|
+
[@haylee-ai/chat-sdk](#readmemd) / ConversationInfoEvent
|
|
623
|
+
|
|
624
|
+
# Class: ConversationInfoEvent
|
|
625
|
+
|
|
626
|
+
Defined in: [src/messages/types.ts:51](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L51)
|
|
627
|
+
|
|
628
|
+
Base event for Streaming
|
|
629
|
+
BaseEvent
|
|
630
|
+
|
|
631
|
+
## Extends
|
|
632
|
+
|
|
633
|
+
- [`BaseEvent`](#classesbaseeventmd)
|
|
634
|
+
|
|
635
|
+
## Constructors
|
|
636
|
+
|
|
637
|
+
### Constructor
|
|
638
|
+
|
|
639
|
+
> **new ConversationInfoEvent**(): `ConversationInfoEvent`
|
|
640
|
+
|
|
641
|
+
#### Returns
|
|
642
|
+
|
|
643
|
+
`ConversationInfoEvent`
|
|
644
|
+
|
|
645
|
+
#### Inherited from
|
|
646
|
+
|
|
647
|
+
[`BaseEvent`](#classesbaseeventmd).[`constructor`](#constructor)
|
|
648
|
+
|
|
649
|
+
## Properties
|
|
650
|
+
|
|
651
|
+
### content
|
|
652
|
+
|
|
653
|
+
> **content**: [`ConversationInfoContent`](#classesconversationinfocontentmd)
|
|
654
|
+
|
|
655
|
+
Defined in: [src/messages/types.ts:52](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L52)
|
|
656
|
+
|
|
657
|
+
***
|
|
658
|
+
|
|
659
|
+
### kind
|
|
660
|
+
|
|
661
|
+
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
662
|
+
|
|
663
|
+
Defined in: [src/messages/types.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L17)
|
|
664
|
+
|
|
665
|
+
Used to separate streams
|
|
666
|
+
|
|
667
|
+
#### Inherited from
|
|
668
|
+
|
|
669
|
+
[`BaseEvent`](#classesbaseeventmd).[`kind`](#kind)
|
|
670
|
+
|
|
671
|
+
***
|
|
672
|
+
|
|
673
|
+
### node
|
|
674
|
+
|
|
675
|
+
> **node**: `string`
|
|
676
|
+
|
|
677
|
+
Defined in: [src/messages/types.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L21)
|
|
678
|
+
|
|
679
|
+
#### Inherited from
|
|
680
|
+
|
|
681
|
+
[`BaseEvent`](#classesbaseeventmd).[`node`](#node)
|
|
682
|
+
|
|
683
|
+
|
|
574
684
|
<a name="classescreatemessagedtomd"></a>
|
|
575
685
|
|
|
576
686
|
[**@haylee-ai/chat-sdk v1.0.0**](#readmemd)
|
|
@@ -581,7 +691,7 @@ Source node in langgraph
|
|
|
581
691
|
|
|
582
692
|
# Class: CreateMessageDto
|
|
583
693
|
|
|
584
|
-
Defined in: [src/types/chat.interface.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
694
|
+
Defined in: [src/types/chat.interface.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L8)
|
|
585
695
|
|
|
586
696
|
DTO for creating a message
|
|
587
697
|
|
|
@@ -601,7 +711,7 @@ DTO for creating a message
|
|
|
601
711
|
|
|
602
712
|
> `optional` **conversation\_id**: `string`
|
|
603
713
|
|
|
604
|
-
Defined in: [src/types/chat.interface.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
714
|
+
Defined in: [src/types/chat.interface.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L13)
|
|
605
715
|
|
|
606
716
|
***
|
|
607
717
|
|
|
@@ -609,7 +719,7 @@ Defined in: [src/types/chat.interface.ts:13](https://github.com/vonuyvicoo/hayle
|
|
|
609
719
|
|
|
610
720
|
> **message**: `string`
|
|
611
721
|
|
|
612
|
-
Defined in: [src/types/chat.interface.ts:11](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
722
|
+
Defined in: [src/types/chat.interface.ts:11](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L11)
|
|
613
723
|
|
|
614
724
|
User message
|
|
615
725
|
|
|
@@ -624,7 +734,7 @@ User message
|
|
|
624
734
|
|
|
625
735
|
# Class: EndEvent
|
|
626
736
|
|
|
627
|
-
Defined in: [src/messages/types.ts:
|
|
737
|
+
Defined in: [src/messages/types.ts:62](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L62)
|
|
628
738
|
|
|
629
739
|
## Constructors
|
|
630
740
|
|
|
@@ -642,7 +752,7 @@ Defined in: [src/messages/types.ts:49](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
642
752
|
|
|
643
753
|
> **success**: `boolean`
|
|
644
754
|
|
|
645
|
-
Defined in: [src/messages/types.ts:
|
|
755
|
+
Defined in: [src/messages/types.ts:63](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L63)
|
|
646
756
|
|
|
647
757
|
|
|
648
758
|
<a name="classeshayleeaimd"></a>
|
|
@@ -655,7 +765,7 @@ Defined in: [src/messages/types.ts:50](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
655
765
|
|
|
656
766
|
# Class: HayleeAI
|
|
657
767
|
|
|
658
|
-
Defined in: [src/index.ts:7](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
768
|
+
Defined in: [src/index.ts:7](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/index.ts#L7)
|
|
659
769
|
|
|
660
770
|
Instantiate a new HayleeAI connection
|
|
661
771
|
|
|
@@ -669,7 +779,7 @@ Instantiate a new HayleeAI connection
|
|
|
669
779
|
|
|
670
780
|
> **new HayleeAI**(`options`): `HayleeAI`
|
|
671
781
|
|
|
672
|
-
Defined in: [src/index.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
782
|
+
Defined in: [src/index.ts:13](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/index.ts#L13)
|
|
673
783
|
|
|
674
784
|
#### Parameters
|
|
675
785
|
|
|
@@ -693,7 +803,7 @@ HayleeAIChatClientOptions
|
|
|
693
803
|
|
|
694
804
|
> **messages**: [`MessageService`](#classesmessageservicemd)
|
|
695
805
|
|
|
696
|
-
Defined in: [src/index.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
806
|
+
Defined in: [src/index.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/index.ts#L8)
|
|
697
807
|
|
|
698
808
|
## Methods
|
|
699
809
|
|
|
@@ -701,7 +811,7 @@ Defined in: [src/index.ts:8](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/bl
|
|
|
701
811
|
|
|
702
812
|
> **\_stream**(`payload`, `signal?`): `AsyncGenerator`\<`string`, `void`, `unknown`\>
|
|
703
813
|
|
|
704
|
-
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
814
|
+
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L35)
|
|
705
815
|
|
|
706
816
|
Internal stream callout
|
|
707
817
|
|
|
@@ -738,7 +848,7 @@ Abort signal
|
|
|
738
848
|
|
|
739
849
|
# Class: HayleeAIClient
|
|
740
850
|
|
|
741
|
-
Defined in: [src/\_internal/client.ts:18](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
851
|
+
Defined in: [src/\_internal/client.ts:18](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L18)
|
|
742
852
|
|
|
743
853
|
Internal HayleeAI Client. Do not use unless necessary.
|
|
744
854
|
HayleeAIClient
|
|
@@ -753,7 +863,7 @@ Internal HayleeAI Client. Do not use unless necessary.
|
|
|
753
863
|
|
|
754
864
|
> **new HayleeAIClient**(`options`): `HayleeAIClient`
|
|
755
865
|
|
|
756
|
-
Defined in: [src/\_internal/client.ts:26](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
866
|
+
Defined in: [src/\_internal/client.ts:26](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L26)
|
|
757
867
|
|
|
758
868
|
#### Parameters
|
|
759
869
|
|
|
@@ -773,7 +883,7 @@ Auth, and baseURL
|
|
|
773
883
|
|
|
774
884
|
> **\_stream**(`payload`, `signal?`): `AsyncGenerator`\<`string`, `void`, `unknown`\>
|
|
775
885
|
|
|
776
|
-
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
886
|
+
Defined in: [src/\_internal/client.ts:35](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L35)
|
|
777
887
|
|
|
778
888
|
Internal stream callout
|
|
779
889
|
|
|
@@ -806,7 +916,7 @@ Abort signal
|
|
|
806
916
|
|
|
807
917
|
# Class: HayleeAIError
|
|
808
918
|
|
|
809
|
-
Defined in: [src/errors/base.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
919
|
+
Defined in: [src/errors/base.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/base.ts#L1)
|
|
810
920
|
|
|
811
921
|
## Extends
|
|
812
922
|
|
|
@@ -825,7 +935,7 @@ Defined in: [src/errors/base.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-
|
|
|
825
935
|
|
|
826
936
|
> **new HayleeAIError**(`message`): `HayleeAIError`
|
|
827
937
|
|
|
828
|
-
Defined in: [src/errors/base.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
938
|
+
Defined in: [src/errors/base.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/base.ts#L4)
|
|
829
939
|
|
|
830
940
|
#### Parameters
|
|
831
941
|
|
|
@@ -871,7 +981,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
871
981
|
|
|
872
982
|
> `readonly` **name**: `string` = `"HayleeAIError"`
|
|
873
983
|
|
|
874
|
-
Defined in: [src/errors/base.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
984
|
+
Defined in: [src/errors/base.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/base.ts#L2)
|
|
875
985
|
|
|
876
986
|
#### Overrides
|
|
877
987
|
|
|
@@ -1022,7 +1132,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1022
1132
|
|
|
1023
1133
|
# Class: LlmTokenContent
|
|
1024
1134
|
|
|
1025
|
-
Defined in: [src/messages/types.ts:
|
|
1135
|
+
Defined in: [src/messages/types.ts:28](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L28)
|
|
1026
1136
|
|
|
1027
1137
|
LLmTokenContent
|
|
1028
1138
|
|
|
@@ -1042,7 +1152,7 @@ LLmTokenContent
|
|
|
1042
1152
|
|
|
1043
1153
|
> **text**: `string`
|
|
1044
1154
|
|
|
1045
|
-
Defined in: [src/messages/types.ts:
|
|
1155
|
+
Defined in: [src/messages/types.ts:36](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L36)
|
|
1046
1156
|
|
|
1047
1157
|
***
|
|
1048
1158
|
|
|
@@ -1050,7 +1160,7 @@ Defined in: [src/messages/types.ts:35](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1050
1160
|
|
|
1051
1161
|
> **type**: `"text"`
|
|
1052
1162
|
|
|
1053
|
-
Defined in: [src/messages/types.ts:
|
|
1163
|
+
Defined in: [src/messages/types.ts:32](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L32)
|
|
1054
1164
|
|
|
1055
1165
|
|
|
1056
1166
|
<a name="classesllmtokeneventmd"></a>
|
|
@@ -1063,7 +1173,7 @@ Defined in: [src/messages/types.ts:31](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1063
1173
|
|
|
1064
1174
|
# Class: LlmTokenEvent
|
|
1065
1175
|
|
|
1066
|
-
Defined in: [src/messages/types.ts:
|
|
1176
|
+
Defined in: [src/messages/types.ts:39](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L39)
|
|
1067
1177
|
|
|
1068
1178
|
Base event for Streaming
|
|
1069
1179
|
BaseEvent
|
|
@@ -1092,7 +1202,7 @@ Base event for Streaming
|
|
|
1092
1202
|
|
|
1093
1203
|
> **content**: [`LlmTokenContent`](#classesllmtokencontentmd)[]
|
|
1094
1204
|
|
|
1095
|
-
Defined in: [src/messages/types.ts:
|
|
1205
|
+
Defined in: [src/messages/types.ts:43](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L43)
|
|
1096
1206
|
|
|
1097
1207
|
***
|
|
1098
1208
|
|
|
@@ -1100,7 +1210,7 @@ Defined in: [src/messages/types.ts:42](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1100
1210
|
|
|
1101
1211
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
1102
1212
|
|
|
1103
|
-
Defined in: [src/messages/types.ts:
|
|
1213
|
+
Defined in: [src/messages/types.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L17)
|
|
1104
1214
|
|
|
1105
1215
|
Used to separate streams
|
|
1106
1216
|
|
|
@@ -1114,7 +1224,7 @@ Used to separate streams
|
|
|
1114
1224
|
|
|
1115
1225
|
> **model**: `string`
|
|
1116
1226
|
|
|
1117
|
-
Defined in: [src/messages/types.ts:
|
|
1227
|
+
Defined in: [src/messages/types.ts:47](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L47)
|
|
1118
1228
|
|
|
1119
1229
|
***
|
|
1120
1230
|
|
|
@@ -1122,7 +1232,7 @@ Defined in: [src/messages/types.ts:46](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1122
1232
|
|
|
1123
1233
|
> **node**: `string`
|
|
1124
1234
|
|
|
1125
|
-
Defined in: [src/messages/types.ts:
|
|
1235
|
+
Defined in: [src/messages/types.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L21)
|
|
1126
1236
|
|
|
1127
1237
|
#### Inherited from
|
|
1128
1238
|
|
|
@@ -1139,7 +1249,7 @@ Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1139
1249
|
|
|
1140
1250
|
# Class: MessageService
|
|
1141
1251
|
|
|
1142
|
-
Defined in: [src/messages/message.service.ts:
|
|
1252
|
+
Defined in: [src/messages/message.service.ts:59](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L59)
|
|
1143
1253
|
|
|
1144
1254
|
## Constructors
|
|
1145
1255
|
|
|
@@ -1147,7 +1257,7 @@ Defined in: [src/messages/message.service.ts:49](https://github.com/vonuyvicoo/h
|
|
|
1147
1257
|
|
|
1148
1258
|
> **new MessageService**(`client`): `MessageService`
|
|
1149
1259
|
|
|
1150
|
-
Defined in: [src/messages/message.service.ts:
|
|
1260
|
+
Defined in: [src/messages/message.service.ts:61](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L61)
|
|
1151
1261
|
|
|
1152
1262
|
#### Parameters
|
|
1153
1263
|
|
|
@@ -1165,7 +1275,7 @@ Defined in: [src/messages/message.service.ts:51](https://github.com/vonuyvicoo/h
|
|
|
1165
1275
|
|
|
1166
1276
|
> **stream**(`payload`, `options?`): `Promise`\<`void`\>
|
|
1167
1277
|
|
|
1168
|
-
Defined in: [src/messages/message.service.ts:
|
|
1278
|
+
Defined in: [src/messages/message.service.ts:67](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L67)
|
|
1169
1279
|
|
|
1170
1280
|
#### Parameters
|
|
1171
1281
|
|
|
@@ -1196,7 +1306,7 @@ Config for streaming
|
|
|
1196
1306
|
|
|
1197
1307
|
# Class: NotFoundError
|
|
1198
1308
|
|
|
1199
|
-
Defined in: [src/errors/not-found.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1309
|
+
Defined in: [src/errors/not-found.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/not-found.error.ts#L3)
|
|
1200
1310
|
|
|
1201
1311
|
## Extends
|
|
1202
1312
|
|
|
@@ -1208,7 +1318,7 @@ Defined in: [src/errors/not-found.error.ts:3](https://github.com/vonuyvicoo/hayl
|
|
|
1208
1318
|
|
|
1209
1319
|
> **new NotFoundError**(`message`): `NotFoundError`
|
|
1210
1320
|
|
|
1211
|
-
Defined in: [src/errors/not-found.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1321
|
+
Defined in: [src/errors/not-found.error.ts:6](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/not-found.error.ts#L6)
|
|
1212
1322
|
|
|
1213
1323
|
#### Parameters
|
|
1214
1324
|
|
|
@@ -1254,7 +1364,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1254
1364
|
|
|
1255
1365
|
> `readonly` **name**: `string` = `"NotFoundError"`
|
|
1256
1366
|
|
|
1257
|
-
Defined in: [src/errors/not-found.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1367
|
+
Defined in: [src/errors/not-found.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/not-found.error.ts#L4)
|
|
1258
1368
|
|
|
1259
1369
|
#### Overrides
|
|
1260
1370
|
|
|
@@ -1405,7 +1515,7 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1405
1515
|
|
|
1406
1516
|
# Class: ValidationError
|
|
1407
1517
|
|
|
1408
|
-
Defined in: [src/errors/validation.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1518
|
+
Defined in: [src/errors/validation.error.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/validation.error.ts#L3)
|
|
1409
1519
|
|
|
1410
1520
|
## Extends
|
|
1411
1521
|
|
|
@@ -1417,7 +1527,7 @@ Defined in: [src/errors/validation.error.ts:3](https://github.com/vonuyvicoo/hay
|
|
|
1417
1527
|
|
|
1418
1528
|
> **new ValidationError**(`message`, `details?`): `ValidationError`
|
|
1419
1529
|
|
|
1420
|
-
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1530
|
+
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/validation.error.ts#L5)
|
|
1421
1531
|
|
|
1422
1532
|
#### Parameters
|
|
1423
1533
|
|
|
@@ -1455,7 +1565,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1455
1565
|
|
|
1456
1566
|
> `optional` **details**: `any`
|
|
1457
1567
|
|
|
1458
|
-
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1568
|
+
Defined in: [src/errors/validation.error.ts:5](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/validation.error.ts#L5)
|
|
1459
1569
|
|
|
1460
1570
|
***
|
|
1461
1571
|
|
|
@@ -1475,7 +1585,7 @@ Defined in: node\_modules/.pnpm/typescript@5.9.3/node\_modules/typescript/lib/li
|
|
|
1475
1585
|
|
|
1476
1586
|
> `readonly` **name**: `string` = `"ValidationError"`
|
|
1477
1587
|
|
|
1478
|
-
Defined in: [src/errors/validation.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1588
|
+
Defined in: [src/errors/validation.error.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/errors/validation.error.ts#L4)
|
|
1479
1589
|
|
|
1480
1590
|
#### Overrides
|
|
1481
1591
|
|
|
@@ -1626,15 +1736,23 @@ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
|
1626
1736
|
|
|
1627
1737
|
# Enumeration: EventKind
|
|
1628
1738
|
|
|
1629
|
-
Defined in: [src/messages/types.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1739
|
+
Defined in: [src/messages/types.ts:1](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L1)
|
|
1630
1740
|
|
|
1631
1741
|
## Enumeration Members
|
|
1632
1742
|
|
|
1743
|
+
### CONVERSATION\_INFO
|
|
1744
|
+
|
|
1745
|
+
> **CONVERSATION\_INFO**: `"conversation_info"`
|
|
1746
|
+
|
|
1747
|
+
Defined in: [src/messages/types.ts:4](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L4)
|
|
1748
|
+
|
|
1749
|
+
***
|
|
1750
|
+
|
|
1633
1751
|
### LLM\_TOKEN
|
|
1634
1752
|
|
|
1635
1753
|
> **LLM\_TOKEN**: `"llm_token"`
|
|
1636
1754
|
|
|
1637
|
-
Defined in: [src/messages/types.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1755
|
+
Defined in: [src/messages/types.ts:2](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L2)
|
|
1638
1756
|
|
|
1639
1757
|
***
|
|
1640
1758
|
|
|
@@ -1642,7 +1760,7 @@ Defined in: [src/messages/types.ts:2](https://github.com/vonuyvicoo/haylee-ai-ch
|
|
|
1642
1760
|
|
|
1643
1761
|
> **TOOLS**: `"tools"`
|
|
1644
1762
|
|
|
1645
|
-
Defined in: [src/messages/types.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1763
|
+
Defined in: [src/messages/types.ts:3](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L3)
|
|
1646
1764
|
|
|
1647
1765
|
|
|
1648
1766
|
<a name="enumerationsrolemd"></a>
|
|
@@ -1655,7 +1773,7 @@ Defined in: [src/messages/types.ts:3](https://github.com/vonuyvicoo/haylee-ai-ch
|
|
|
1655
1773
|
|
|
1656
1774
|
# Enumeration: Role
|
|
1657
1775
|
|
|
1658
|
-
Defined in: [src/types/chat.interface.ts:19](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1776
|
+
Defined in: [src/types/chat.interface.ts:19](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L19)
|
|
1659
1777
|
|
|
1660
1778
|
## Enumeration Members
|
|
1661
1779
|
|
|
@@ -1663,7 +1781,7 @@ Defined in: [src/types/chat.interface.ts:19](https://github.com/vonuyvicoo/hayle
|
|
|
1663
1781
|
|
|
1664
1782
|
> **AI**: `"ai"`
|
|
1665
1783
|
|
|
1666
|
-
Defined in: [src/types/chat.interface.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1784
|
+
Defined in: [src/types/chat.interface.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L21)
|
|
1667
1785
|
|
|
1668
1786
|
***
|
|
1669
1787
|
|
|
@@ -1671,7 +1789,7 @@ Defined in: [src/types/chat.interface.ts:21](https://github.com/vonuyvicoo/hayle
|
|
|
1671
1789
|
|
|
1672
1790
|
> **HUMAN**: `"human"`
|
|
1673
1791
|
|
|
1674
|
-
Defined in: [src/types/chat.interface.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1792
|
+
Defined in: [src/types/chat.interface.ts:20](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/types/chat.interface.ts#L20)
|
|
1675
1793
|
|
|
1676
1794
|
|
|
1677
1795
|
<a name="enumerationstoolstatusmd"></a>
|
|
@@ -1684,7 +1802,7 @@ Defined in: [src/types/chat.interface.ts:20](https://github.com/vonuyvicoo/hayle
|
|
|
1684
1802
|
|
|
1685
1803
|
# Enumeration: ToolStatus
|
|
1686
1804
|
|
|
1687
|
-
Defined in: [src/messages/types.ts:
|
|
1805
|
+
Defined in: [src/messages/types.ts:75](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L75)
|
|
1688
1806
|
|
|
1689
1807
|
## Enumeration Members
|
|
1690
1808
|
|
|
@@ -1692,7 +1810,7 @@ Defined in: [src/messages/types.ts:62](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1692
1810
|
|
|
1693
1811
|
> **END**: `"END"`
|
|
1694
1812
|
|
|
1695
|
-
Defined in: [src/messages/types.ts:
|
|
1813
|
+
Defined in: [src/messages/types.ts:77](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L77)
|
|
1696
1814
|
|
|
1697
1815
|
***
|
|
1698
1816
|
|
|
@@ -1700,7 +1818,7 @@ Defined in: [src/messages/types.ts:64](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1700
1818
|
|
|
1701
1819
|
> **ERROR**: `"ERROR"`
|
|
1702
1820
|
|
|
1703
|
-
Defined in: [src/messages/types.ts:
|
|
1821
|
+
Defined in: [src/messages/types.ts:78](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L78)
|
|
1704
1822
|
|
|
1705
1823
|
***
|
|
1706
1824
|
|
|
@@ -1708,7 +1826,7 @@ Defined in: [src/messages/types.ts:65](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1708
1826
|
|
|
1709
1827
|
> **START**: `"START"`
|
|
1710
1828
|
|
|
1711
|
-
Defined in: [src/messages/types.ts:
|
|
1829
|
+
Defined in: [src/messages/types.ts:76](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L76)
|
|
1712
1830
|
|
|
1713
1831
|
|
|
1714
1832
|
<a name="interfacesmessageserviceoptionsmd"></a>
|
|
@@ -1721,7 +1839,7 @@ Defined in: [src/messages/types.ts:63](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1721
1839
|
|
|
1722
1840
|
# Interface: MessageServiceOptions
|
|
1723
1841
|
|
|
1724
|
-
Defined in: [src/messages/message.service.ts:12](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1842
|
+
Defined in: [src/messages/message.service.ts:12](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L12)
|
|
1725
1843
|
|
|
1726
1844
|
## Properties
|
|
1727
1845
|
|
|
@@ -1729,17 +1847,61 @@ Defined in: [src/messages/message.service.ts:12](https://github.com/vonuyvicoo/h
|
|
|
1729
1847
|
|
|
1730
1848
|
> `optional` **signal**: `AbortSignal`
|
|
1731
1849
|
|
|
1732
|
-
Defined in: [src/messages/message.service.ts:
|
|
1850
|
+
Defined in: [src/messages/message.service.ts:56](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L56)
|
|
1733
1851
|
|
|
1734
1852
|
AbortSignal for terminating the upstream stream
|
|
1735
1853
|
|
|
1736
1854
|
## Methods
|
|
1737
1855
|
|
|
1856
|
+
### onConversationCreated()?
|
|
1857
|
+
|
|
1858
|
+
> `optional` **onConversationCreated**(`ev`): `void`
|
|
1859
|
+
|
|
1860
|
+
Defined in: [src/messages/message.service.ts:42](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L42)
|
|
1861
|
+
|
|
1862
|
+
Streams on async conversation creation.
|
|
1863
|
+
|
|
1864
|
+
#### Parameters
|
|
1865
|
+
|
|
1866
|
+
##### ev
|
|
1867
|
+
|
|
1868
|
+
[`ConversationInfoEvent`](#classesconversationinfoeventmd)
|
|
1869
|
+
|
|
1870
|
+
ConversationInfoEvent
|
|
1871
|
+
|
|
1872
|
+
#### Returns
|
|
1873
|
+
|
|
1874
|
+
`void`
|
|
1875
|
+
|
|
1876
|
+
***
|
|
1877
|
+
|
|
1878
|
+
### onConversationFailed()?
|
|
1879
|
+
|
|
1880
|
+
> `optional` **onConversationFailed**(`ev`): `void`
|
|
1881
|
+
|
|
1882
|
+
Defined in: [src/messages/message.service.ts:47](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L47)
|
|
1883
|
+
|
|
1884
|
+
Streams on async conversation creation failure.
|
|
1885
|
+
|
|
1886
|
+
#### Parameters
|
|
1887
|
+
|
|
1888
|
+
##### ev
|
|
1889
|
+
|
|
1890
|
+
[`ConversationInfoEvent`](#classesconversationinfoeventmd)
|
|
1891
|
+
|
|
1892
|
+
ConversationInfoEvent
|
|
1893
|
+
|
|
1894
|
+
#### Returns
|
|
1895
|
+
|
|
1896
|
+
`void`
|
|
1897
|
+
|
|
1898
|
+
***
|
|
1899
|
+
|
|
1738
1900
|
### onEnd()?
|
|
1739
1901
|
|
|
1740
1902
|
> `optional` **onEnd**(`ev`): `void`
|
|
1741
1903
|
|
|
1742
|
-
Defined in: [src/messages/message.service.ts:22](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1904
|
+
Defined in: [src/messages/message.service.ts:22](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L22)
|
|
1743
1905
|
|
|
1744
1906
|
triggers upon stream end
|
|
1745
1907
|
|
|
@@ -1761,7 +1923,7 @@ EndEvent
|
|
|
1761
1923
|
|
|
1762
1924
|
> `optional` **onError**(`err`): `void`
|
|
1763
1925
|
|
|
1764
|
-
Defined in: [src/messages/message.service.ts:
|
|
1926
|
+
Defined in: [src/messages/message.service.ts:52](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L52)
|
|
1765
1927
|
|
|
1766
1928
|
Streams errors on runtime
|
|
1767
1929
|
|
|
@@ -1781,7 +1943,7 @@ Streams errors on runtime
|
|
|
1781
1943
|
|
|
1782
1944
|
> `optional` **onLlmToken**(`ev`): `void`
|
|
1783
1945
|
|
|
1784
|
-
Defined in: [src/messages/message.service.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1946
|
+
Defined in: [src/messages/message.service.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L17)
|
|
1785
1947
|
|
|
1786
1948
|
Streams llm tokens for output
|
|
1787
1949
|
|
|
@@ -1801,7 +1963,7 @@ Streams llm tokens for output
|
|
|
1801
1963
|
|
|
1802
1964
|
> `optional` **onToolEnd**(`ev`): `void`
|
|
1803
1965
|
|
|
1804
|
-
Defined in: [src/messages/message.service.ts:32](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1966
|
+
Defined in: [src/messages/message.service.ts:32](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L32)
|
|
1805
1967
|
|
|
1806
1968
|
Streams tool end updates
|
|
1807
1969
|
|
|
@@ -1823,7 +1985,7 @@ ToolEvent
|
|
|
1823
1985
|
|
|
1824
1986
|
> `optional` **onToolError**(`ev`): `void`
|
|
1825
1987
|
|
|
1826
|
-
Defined in: [src/messages/message.service.ts:37](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
1988
|
+
Defined in: [src/messages/message.service.ts:37](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L37)
|
|
1827
1989
|
|
|
1828
1990
|
Streams tool errors
|
|
1829
1991
|
|
|
@@ -1845,7 +2007,7 @@ ToolEvent
|
|
|
1845
2007
|
|
|
1846
2008
|
> `optional` **onToolStart**(`ev`): `void`
|
|
1847
2009
|
|
|
1848
|
-
Defined in: [src/messages/message.service.ts:27](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
2010
|
+
Defined in: [src/messages/message.service.ts:27](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/message.service.ts#L27)
|
|
1849
2011
|
|
|
1850
2012
|
Streams tool start updates
|
|
1851
2013
|
|
|
@@ -1872,7 +2034,7 @@ ToolEvent
|
|
|
1872
2034
|
|
|
1873
2035
|
# Interface: ToolContent
|
|
1874
2036
|
|
|
1875
|
-
Defined in: [src/messages/types.ts:
|
|
2037
|
+
Defined in: [src/messages/types.ts:81](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L81)
|
|
1876
2038
|
|
|
1877
2039
|
## Properties
|
|
1878
2040
|
|
|
@@ -1880,7 +2042,7 @@ Defined in: [src/messages/types.ts:68](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1880
2042
|
|
|
1881
2043
|
> **params**: `unknown`
|
|
1882
2044
|
|
|
1883
|
-
Defined in: [src/messages/types.ts:
|
|
2045
|
+
Defined in: [src/messages/types.ts:82](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L82)
|
|
1884
2046
|
|
|
1885
2047
|
|
|
1886
2048
|
<a name="interfacestooleventmd"></a>
|
|
@@ -1893,7 +2055,7 @@ Defined in: [src/messages/types.ts:69](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1893
2055
|
|
|
1894
2056
|
# Interface: ToolEvent
|
|
1895
2057
|
|
|
1896
|
-
Defined in: [src/messages/types.ts:
|
|
2058
|
+
Defined in: [src/messages/types.ts:66](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L66)
|
|
1897
2059
|
|
|
1898
2060
|
Base event for Streaming
|
|
1899
2061
|
BaseEvent
|
|
@@ -1908,7 +2070,7 @@ Base event for Streaming
|
|
|
1908
2070
|
|
|
1909
2071
|
> `optional` **content**: [`ToolContent`](#interfacestoolcontentmd)
|
|
1910
2072
|
|
|
1911
|
-
Defined in: [src/messages/types.ts:
|
|
2073
|
+
Defined in: [src/messages/types.ts:67](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L67)
|
|
1912
2074
|
|
|
1913
2075
|
***
|
|
1914
2076
|
|
|
@@ -1916,7 +2078,7 @@ Defined in: [src/messages/types.ts:54](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1916
2078
|
|
|
1917
2079
|
> `optional` **error**: `unknown`
|
|
1918
2080
|
|
|
1919
|
-
Defined in: [src/messages/types.ts:
|
|
2081
|
+
Defined in: [src/messages/types.ts:72](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L72)
|
|
1920
2082
|
|
|
1921
2083
|
***
|
|
1922
2084
|
|
|
@@ -1924,7 +2086,7 @@ Defined in: [src/messages/types.ts:59](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1924
2086
|
|
|
1925
2087
|
> **kind**: [`EventKind`](#enumerationseventkindmd)
|
|
1926
2088
|
|
|
1927
|
-
Defined in: [src/messages/types.ts:
|
|
2089
|
+
Defined in: [src/messages/types.ts:17](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L17)
|
|
1928
2090
|
|
|
1929
2091
|
Used to separate streams
|
|
1930
2092
|
|
|
@@ -1938,7 +2100,7 @@ Used to separate streams
|
|
|
1938
2100
|
|
|
1939
2101
|
> **name**: `string`
|
|
1940
2102
|
|
|
1941
|
-
Defined in: [src/messages/types.ts:
|
|
2103
|
+
Defined in: [src/messages/types.ts:68](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L68)
|
|
1942
2104
|
|
|
1943
2105
|
***
|
|
1944
2106
|
|
|
@@ -1946,7 +2108,7 @@ Defined in: [src/messages/types.ts:55](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1946
2108
|
|
|
1947
2109
|
> **node**: `string`
|
|
1948
2110
|
|
|
1949
|
-
Defined in: [src/messages/types.ts:
|
|
2111
|
+
Defined in: [src/messages/types.ts:21](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L21)
|
|
1950
2112
|
|
|
1951
2113
|
#### Inherited from
|
|
1952
2114
|
|
|
@@ -1958,7 +2120,7 @@ Defined in: [src/messages/types.ts:20](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1958
2120
|
|
|
1959
2121
|
> **results**: [`ToolResultContent`](#interfacestoolresultcontentmd)[]
|
|
1960
2122
|
|
|
1961
|
-
Defined in: [src/messages/types.ts:
|
|
2123
|
+
Defined in: [src/messages/types.ts:71](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L71)
|
|
1962
2124
|
|
|
1963
2125
|
***
|
|
1964
2126
|
|
|
@@ -1966,7 +2128,7 @@ Defined in: [src/messages/types.ts:58](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1966
2128
|
|
|
1967
2129
|
> **status**: [`ToolStatus`](#enumerationstoolstatusmd)
|
|
1968
2130
|
|
|
1969
|
-
Defined in: [src/messages/types.ts:
|
|
2131
|
+
Defined in: [src/messages/types.ts:70](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L70)
|
|
1970
2132
|
|
|
1971
2133
|
***
|
|
1972
2134
|
|
|
@@ -1974,7 +2136,7 @@ Defined in: [src/messages/types.ts:57](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1974
2136
|
|
|
1975
2137
|
> `optional` **tool\_call\_id**: `string`
|
|
1976
2138
|
|
|
1977
|
-
Defined in: [src/messages/types.ts:
|
|
2139
|
+
Defined in: [src/messages/types.ts:69](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L69)
|
|
1978
2140
|
|
|
1979
2141
|
|
|
1980
2142
|
<a name="interfacestoolresultcontentmd"></a>
|
|
@@ -1987,7 +2149,7 @@ Defined in: [src/messages/types.ts:56](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1987
2149
|
|
|
1988
2150
|
# Interface: ToolResultContent
|
|
1989
2151
|
|
|
1990
|
-
Defined in: [src/messages/types.ts:
|
|
2152
|
+
Defined in: [src/messages/types.ts:85](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L85)
|
|
1991
2153
|
|
|
1992
2154
|
## Properties
|
|
1993
2155
|
|
|
@@ -1995,7 +2157,7 @@ Defined in: [src/messages/types.ts:72](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
1995
2157
|
|
|
1996
2158
|
> **content**: `any`
|
|
1997
2159
|
|
|
1998
|
-
Defined in: [src/messages/types.ts:
|
|
2160
|
+
Defined in: [src/messages/types.ts:89](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L89)
|
|
1999
2161
|
|
|
2000
2162
|
***
|
|
2001
2163
|
|
|
@@ -2003,7 +2165,7 @@ Defined in: [src/messages/types.ts:76](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
2003
2165
|
|
|
2004
2166
|
> **type**: `string`
|
|
2005
2167
|
|
|
2006
|
-
Defined in: [src/messages/types.ts:
|
|
2168
|
+
Defined in: [src/messages/types.ts:87](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/messages/types.ts#L87)
|
|
2007
2169
|
|
|
2008
2170
|
|
|
2009
2171
|
<a name="type-aliaseshayleeaichatclientoptionsmd"></a>
|
|
@@ -2018,7 +2180,7 @@ Defined in: [src/messages/types.ts:74](https://github.com/vonuyvicoo/haylee-ai-c
|
|
|
2018
2180
|
|
|
2019
2181
|
> **HayleeAIChatClientOptions** = `object`
|
|
2020
2182
|
|
|
2021
|
-
Defined in: [src/\_internal/client.ts:9](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
2183
|
+
Defined in: [src/\_internal/client.ts:9](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L9)
|
|
2022
2184
|
|
|
2023
2185
|
Options for the HayleeAI Client
|
|
2024
2186
|
|
|
@@ -2028,6 +2190,6 @@ Options for the HayleeAI Client
|
|
|
2028
2190
|
|
|
2029
2191
|
> `optional` **baseUrl**: `string`
|
|
2030
2192
|
|
|
2031
|
-
Defined in: [src/\_internal/client.ts:10](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/
|
|
2193
|
+
Defined in: [src/\_internal/client.ts:10](https://github.com/vonuyvicoo/haylee-ai-chat-sdk/blob/c0216910da9baf442beee97ca4723f68828ab4d6/src/_internal/client.ts#L10)
|
|
2032
2194
|
|
|
2033
2195
|
Optional base URL, defaults to production
|
package/dist/index.cjs
CHANGED
|
@@ -31,6 +31,8 @@ __export(index_exports, {
|
|
|
31
31
|
AuthenticationError: () => AuthenticationError,
|
|
32
32
|
AuthorizationError: () => AuthorizationError,
|
|
33
33
|
BaseEvent: () => BaseEvent,
|
|
34
|
+
ConversationInfoContent: () => ConversationInfoContent,
|
|
35
|
+
ConversationInfoEvent: () => ConversationInfoEvent,
|
|
34
36
|
CreateMessageDto: () => CreateMessageDto,
|
|
35
37
|
EndEvent: () => EndEvent,
|
|
36
38
|
EventKind: () => EventKind,
|
|
@@ -115,6 +117,7 @@ var HayleeAIClient = class {
|
|
|
115
117
|
var EventKind = /* @__PURE__ */ ((EventKind2) => {
|
|
116
118
|
EventKind2["LLM_TOKEN"] = "llm_token";
|
|
117
119
|
EventKind2["TOOLS"] = "tools";
|
|
120
|
+
EventKind2["CONVERSATION_INFO"] = "conversation_info";
|
|
118
121
|
return EventKind2;
|
|
119
122
|
})(EventKind || {});
|
|
120
123
|
var BaseEvent = class {
|
|
@@ -147,6 +150,13 @@ var LlmTokenEvent = class extends BaseEvent {
|
|
|
147
150
|
*/
|
|
148
151
|
model;
|
|
149
152
|
};
|
|
153
|
+
var ConversationInfoEvent = class extends BaseEvent {
|
|
154
|
+
content;
|
|
155
|
+
};
|
|
156
|
+
var ConversationInfoContent = class {
|
|
157
|
+
type;
|
|
158
|
+
subject;
|
|
159
|
+
};
|
|
150
160
|
var EndEvent = class {
|
|
151
161
|
success;
|
|
152
162
|
};
|
|
@@ -215,6 +225,15 @@ var MessageService = class {
|
|
|
215
225
|
}
|
|
216
226
|
break;
|
|
217
227
|
}
|
|
228
|
+
case "conversation_info" /* CONVERSATION_INFO */: {
|
|
229
|
+
const typedEvent = event;
|
|
230
|
+
if (typedEvent.content.type === "created") {
|
|
231
|
+
options?.onConversationCreated?.(typedEvent);
|
|
232
|
+
} else if (typedEvent.content.type === "error") {
|
|
233
|
+
options?.onConversationFailed?.(typedEvent);
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
218
237
|
}
|
|
219
238
|
} catch (err) {
|
|
220
239
|
options?.onEnd?.({ success: false });
|
|
@@ -297,6 +316,8 @@ var HayleeAI = class extends HayleeAIClient {
|
|
|
297
316
|
AuthenticationError,
|
|
298
317
|
AuthorizationError,
|
|
299
318
|
BaseEvent,
|
|
319
|
+
ConversationInfoContent,
|
|
320
|
+
ConversationInfoEvent,
|
|
300
321
|
CreateMessageDto,
|
|
301
322
|
EndEvent,
|
|
302
323
|
EventKind,
|
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 { 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;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;AAC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AN,MAAM,yBAAwB,cAAc;AAAA,EAE/C,YAAY,SAAwB,SAAc;AAC9C,UAAM,OAAO;AADmB;AAEhC,WAAO,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,6BAAqC;AAO9B,IAAM,mBAAN,MAAuB;AAAA,EAG1B;AAAA,EAEA;AACJ;AAHI;AAAA,MADC,iCAAS;AAAA,GAFD,iBAGT;AAEA;AAAA,MADC,mCAAW;AAAA,GAJH,iBAKT;AAMG,IAAK,OAAL,kBAAKC,UAAL;AACH,EAAAA,MAAA,WAAQ;AACR,EAAAA,MAAA,QAAK;AAFG,SAAAA;AAAA,GAAA;;;AXZZ,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 CONVERSATION_INFO = \"conversation_info\"\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\n\nexport class ConversationInfoEvent extends BaseEvent {\n content!: ConversationInfoContent;\n}\n\nexport class ConversationInfoContent {\n type!: \"created\" | \"updated\" | \"deleted\" | \"error\";\n subject!: string;\n}\n\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, ConversationInfoEvent, 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 on async conversation creation.\n * @param ev - ConversationInfoEvent\n */\n onConversationCreated?(ev: ConversationInfoEvent): void;\n /**\n * Streams on async conversation creation failure.\n * @param ev - ConversationInfoEvent\n */\n onConversationFailed?(ev: ConversationInfoEvent): 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 case EventKind.CONVERSATION_INFO: {\n const typedEvent = event as ConversationInfoEvent;\n if(typedEvent.content.type === 'created') {\n options?.onConversationCreated?.(typedEvent);\n } else if(typedEvent.content.type === 'error') {\n options?.onConversationFailed?.(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;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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"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -44,7 +44,8 @@ declare class HayleeAIClient {
|
|
|
44
44
|
|
|
45
45
|
declare enum EventKind {
|
|
46
46
|
LLM_TOKEN = "llm_token",
|
|
47
|
-
TOOLS = "tools"
|
|
47
|
+
TOOLS = "tools",
|
|
48
|
+
CONVERSATION_INFO = "conversation_info"
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
51
|
* Base event for Streaming
|
|
@@ -82,6 +83,13 @@ declare class LlmTokenEvent extends BaseEvent {
|
|
|
82
83
|
*/
|
|
83
84
|
model: string;
|
|
84
85
|
}
|
|
86
|
+
declare class ConversationInfoEvent extends BaseEvent {
|
|
87
|
+
content: ConversationInfoContent;
|
|
88
|
+
}
|
|
89
|
+
declare class ConversationInfoContent {
|
|
90
|
+
type: "created" | "updated" | "deleted" | "error";
|
|
91
|
+
subject: string;
|
|
92
|
+
}
|
|
85
93
|
declare class EndEvent {
|
|
86
94
|
success: boolean;
|
|
87
95
|
}
|
|
@@ -138,6 +146,16 @@ interface MessageServiceOptions {
|
|
|
138
146
|
* @param ev - ToolEvent
|
|
139
147
|
*/
|
|
140
148
|
onToolError?(ev: ToolEvent): void;
|
|
149
|
+
/**
|
|
150
|
+
* Streams on async conversation creation.
|
|
151
|
+
* @param ev - ConversationInfoEvent
|
|
152
|
+
*/
|
|
153
|
+
onConversationCreated?(ev: ConversationInfoEvent): void;
|
|
154
|
+
/**
|
|
155
|
+
* Streams on async conversation creation failure.
|
|
156
|
+
* @param ev - ConversationInfoEvent
|
|
157
|
+
*/
|
|
158
|
+
onConversationFailed?(ev: ConversationInfoEvent): void;
|
|
141
159
|
/**
|
|
142
160
|
* Streams errors on runtime
|
|
143
161
|
* @param err - Error or unknown value
|
|
@@ -195,4 +213,4 @@ declare class HayleeAI extends HayleeAIClient {
|
|
|
195
213
|
constructor(options: HayleeAIChatClientOptions);
|
|
196
214
|
}
|
|
197
215
|
|
|
198
|
-
export { AuthenticationError, AuthorizationError, BaseEvent, CreateMessageDto, EndEvent, EventKind, HayleeAI, type HayleeAIChatClientOptions, HayleeAIClient, HayleeAIError, LlmTokenContent, LlmTokenEvent, MessageService, type MessageServiceOptions, NotFoundError, Role, type ToolContent, type ToolEvent, type ToolResultContent, ToolStatus, ValidationError };
|
|
216
|
+
export { AuthenticationError, AuthorizationError, BaseEvent, ConversationInfoContent, ConversationInfoEvent, CreateMessageDto, EndEvent, EventKind, HayleeAI, type HayleeAIChatClientOptions, HayleeAIClient, HayleeAIError, LlmTokenContent, LlmTokenEvent, MessageService, type MessageServiceOptions, NotFoundError, Role, type ToolContent, type ToolEvent, type ToolResultContent, ToolStatus, ValidationError };
|
package/dist/index.d.ts
CHANGED
|
@@ -44,7 +44,8 @@ declare class HayleeAIClient {
|
|
|
44
44
|
|
|
45
45
|
declare enum EventKind {
|
|
46
46
|
LLM_TOKEN = "llm_token",
|
|
47
|
-
TOOLS = "tools"
|
|
47
|
+
TOOLS = "tools",
|
|
48
|
+
CONVERSATION_INFO = "conversation_info"
|
|
48
49
|
}
|
|
49
50
|
/**
|
|
50
51
|
* Base event for Streaming
|
|
@@ -82,6 +83,13 @@ declare class LlmTokenEvent extends BaseEvent {
|
|
|
82
83
|
*/
|
|
83
84
|
model: string;
|
|
84
85
|
}
|
|
86
|
+
declare class ConversationInfoEvent extends BaseEvent {
|
|
87
|
+
content: ConversationInfoContent;
|
|
88
|
+
}
|
|
89
|
+
declare class ConversationInfoContent {
|
|
90
|
+
type: "created" | "updated" | "deleted" | "error";
|
|
91
|
+
subject: string;
|
|
92
|
+
}
|
|
85
93
|
declare class EndEvent {
|
|
86
94
|
success: boolean;
|
|
87
95
|
}
|
|
@@ -138,6 +146,16 @@ interface MessageServiceOptions {
|
|
|
138
146
|
* @param ev - ToolEvent
|
|
139
147
|
*/
|
|
140
148
|
onToolError?(ev: ToolEvent): void;
|
|
149
|
+
/**
|
|
150
|
+
* Streams on async conversation creation.
|
|
151
|
+
* @param ev - ConversationInfoEvent
|
|
152
|
+
*/
|
|
153
|
+
onConversationCreated?(ev: ConversationInfoEvent): void;
|
|
154
|
+
/**
|
|
155
|
+
* Streams on async conversation creation failure.
|
|
156
|
+
* @param ev - ConversationInfoEvent
|
|
157
|
+
*/
|
|
158
|
+
onConversationFailed?(ev: ConversationInfoEvent): void;
|
|
141
159
|
/**
|
|
142
160
|
* Streams errors on runtime
|
|
143
161
|
* @param err - Error or unknown value
|
|
@@ -195,4 +213,4 @@ declare class HayleeAI extends HayleeAIClient {
|
|
|
195
213
|
constructor(options: HayleeAIChatClientOptions);
|
|
196
214
|
}
|
|
197
215
|
|
|
198
|
-
export { AuthenticationError, AuthorizationError, BaseEvent, CreateMessageDto, EndEvent, EventKind, HayleeAI, type HayleeAIChatClientOptions, HayleeAIClient, HayleeAIError, LlmTokenContent, LlmTokenEvent, MessageService, type MessageServiceOptions, NotFoundError, Role, type ToolContent, type ToolEvent, type ToolResultContent, ToolStatus, ValidationError };
|
|
216
|
+
export { AuthenticationError, AuthorizationError, BaseEvent, ConversationInfoContent, ConversationInfoEvent, CreateMessageDto, EndEvent, EventKind, HayleeAI, type HayleeAIChatClientOptions, HayleeAIClient, HayleeAIError, LlmTokenContent, LlmTokenEvent, MessageService, type MessageServiceOptions, NotFoundError, Role, type ToolContent, type ToolEvent, type ToolResultContent, ToolStatus, ValidationError };
|
package/dist/index.js
CHANGED
|
@@ -77,6 +77,7 @@ var HayleeAIClient = class {
|
|
|
77
77
|
var EventKind = /* @__PURE__ */ ((EventKind2) => {
|
|
78
78
|
EventKind2["LLM_TOKEN"] = "llm_token";
|
|
79
79
|
EventKind2["TOOLS"] = "tools";
|
|
80
|
+
EventKind2["CONVERSATION_INFO"] = "conversation_info";
|
|
80
81
|
return EventKind2;
|
|
81
82
|
})(EventKind || {});
|
|
82
83
|
var BaseEvent = class {
|
|
@@ -109,6 +110,13 @@ var LlmTokenEvent = class extends BaseEvent {
|
|
|
109
110
|
*/
|
|
110
111
|
model;
|
|
111
112
|
};
|
|
113
|
+
var ConversationInfoEvent = class extends BaseEvent {
|
|
114
|
+
content;
|
|
115
|
+
};
|
|
116
|
+
var ConversationInfoContent = class {
|
|
117
|
+
type;
|
|
118
|
+
subject;
|
|
119
|
+
};
|
|
112
120
|
var EndEvent = class {
|
|
113
121
|
success;
|
|
114
122
|
};
|
|
@@ -177,6 +185,15 @@ var MessageService = class {
|
|
|
177
185
|
}
|
|
178
186
|
break;
|
|
179
187
|
}
|
|
188
|
+
case "conversation_info" /* CONVERSATION_INFO */: {
|
|
189
|
+
const typedEvent = event;
|
|
190
|
+
if (typedEvent.content.type === "created") {
|
|
191
|
+
options?.onConversationCreated?.(typedEvent);
|
|
192
|
+
} else if (typedEvent.content.type === "error") {
|
|
193
|
+
options?.onConversationFailed?.(typedEvent);
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
180
197
|
}
|
|
181
198
|
} catch (err) {
|
|
182
199
|
options?.onEnd?.({ success: false });
|
|
@@ -258,6 +275,8 @@ export {
|
|
|
258
275
|
AuthenticationError,
|
|
259
276
|
AuthorizationError,
|
|
260
277
|
BaseEvent,
|
|
278
|
+
ConversationInfoContent,
|
|
279
|
+
ConversationInfoEvent,
|
|
261
280
|
CreateMessageDto,
|
|
262
281
|
EndEvent,
|
|
263
282
|
EventKind,
|
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 { 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,UAA+B;AACnC,QAAI,OAAO;AAEX,qBAAiB,GAAG,KAAK,OAAO,IAAI;AAAA,MAChC,SAAS;AAAA,QACL,gBAAgB;AAAA,M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}
|
|
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 CONVERSATION_INFO = \"conversation_info\"\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\n\nexport class ConversationInfoEvent extends BaseEvent {\n content!: ConversationInfoContent;\n}\n\nexport class ConversationInfoContent {\n type!: \"created\" | \"updated\" | \"deleted\" | \"error\";\n subject!: string;\n}\n\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, ConversationInfoEvent, 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 on async conversation creation.\n * @param ev - ConversationInfoEvent\n */\n onConversationCreated?(ev: ConversationInfoEvent): void;\n /**\n * Streams on async conversation creation failure.\n * @param ev - ConversationInfoEvent\n */\n onConversationFailed?(ev: ConversationInfoEvent): 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 case EventKind.CONVERSATION_INFO: {\n const typedEvent = event as ConversationInfoEvent;\n if(typedEvent.content.type === 'created') {\n options?.onConversationCreated?.(typedEvent);\n } else if(typedEvent.content.type === 'error') {\n options?.onConversationFailed?.(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,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,aAA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