@microsoft/teams.ai 0.2.7

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.
Files changed (116) hide show
  1. package/README.md +35 -0
  2. package/dist/citation.d.mts +19 -0
  3. package/dist/citation.d.ts +19 -0
  4. package/dist/citation.js +4 -0
  5. package/dist/citation.js.map +1 -0
  6. package/dist/citation.mjs +3 -0
  7. package/dist/citation.mjs.map +1 -0
  8. package/dist/function.d.mts +18 -0
  9. package/dist/function.d.ts +18 -0
  10. package/dist/function.js +4 -0
  11. package/dist/function.js.map +1 -0
  12. package/dist/function.mjs +3 -0
  13. package/dist/function.mjs.map +1 -0
  14. package/dist/index.d.mts +17 -0
  15. package/dist/index.d.ts +17 -0
  16. package/dist/index.js +77 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/index.mjs +12 -0
  19. package/dist/index.mjs.map +1 -0
  20. package/dist/local-memory.d.mts +32 -0
  21. package/dist/local-memory.d.ts +32 -0
  22. package/dist/local-memory.js +78 -0
  23. package/dist/local-memory.js.map +1 -0
  24. package/dist/local-memory.mjs +76 -0
  25. package/dist/local-memory.mjs.map +1 -0
  26. package/dist/memory.d.mts +11 -0
  27. package/dist/memory.d.ts +11 -0
  28. package/dist/memory.js +4 -0
  29. package/dist/memory.js.map +1 -0
  30. package/dist/memory.mjs +3 -0
  31. package/dist/memory.mjs.map +1 -0
  32. package/dist/message.d.mts +76 -0
  33. package/dist/message.d.ts +76 -0
  34. package/dist/message.js +4 -0
  35. package/dist/message.js.map +1 -0
  36. package/dist/message.mjs +3 -0
  37. package/dist/message.mjs.map +1 -0
  38. package/dist/models/audio.d.mts +27 -0
  39. package/dist/models/audio.d.ts +27 -0
  40. package/dist/models/audio.js +4 -0
  41. package/dist/models/audio.js.map +1 -0
  42. package/dist/models/audio.mjs +3 -0
  43. package/dist/models/audio.mjs.map +1 -0
  44. package/dist/models/chat.d.mts +46 -0
  45. package/dist/models/chat.d.ts +46 -0
  46. package/dist/models/chat.js +4 -0
  47. package/dist/models/chat.js.map +1 -0
  48. package/dist/models/chat.mjs +3 -0
  49. package/dist/models/chat.mjs.map +1 -0
  50. package/dist/models/image.d.mts +22 -0
  51. package/dist/models/image.d.ts +22 -0
  52. package/dist/models/image.js +4 -0
  53. package/dist/models/image.js.map +1 -0
  54. package/dist/models/image.mjs +3 -0
  55. package/dist/models/image.mjs.map +1 -0
  56. package/dist/models/index.d.mts +16 -0
  57. package/dist/models/index.d.ts +16 -0
  58. package/dist/models/index.js +28 -0
  59. package/dist/models/index.js.map +1 -0
  60. package/dist/models/index.mjs +5 -0
  61. package/dist/models/index.mjs.map +1 -0
  62. package/dist/prompts/audio.d.mts +54 -0
  63. package/dist/prompts/audio.d.ts +54 -0
  64. package/dist/prompts/audio.js +34 -0
  65. package/dist/prompts/audio.js.map +1 -0
  66. package/dist/prompts/audio.mjs +32 -0
  67. package/dist/prompts/audio.mjs.map +1 -0
  68. package/dist/prompts/chat.d.mts +146 -0
  69. package/dist/prompts/chat.d.ts +146 -0
  70. package/dist/prompts/chat.js +162 -0
  71. package/dist/prompts/chat.js.map +1 -0
  72. package/dist/prompts/chat.mjs +160 -0
  73. package/dist/prompts/chat.mjs.map +1 -0
  74. package/dist/prompts/index.d.mts +18 -0
  75. package/dist/prompts/index.d.ts +18 -0
  76. package/dist/prompts/index.js +21 -0
  77. package/dist/prompts/index.js.map +1 -0
  78. package/dist/prompts/index.mjs +4 -0
  79. package/dist/prompts/index.mjs.map +1 -0
  80. package/dist/prompts/plugin.d.mts +26 -0
  81. package/dist/prompts/plugin.d.ts +26 -0
  82. package/dist/prompts/plugin.js +4 -0
  83. package/dist/prompts/plugin.js.map +1 -0
  84. package/dist/prompts/plugin.mjs +3 -0
  85. package/dist/prompts/plugin.mjs.map +1 -0
  86. package/dist/schema.d.mts +46 -0
  87. package/dist/schema.d.ts +46 -0
  88. package/dist/schema.js +4 -0
  89. package/dist/schema.js.map +1 -0
  90. package/dist/schema.mjs +3 -0
  91. package/dist/schema.mjs.map +1 -0
  92. package/dist/template.d.mts +13 -0
  93. package/dist/template.d.ts +13 -0
  94. package/dist/template.js +4 -0
  95. package/dist/template.js.map +1 -0
  96. package/dist/template.mjs +3 -0
  97. package/dist/template.mjs.map +1 -0
  98. package/dist/templates/index.d.mts +2 -0
  99. package/dist/templates/index.d.ts +2 -0
  100. package/dist/templates/index.js +14 -0
  101. package/dist/templates/index.js.map +1 -0
  102. package/dist/templates/index.mjs +3 -0
  103. package/dist/templates/index.mjs.map +1 -0
  104. package/dist/templates/string.d.mts +9 -0
  105. package/dist/templates/string.d.ts +9 -0
  106. package/dist/templates/string.js +14 -0
  107. package/dist/templates/string.js.map +1 -0
  108. package/dist/templates/string.mjs +12 -0
  109. package/dist/templates/string.mjs.map +1 -0
  110. package/dist/utils/types.d.mts +5 -0
  111. package/dist/utils/types.d.ts +5 -0
  112. package/dist/utils/types.js +4 -0
  113. package/dist/utils/types.js.map +1 -0
  114. package/dist/utils/types.mjs +3 -0
  115. package/dist/utils/types.mjs.map +1 -0
  116. package/package.json +49 -0
@@ -0,0 +1,76 @@
1
+ import { Citation } from './citation.js';
2
+ import { FunctionCall } from './function.js';
3
+ import './schema.js';
4
+
5
+ type Message = UserMessage | ModelMessage | SystemMessage | FunctionMessage;
6
+ type UserMessage = {
7
+ role: 'user';
8
+ content: string | ContentPart[];
9
+ };
10
+ type ModelMessage = {
11
+ role: 'model';
12
+ audio?: MessageAudio;
13
+ content?: string;
14
+ context?: MessageContext;
15
+ function_calls?: FunctionCall[];
16
+ };
17
+ type SystemMessage = {
18
+ role: 'system';
19
+ content: string;
20
+ };
21
+ type FunctionMessage = {
22
+ role: 'function';
23
+ content?: string;
24
+ function_id: string;
25
+ };
26
+ type ContentPart = TextContentPart | ImageContentPart;
27
+ type TextContentPart = {
28
+ type: 'text';
29
+ text: string;
30
+ };
31
+ type ImageContentPart = {
32
+ type: 'image_url';
33
+ image_url: string;
34
+ };
35
+ /**
36
+ * A representation of the additional context information available when Azure OpenAI chat extensions are involved
37
+ * in the generation of a corresponding chat completions response. This context information is only populated when
38
+ * using an Azure OpenAI request configured to use a matching extension.
39
+ */
40
+ type MessageContext = {
41
+ /**
42
+ * The contextual information associated with the Azure chat extensions used for a chat completions request.
43
+ * These messages describe the data source retrievals, plugin invocations, and other intermediate steps taken in the
44
+ * course of generating a chat completions response that was augmented by capabilities from Azure OpenAI chat
45
+ * extensions.
46
+ */
47
+ citations?: Array<Citation>;
48
+ /** The detected intent from the chat history, used to pass to the next turn to carry over the context. */
49
+ intent?: string;
50
+ };
51
+ /**
52
+ * If the audio output modality is requested, this object contains data about the
53
+ * audio response from the model.
54
+ */
55
+ type MessageAudio = {
56
+ /**
57
+ * Unique identifier for this audio response.
58
+ */
59
+ id: string;
60
+ /**
61
+ * Base64 encoded audio bytes generated by the model, in the format specified in
62
+ * the request.
63
+ */
64
+ data: string;
65
+ /**
66
+ * The Unix timestamp (in seconds) for when this audio response will no longer be
67
+ * accessible on the server for use in multi-turn conversations.
68
+ */
69
+ expires_at: number;
70
+ /**
71
+ * Transcript of the audio generated by the model.
72
+ */
73
+ transcript: string;
74
+ };
75
+
76
+ export type { ContentPart, FunctionMessage, ImageContentPart, Message, MessageAudio, MessageContext, ModelMessage, SystemMessage, TextContentPart, UserMessage };
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=message.js.map
4
+ //# sourceMappingURL=message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"message.js"}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=message.mjs.map
3
+ //# sourceMappingURL=message.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"message.mjs"}
@@ -0,0 +1,27 @@
1
+ type TextToAudioParams = {
2
+ readonly type: string;
3
+ readonly text: string;
4
+ readonly voice: string;
5
+ };
6
+ type AudioToTextParams = {
7
+ readonly type: string;
8
+ readonly data: Buffer;
9
+ readonly prompt?: string;
10
+ readonly lang?: string;
11
+ };
12
+ /**
13
+ * a model that can convert text to audio
14
+ * or audio to text
15
+ */
16
+ interface IAudioModel {
17
+ /**
18
+ * convert text to audio
19
+ */
20
+ textToAudio?(params: TextToAudioParams): Promise<Buffer>;
21
+ /**
22
+ * transcribe audio to text
23
+ */
24
+ audioToText?(params: AudioToTextParams): Promise<string>;
25
+ }
26
+
27
+ export type { AudioToTextParams, IAudioModel, TextToAudioParams };
@@ -0,0 +1,27 @@
1
+ type TextToAudioParams = {
2
+ readonly type: string;
3
+ readonly text: string;
4
+ readonly voice: string;
5
+ };
6
+ type AudioToTextParams = {
7
+ readonly type: string;
8
+ readonly data: Buffer;
9
+ readonly prompt?: string;
10
+ readonly lang?: string;
11
+ };
12
+ /**
13
+ * a model that can convert text to audio
14
+ * or audio to text
15
+ */
16
+ interface IAudioModel {
17
+ /**
18
+ * convert text to audio
19
+ */
20
+ textToAudio?(params: TextToAudioParams): Promise<Buffer>;
21
+ /**
22
+ * transcribe audio to text
23
+ */
24
+ audioToText?(params: AudioToTextParams): Promise<string>;
25
+ }
26
+
27
+ export type { AudioToTextParams, IAudioModel, TextToAudioParams };
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=audio.js.map
4
+ //# sourceMappingURL=audio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"audio.js"}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=audio.mjs.map
3
+ //# sourceMappingURL=audio.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"audio.mjs"}
@@ -0,0 +1,46 @@
1
+ import { Function } from '../function.mjs';
2
+ import { IMemory } from '../memory.mjs';
3
+ import { Message, SystemMessage, UserMessage, ModelMessage } from '../message.mjs';
4
+ import '../schema.mjs';
5
+ import '@microsoft/teams.common';
6
+ import '../citation.mjs';
7
+
8
+ type TextChunkHandler = (chunk: string) => void | Promise<void>;
9
+ type ChatSendOptions<TOptions = Record<string, any>> = {
10
+ /**
11
+ * the initial system/user message that defines
12
+ * model behavior
13
+ */
14
+ readonly system?: SystemMessage | UserMessage;
15
+ /**
16
+ * the conversation history
17
+ */
18
+ readonly messages?: IMemory;
19
+ /**
20
+ * the registered functions
21
+ */
22
+ readonly functions?: Record<string, Function>;
23
+ /**
24
+ * the request option overrides
25
+ */
26
+ readonly request?: TOptions;
27
+ /**
28
+ * the handler to call with each
29
+ * stream chunk
30
+ */
31
+ readonly onChunk?: TextChunkHandler;
32
+ };
33
+ /**
34
+ * a conversational model for sending and receiving
35
+ * messages
36
+ */
37
+ interface IChatModel<TOptions = Record<string, any>> {
38
+ /**
39
+ * send a message to the model
40
+ * @param input the message to send
41
+ * @param options the send options
42
+ */
43
+ send(input: Message, options?: ChatSendOptions<TOptions>): Promise<ModelMessage>;
44
+ }
45
+
46
+ export type { ChatSendOptions, IChatModel, TextChunkHandler };
@@ -0,0 +1,46 @@
1
+ import { Function } from '../function.js';
2
+ import { IMemory } from '../memory.js';
3
+ import { Message, SystemMessage, UserMessage, ModelMessage } from '../message.js';
4
+ import '../schema.js';
5
+ import '@microsoft/teams.common';
6
+ import '../citation.js';
7
+
8
+ type TextChunkHandler = (chunk: string) => void | Promise<void>;
9
+ type ChatSendOptions<TOptions = Record<string, any>> = {
10
+ /**
11
+ * the initial system/user message that defines
12
+ * model behavior
13
+ */
14
+ readonly system?: SystemMessage | UserMessage;
15
+ /**
16
+ * the conversation history
17
+ */
18
+ readonly messages?: IMemory;
19
+ /**
20
+ * the registered functions
21
+ */
22
+ readonly functions?: Record<string, Function>;
23
+ /**
24
+ * the request option overrides
25
+ */
26
+ readonly request?: TOptions;
27
+ /**
28
+ * the handler to call with each
29
+ * stream chunk
30
+ */
31
+ readonly onChunk?: TextChunkHandler;
32
+ };
33
+ /**
34
+ * a conversational model for sending and receiving
35
+ * messages
36
+ */
37
+ interface IChatModel<TOptions = Record<string, any>> {
38
+ /**
39
+ * send a message to the model
40
+ * @param input the message to send
41
+ * @param options the send options
42
+ */
43
+ send(input: Message, options?: ChatSendOptions<TOptions>): Promise<ModelMessage>;
44
+ }
45
+
46
+ export type { ChatSendOptions, IChatModel, TextChunkHandler };
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=chat.js.map
4
+ //# sourceMappingURL=chat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chat.js"}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=chat.mjs.map
3
+ //# sourceMappingURL=chat.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"chat.mjs"}
@@ -0,0 +1,22 @@
1
+ type TextToImageParams = {
2
+ /**
3
+ * the prompt that defines how
4
+ * the image should be made
5
+ */
6
+ readonly prompt?: string;
7
+ /**
8
+ * the desired size of the image
9
+ */
10
+ readonly size?: string;
11
+ };
12
+ /**
13
+ * a model that can generate an image from text
14
+ */
15
+ interface IImageModel {
16
+ /**
17
+ * generate an image from text
18
+ */
19
+ textToImage?(params?: TextToImageParams): Promise<string>;
20
+ }
21
+
22
+ export type { IImageModel, TextToImageParams };
@@ -0,0 +1,22 @@
1
+ type TextToImageParams = {
2
+ /**
3
+ * the prompt that defines how
4
+ * the image should be made
5
+ */
6
+ readonly prompt?: string;
7
+ /**
8
+ * the desired size of the image
9
+ */
10
+ readonly size?: string;
11
+ };
12
+ /**
13
+ * a model that can generate an image from text
14
+ */
15
+ interface IImageModel {
16
+ /**
17
+ * generate an image from text
18
+ */
19
+ textToImage?(params?: TextToImageParams): Promise<string>;
20
+ }
21
+
22
+ export type { IImageModel, TextToImageParams };
@@ -0,0 +1,4 @@
1
+ 'use strict';
2
+
3
+ //# sourceMappingURL=image.js.map
4
+ //# sourceMappingURL=image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"image.js"}
@@ -0,0 +1,3 @@
1
+
2
+ //# sourceMappingURL=image.mjs.map
3
+ //# sourceMappingURL=image.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"image.mjs"}
@@ -0,0 +1,16 @@
1
+ import { IAudioModel } from './audio.mjs';
2
+ export { AudioToTextParams, TextToAudioParams } from './audio.mjs';
3
+ import { IImageModel } from './image.mjs';
4
+ export { TextToImageParams } from './image.mjs';
5
+ import { IChatModel } from './chat.mjs';
6
+ export { ChatSendOptions, TextChunkHandler } from './chat.mjs';
7
+ import '../function.mjs';
8
+ import '../schema.mjs';
9
+ import '../memory.mjs';
10
+ import '@microsoft/teams.common';
11
+ import '../message.mjs';
12
+ import '../citation.mjs';
13
+
14
+ type Model = IChatModel | IAudioModel | IImageModel;
15
+
16
+ export { IAudioModel, IChatModel, IImageModel, type Model };
@@ -0,0 +1,16 @@
1
+ import { IAudioModel } from './audio.js';
2
+ export { AudioToTextParams, TextToAudioParams } from './audio.js';
3
+ import { IImageModel } from './image.js';
4
+ export { TextToImageParams } from './image.js';
5
+ import { IChatModel } from './chat.js';
6
+ export { ChatSendOptions, TextChunkHandler } from './chat.js';
7
+ import '../function.js';
8
+ import '../schema.js';
9
+ import '../memory.js';
10
+ import '@microsoft/teams.common';
11
+ import '../message.js';
12
+ import '../citation.js';
13
+
14
+ type Model = IChatModel | IAudioModel | IImageModel;
15
+
16
+ export { IAudioModel, IChatModel, IImageModel, type Model };
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var chat = require('./chat');
4
+ var audio = require('./audio');
5
+ var image = require('./image');
6
+
7
+
8
+
9
+ Object.keys(chat).forEach(function (k) {
10
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
11
+ enumerable: true,
12
+ get: function () { return chat[k]; }
13
+ });
14
+ });
15
+ Object.keys(audio).forEach(function (k) {
16
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
17
+ enumerable: true,
18
+ get: function () { return audio[k]; }
19
+ });
20
+ });
21
+ Object.keys(image).forEach(function (k) {
22
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
23
+ enumerable: true,
24
+ get: function () { return image[k]; }
25
+ });
26
+ });
27
+ //# sourceMappingURL=index.js.map
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourcesContent":[]}
@@ -0,0 +1,5 @@
1
+ export * from './chat';
2
+ export * from './audio';
3
+ export * from './image';
4
+ //# sourceMappingURL=index.mjs.map
5
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.mjs","sourcesContent":[]}
@@ -0,0 +1,54 @@
1
+ import { IAudioModel, TextToAudioParams, AudioToTextParams } from '../models/audio.mjs';
2
+
3
+ type AudioPromptOptions = {
4
+ /**
5
+ * the name of the prompt
6
+ */
7
+ readonly name?: string;
8
+ /**
9
+ * the description of the prompt
10
+ */
11
+ readonly description?: string;
12
+ /**
13
+ * the model to send requests to
14
+ */
15
+ readonly model: IAudioModel;
16
+ };
17
+ /**
18
+ * a prompt that can interface with
19
+ * an audio model
20
+ */
21
+ interface IAudioPrompt {
22
+ /**
23
+ * the prompt name
24
+ */
25
+ readonly name: string;
26
+ /**
27
+ * the prompt description
28
+ */
29
+ readonly description: string;
30
+ /**
31
+ * convert text to audio
32
+ */
33
+ textToAudio?(params: TextToAudioParams): Promise<Buffer>;
34
+ /**
35
+ * transcribe audio to text
36
+ */
37
+ audioToText?(params: AudioToTextParams): Promise<string>;
38
+ }
39
+ /**
40
+ * a prompt that can interface with
41
+ * an audio model
42
+ */
43
+ declare class AudioPrompt implements IAudioPrompt {
44
+ get name(): string;
45
+ protected readonly _name: string;
46
+ get description(): string;
47
+ protected readonly _description: string;
48
+ protected readonly _model: IAudioModel;
49
+ constructor(options: AudioPromptOptions);
50
+ audioToText(params: AudioToTextParams): Promise<string>;
51
+ textToAudio(params: TextToAudioParams): Promise<Buffer<ArrayBufferLike>>;
52
+ }
53
+
54
+ export { AudioPrompt, type AudioPromptOptions, type IAudioPrompt };
@@ -0,0 +1,54 @@
1
+ import { IAudioModel, TextToAudioParams, AudioToTextParams } from '../models/audio.js';
2
+
3
+ type AudioPromptOptions = {
4
+ /**
5
+ * the name of the prompt
6
+ */
7
+ readonly name?: string;
8
+ /**
9
+ * the description of the prompt
10
+ */
11
+ readonly description?: string;
12
+ /**
13
+ * the model to send requests to
14
+ */
15
+ readonly model: IAudioModel;
16
+ };
17
+ /**
18
+ * a prompt that can interface with
19
+ * an audio model
20
+ */
21
+ interface IAudioPrompt {
22
+ /**
23
+ * the prompt name
24
+ */
25
+ readonly name: string;
26
+ /**
27
+ * the prompt description
28
+ */
29
+ readonly description: string;
30
+ /**
31
+ * convert text to audio
32
+ */
33
+ textToAudio?(params: TextToAudioParams): Promise<Buffer>;
34
+ /**
35
+ * transcribe audio to text
36
+ */
37
+ audioToText?(params: AudioToTextParams): Promise<string>;
38
+ }
39
+ /**
40
+ * a prompt that can interface with
41
+ * an audio model
42
+ */
43
+ declare class AudioPrompt implements IAudioPrompt {
44
+ get name(): string;
45
+ protected readonly _name: string;
46
+ get description(): string;
47
+ protected readonly _description: string;
48
+ protected readonly _model: IAudioModel;
49
+ constructor(options: AudioPromptOptions);
50
+ audioToText(params: AudioToTextParams): Promise<string>;
51
+ textToAudio(params: TextToAudioParams): Promise<Buffer<ArrayBufferLike>>;
52
+ }
53
+
54
+ export { AudioPrompt, type AudioPromptOptions, type IAudioPrompt };
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ class AudioPrompt {
4
+ get name() {
5
+ return this._name;
6
+ }
7
+ _name;
8
+ get description() {
9
+ return this._description;
10
+ }
11
+ _description;
12
+ _model;
13
+ constructor(options) {
14
+ this._name = options.name || "audio";
15
+ this._description = options.description || "an agent that can convert text to speech";
16
+ this._model = options.model;
17
+ }
18
+ audioToText(params) {
19
+ if (!this._model.audioToText) {
20
+ throw new Error("cannot transcribe audio to text");
21
+ }
22
+ return this._model.audioToText(params);
23
+ }
24
+ textToAudio(params) {
25
+ if (!this._model.textToAudio) {
26
+ throw new Error("cannot translate text to audio");
27
+ }
28
+ return this._model.textToAudio(params);
29
+ }
30
+ }
31
+
32
+ exports.AudioPrompt = AudioPrompt;
33
+ //# sourceMappingURL=audio.js.map
34
+ //# sourceMappingURL=audio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/prompts/audio.ts"],"names":[],"mappings":";;AAiDO,MAAM,WAAoC,CAAA;AAAA,EAC/C,IAAI,IAAO,GAAA;AACT,IAAA,OAAO,IAAK,CAAA,KAAA;AAAA;AACd,EACmB,KAAA;AAAA,EAEnB,IAAI,WAAc,GAAA;AAChB,IAAA,OAAO,IAAK,CAAA,YAAA;AAAA;AACd,EACmB,YAAA;AAAA,EAEA,MAAA;AAAA,EAEnB,YAAY,OAA6B,EAAA;AACvC,IAAK,IAAA,CAAA,KAAA,GAAQ,QAAQ,IAAQ,IAAA,OAAA;AAC7B,IAAK,IAAA,CAAA,YAAA,GAAe,QAAQ,WAAe,IAAA,0CAAA;AAC3C,IAAA,IAAA,CAAK,SAAS,OAAQ,CAAA,KAAA;AAAA;AACxB,EAEA,YAAY,MAA2B,EAAA;AACrC,IAAI,IAAA,CAAC,IAAK,CAAA,MAAA,CAAO,WAAa,EAAA;AAC5B,MAAM,MAAA,IAAI,MAAM,iCAAiC,CAAA;AAAA;AAGnD,IAAO,OAAA,IAAA,CAAK,MAAO,CAAA,WAAA,CAAY,MAAM,CAAA;AAAA;AACvC,EAEA,YAAY,MAA2B,EAAA;AACrC,IAAI,IAAA,CAAC,IAAK,CAAA,MAAA,CAAO,WAAa,EAAA;AAC5B,MAAM,MAAA,IAAI,MAAM,gCAAgC,CAAA;AAAA;AAGlD,IAAO,OAAA,IAAA,CAAK,MAAO,CAAA,WAAA,CAAY,MAAM,CAAA;AAAA;AAEzC","file":"audio.js","sourcesContent":["import { IAudioModel, AudioToTextParams, TextToAudioParams } from '../models';\n\nexport type AudioPromptOptions = {\n /**\n * the name of the prompt\n */\n readonly name?: string;\n\n /**\n * the description of the prompt\n */\n readonly description?: string;\n\n /**\n * the model to send requests to\n */\n readonly model: IAudioModel;\n};\n\n/**\n * a prompt that can interface with\n * an audio model\n */\nexport interface IAudioPrompt {\n /**\n * the prompt name\n */\n readonly name: string;\n\n /**\n * the prompt description\n */\n readonly description: string;\n\n /**\n * convert text to audio\n */\n textToAudio?(params: TextToAudioParams): Promise<Buffer>;\n\n /**\n * transcribe audio to text\n */\n audioToText?(params: AudioToTextParams): Promise<string>;\n}\n\n/**\n * a prompt that can interface with\n * an audio model\n */\nexport class AudioPrompt implements IAudioPrompt {\n get name() {\n return this._name;\n }\n protected readonly _name: string;\n\n get description() {\n return this._description;\n }\n protected readonly _description: string;\n\n protected readonly _model: IAudioModel;\n\n constructor(options: AudioPromptOptions) {\n this._name = options.name || 'audio';\n this._description = options.description || 'an agent that can convert text to speech';\n this._model = options.model;\n }\n\n audioToText(params: AudioToTextParams) {\n if (!this._model.audioToText) {\n throw new Error('cannot transcribe audio to text');\n }\n\n return this._model.audioToText(params);\n }\n\n textToAudio(params: TextToAudioParams) {\n if (!this._model.textToAudio) {\n throw new Error('cannot translate text to audio');\n }\n\n return this._model.textToAudio(params);\n }\n}\n"]}
@@ -0,0 +1,32 @@
1
+ class AudioPrompt {
2
+ get name() {
3
+ return this._name;
4
+ }
5
+ _name;
6
+ get description() {
7
+ return this._description;
8
+ }
9
+ _description;
10
+ _model;
11
+ constructor(options) {
12
+ this._name = options.name || "audio";
13
+ this._description = options.description || "an agent that can convert text to speech";
14
+ this._model = options.model;
15
+ }
16
+ audioToText(params) {
17
+ if (!this._model.audioToText) {
18
+ throw new Error("cannot transcribe audio to text");
19
+ }
20
+ return this._model.audioToText(params);
21
+ }
22
+ textToAudio(params) {
23
+ if (!this._model.textToAudio) {
24
+ throw new Error("cannot translate text to audio");
25
+ }
26
+ return this._model.textToAudio(params);
27
+ }
28
+ }
29
+
30
+ export { AudioPrompt };
31
+ //# sourceMappingURL=audio.mjs.map
32
+ //# sourceMappingURL=audio.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/prompts/audio.ts"],"names":[],"mappings":"AAiDO,MAAM,WAAoC,CAAA;AAAA,EAC/C,IAAI,IAAO,GAAA;AACT,IAAA,OAAO,IAAK,CAAA,KAAA;AAAA;AACd,EACmB,KAAA;AAAA,EAEnB,IAAI,WAAc,GAAA;AAChB,IAAA,OAAO,IAAK,CAAA,YAAA;AAAA;AACd,EACmB,YAAA;AAAA,EAEA,MAAA;AAAA,EAEnB,YAAY,OAA6B,EAAA;AACvC,IAAK,IAAA,CAAA,KAAA,GAAQ,QAAQ,IAAQ,IAAA,OAAA;AAC7B,IAAK,IAAA,CAAA,YAAA,GAAe,QAAQ,WAAe,IAAA,0CAAA;AAC3C,IAAA,IAAA,CAAK,SAAS,OAAQ,CAAA,KAAA;AAAA;AACxB,EAEA,YAAY,MAA2B,EAAA;AACrC,IAAI,IAAA,CAAC,IAAK,CAAA,MAAA,CAAO,WAAa,EAAA;AAC5B,MAAM,MAAA,IAAI,MAAM,iCAAiC,CAAA;AAAA;AAGnD,IAAO,OAAA,IAAA,CAAK,MAAO,CAAA,WAAA,CAAY,MAAM,CAAA;AAAA;AACvC,EAEA,YAAY,MAA2B,EAAA;AACrC,IAAI,IAAA,CAAC,IAAK,CAAA,MAAA,CAAO,WAAa,EAAA;AAC5B,MAAM,MAAA,IAAI,MAAM,gCAAgC,CAAA;AAAA;AAGlD,IAAO,OAAA,IAAA,CAAK,MAAO,CAAA,WAAA,CAAY,MAAM,CAAA;AAAA;AAEzC","file":"audio.mjs","sourcesContent":["import { IAudioModel, AudioToTextParams, TextToAudioParams } from '../models';\n\nexport type AudioPromptOptions = {\n /**\n * the name of the prompt\n */\n readonly name?: string;\n\n /**\n * the description of the prompt\n */\n readonly description?: string;\n\n /**\n * the model to send requests to\n */\n readonly model: IAudioModel;\n};\n\n/**\n * a prompt that can interface with\n * an audio model\n */\nexport interface IAudioPrompt {\n /**\n * the prompt name\n */\n readonly name: string;\n\n /**\n * the prompt description\n */\n readonly description: string;\n\n /**\n * convert text to audio\n */\n textToAudio?(params: TextToAudioParams): Promise<Buffer>;\n\n /**\n * transcribe audio to text\n */\n audioToText?(params: AudioToTextParams): Promise<string>;\n}\n\n/**\n * a prompt that can interface with\n * an audio model\n */\nexport class AudioPrompt implements IAudioPrompt {\n get name() {\n return this._name;\n }\n protected readonly _name: string;\n\n get description() {\n return this._description;\n }\n protected readonly _description: string;\n\n protected readonly _model: IAudioModel;\n\n constructor(options: AudioPromptOptions) {\n this._name = options.name || 'audio';\n this._description = options.description || 'an agent that can convert text to speech';\n this._model = options.model;\n }\n\n audioToText(params: AudioToTextParams) {\n if (!this._model.audioToText) {\n throw new Error('cannot transcribe audio to text');\n }\n\n return this._model.audioToText(params);\n }\n\n textToAudio(params: TextToAudioParams) {\n if (!this._model.textToAudio) {\n throw new Error('cannot translate text to audio');\n }\n\n return this._model.textToAudio(params);\n }\n}\n"]}