ai 2.2.28 → 2.2.29

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "2.2.28",
3
+ "version": "2.2.29",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -63,4 +63,155 @@ declare function experimental_buildOpenAssistantPrompt(messages: Pick<Message, '
63
63
  */
64
64
  declare function experimental_buildLlama2Prompt(messages: Pick<Message, 'content' | 'role'>[]): string;
65
65
 
66
- export { experimental_buildAnthropicPrompt, experimental_buildLlama2Prompt, experimental_buildOpenAssistantPrompt, experimental_buildStarChatBetaPrompt };
66
+ declare function experimental_buildOpenAIMessages(messages: Message[]): ChatCompletionMessageParam[];
67
+ type ChatCompletionMessageParam = ChatCompletionSystemMessageParam | ChatCompletionUserMessageParam | ChatCompletionAssistantMessageParam | ChatCompletionToolMessageParam | ChatCompletionFunctionMessageParam;
68
+ interface ChatCompletionSystemMessageParam {
69
+ /**
70
+ * The contents of the system message.
71
+ */
72
+ content: string | null;
73
+ /**
74
+ * The role of the messages author, in this case `system`.
75
+ */
76
+ role: 'system';
77
+ }
78
+ interface ChatCompletionUserMessageParam {
79
+ /**
80
+ * The contents of the user message.
81
+ */
82
+ content: string | Array<ChatCompletionContentPart> | null;
83
+ /**
84
+ * The role of the messages author, in this case `user`.
85
+ */
86
+ role: 'user';
87
+ }
88
+ type ChatCompletionContentPart = ChatCompletionContentPartText | ChatCompletionContentPartImage;
89
+ interface ChatCompletionContentPartText {
90
+ /**
91
+ * The text content.
92
+ */
93
+ text: string;
94
+ /**
95
+ * The type of the content part.
96
+ */
97
+ type: 'text';
98
+ }
99
+ interface ChatCompletionContentPartImage {
100
+ image_url: ChatCompletionContentPartImage.ImageURL;
101
+ /**
102
+ * The type of the content part.
103
+ */
104
+ type: 'image_url';
105
+ }
106
+ declare namespace ChatCompletionContentPartImage {
107
+ interface ImageURL {
108
+ /**
109
+ * Specifies the detail level of the image.
110
+ */
111
+ detail?: 'auto' | 'low' | 'high';
112
+ /**
113
+ * Either a URL of the image or the base64 encoded image data.
114
+ */
115
+ url?: string;
116
+ }
117
+ }
118
+ interface ChatCompletionAssistantMessageParam {
119
+ /**
120
+ * The contents of the assistant message.
121
+ */
122
+ content: string | null;
123
+ /**
124
+ * The role of the messages author, in this case `assistant`.
125
+ */
126
+ role: 'assistant';
127
+ /**
128
+ * Deprecated and replaced by `tool_calls`. The name and arguments of a function
129
+ * that should be called, as generated by the model.
130
+ */
131
+ function_call?: ChatCompletionAssistantMessageParam.FunctionCall;
132
+ /**
133
+ * The tool calls generated by the model, such as function calls.
134
+ */
135
+ tool_calls?: Array<ChatCompletionMessageToolCall>;
136
+ }
137
+ declare namespace ChatCompletionAssistantMessageParam {
138
+ /**
139
+ * Deprecated and replaced by `tool_calls`. The name and arguments of a function
140
+ * that should be called, as generated by the model.
141
+ */
142
+ interface FunctionCall {
143
+ /**
144
+ * The arguments to call the function with, as generated by the model in JSON
145
+ * format. Note that the model does not always generate valid JSON, and may
146
+ * hallucinate parameters not defined by your function schema. Validate the
147
+ * arguments in your code before calling your function.
148
+ */
149
+ arguments: string;
150
+ /**
151
+ * The name of the function to call.
152
+ */
153
+ name: string;
154
+ }
155
+ }
156
+ interface ChatCompletionMessageToolCall {
157
+ /**
158
+ * The ID of the tool call.
159
+ */
160
+ id: string;
161
+ /**
162
+ * The function that the model called.
163
+ */
164
+ function: ChatCompletionMessageToolCall.Function;
165
+ /**
166
+ * The type of the tool. Currently, only `function` is supported.
167
+ */
168
+ type: 'function';
169
+ }
170
+ declare namespace ChatCompletionMessageToolCall {
171
+ /**
172
+ * The function that the model called.
173
+ */
174
+ interface Function {
175
+ /**
176
+ * The arguments to call the function with, as generated by the model in JSON
177
+ * format. Note that the model does not always generate valid JSON, and may
178
+ * hallucinate parameters not defined by your function schema. Validate the
179
+ * arguments in your code before calling your function.
180
+ */
181
+ arguments: string;
182
+ /**
183
+ * The name of the function to call.
184
+ */
185
+ name: string;
186
+ }
187
+ }
188
+ interface ChatCompletionToolMessageParam {
189
+ /**
190
+ * The contents of the tool message.
191
+ */
192
+ content: string | null;
193
+ /**
194
+ * The role of the messages author, in this case `tool`.
195
+ */
196
+ role: 'tool';
197
+ /**
198
+ * Tool call that this message is responding to.
199
+ */
200
+ tool_call_id: string;
201
+ }
202
+ interface ChatCompletionFunctionMessageParam {
203
+ /**
204
+ * The return value from the function call, to return to the model.
205
+ */
206
+ content: string | null;
207
+ /**
208
+ * The name of the function to call.
209
+ */
210
+ name: string;
211
+ /**
212
+ * The role of the messages author, in this case `function`.
213
+ */
214
+ role: 'function';
215
+ }
216
+
217
+ export { ChatCompletionAssistantMessageParam, ChatCompletionContentPart, ChatCompletionContentPartImage, ChatCompletionContentPartText, ChatCompletionFunctionMessageParam, ChatCompletionMessageParam, ChatCompletionMessageToolCall, ChatCompletionSystemMessageParam, ChatCompletionToolMessageParam, ChatCompletionUserMessageParam, experimental_buildAnthropicPrompt, experimental_buildLlama2Prompt, experimental_buildOpenAIMessages, experimental_buildOpenAssistantPrompt, experimental_buildStarChatBetaPrompt };
@@ -22,6 +22,7 @@ var prompts_exports = {};
22
22
  __export(prompts_exports, {
23
23
  experimental_buildAnthropicPrompt: () => experimental_buildAnthropicPrompt,
24
24
  experimental_buildLlama2Prompt: () => experimental_buildLlama2Prompt,
25
+ experimental_buildOpenAIMessages: () => experimental_buildOpenAIMessages,
25
26
  experimental_buildOpenAssistantPrompt: () => experimental_buildOpenAssistantPrompt,
26
27
  experimental_buildStarChatBetaPrompt: () => experimental_buildStarChatBetaPrompt
27
28
  });
@@ -97,10 +98,54 @@ ${content}
97
98
  });
98
99
  return startPrompt + conversation.join("") + endPrompt;
99
100
  }
101
+
102
+ // prompts/openai.tsx
103
+ function experimental_buildOpenAIMessages(messages) {
104
+ return messages.map((message) => {
105
+ switch (message.role) {
106
+ case "system":
107
+ case "user":
108
+ return {
109
+ role: message.role,
110
+ content: message.content
111
+ };
112
+ case "assistant": {
113
+ const function_call = message.function_call;
114
+ if (function_call !== void 0 && (typeof function_call === "string" || function_call.arguments === void 0 || function_call.name === void 0)) {
115
+ throw new Error(
116
+ "Invalid function call in message. Expected a function call object"
117
+ );
118
+ }
119
+ return {
120
+ role: message.role,
121
+ content: message.content,
122
+ function_call: function_call === void 0 ? void 0 : {
123
+ name: function_call.name,
124
+ arguments: function_call.arguments
125
+ }
126
+ };
127
+ }
128
+ case "function": {
129
+ if (message.name === void 0) {
130
+ throw new Error("Invalid function call in message. Expected a name");
131
+ }
132
+ return {
133
+ role: message.role,
134
+ content: message.content,
135
+ name: message.name
136
+ };
137
+ }
138
+ case "data": {
139
+ throw "unsupported message role 'data'";
140
+ }
141
+ }
142
+ });
143
+ }
100
144
  // Annotate the CommonJS export names for ESM import in node:
101
145
  0 && (module.exports = {
102
146
  experimental_buildAnthropicPrompt,
103
147
  experimental_buildLlama2Prompt,
148
+ experimental_buildOpenAIMessages,
104
149
  experimental_buildOpenAssistantPrompt,
105
150
  experimental_buildStarChatBetaPrompt
106
151
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../index.ts","../anthropic.ts","../huggingface.ts"],"sourcesContent":["export * from './anthropic';\nexport * from './huggingface';\n","import { Message } from '../shared/types';\n\n/**\n * A prompt constructor for Anthropic models.\n * Does not support `function` messages.\n * @see https://docs.anthropic.com/claude/reference/getting-started-with-the-api\n */\nexport function experimental_buildAnthropicPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages.map(({ content, role }) => {\n if (role === 'user') {\n return `\\n\\nHuman: ${content}`;\n } else {\n return `\\n\\nAssistant: ${content}`;\n }\n }) + '\\n\\nAssistant:'\n );\n}\n","import { Message } from '../shared/types';\n\n/**\n * A prompt constructor for the HuggingFace StarChat Beta model.\n * Does not support `function` messages.\n * @see https://huggingface.co/HuggingFaceH4/starchat-beta\n */\nexport function experimental_buildStarChatBetaPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages\n .map(({ content, role }) => {\n if (role === 'user') {\n return `<|user|>\\n${content}<|end|>\\n`;\n } else if (role === 'assistant') {\n return `<|assistant|>\\n${content}<|end|>\\n`;\n } else if (role === 'system') {\n return `<|system|>\\n${content}<|end|>\\n`;\n } else if (role === 'function') {\n throw new Error('StarChat Beta does not support function calls.');\n }\n })\n .join('') + '<|assistant|>'\n );\n}\n\n/**\n * A prompt constructor for HuggingFace OpenAssistant models.\n * Does not support `function` or `system` messages.\n * @see https://huggingface.co/OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5\n */\nexport function experimental_buildOpenAssistantPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages\n .map(({ content, role }) => {\n if (role === 'user') {\n return `<|prompter|>${content}<|endoftext|>`;\n } else if (role === 'function') {\n throw new Error('OpenAssistant does not support function calls.');\n } else if (role === 'system') {\n throw new Error('OpenAssistant does not support system messages.');\n } else {\n return `<|assistant|>${content}<|endoftext|>`;\n }\n })\n .join('') + '<|assistant|>'\n );\n}\n\n/**\n * A prompt constructor for HuggingFace LLama 2 chat models.\n * Does not support `function` messages.\n * @see https://huggingface.co/meta-llama/Llama-2-70b-chat-hf and https://huggingface.co/blog/llama2#how-to-prompt-llama-2\n */\nexport function experimental_buildLlama2Prompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n const startPrompt = `<s>[INST] `;\n const endPrompt = ` [/INST]`;\n const conversation = messages.map(({ content, role }, index) => {\n if (role === 'user') {\n return content.trim();\n } else if (role === 'assistant') {\n return ` [/INST] ${content}</s><s>[INST] `;\n } else if (role === 'function') {\n throw new Error('Llama 2 does not support function calls.');\n } else if (role === 'system' && index === 0) {\n return `<<SYS>>\\n${content}\\n<</SYS>>\\n\\n`;\n } else {\n throw new Error(`Invalid message role: ${role}`);\n }\n });\n\n return startPrompt + conversation.join('') + endPrompt;\n}\n"],"mappings":";;;;;;;;;;;;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rB,WAAW,SAAS,YAAY;AAC9B,YAAM,IAAI,MAAM,0CAA0C;AAAA,IAC5D,WAAW,SAAS,YAAY,UAAU,GAAG;AAC3C,aAAO;AAAA,EAAY;AAAA;AAAA;AAAA;AAAA,IACrB,OAAO;AACL,YAAM,IAAI,MAAM,yBAAyB,MAAM;AAAA,IACjD;AAAA,EACF,CAAC;AAED,SAAO,cAAc,aAAa,KAAK,EAAE,IAAI;AAC/C;","names":[]}
1
+ {"version":3,"sources":["../index.ts","../anthropic.ts","../huggingface.ts","../openai.tsx"],"sourcesContent":["export * from './anthropic';\nexport * from './huggingface';\nexport * from './openai';\n","import { Message } from '../shared/types';\n\n/**\n * A prompt constructor for Anthropic models.\n * Does not support `function` messages.\n * @see https://docs.anthropic.com/claude/reference/getting-started-with-the-api\n */\nexport function experimental_buildAnthropicPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages.map(({ content, role }) => {\n if (role === 'user') {\n return `\\n\\nHuman: ${content}`;\n } else {\n return `\\n\\nAssistant: ${content}`;\n }\n }) + '\\n\\nAssistant:'\n );\n}\n","import { Message } from '../shared/types';\n\n/**\n * A prompt constructor for the HuggingFace StarChat Beta model.\n * Does not support `function` messages.\n * @see https://huggingface.co/HuggingFaceH4/starchat-beta\n */\nexport function experimental_buildStarChatBetaPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages\n .map(({ content, role }) => {\n if (role === 'user') {\n return `<|user|>\\n${content}<|end|>\\n`;\n } else if (role === 'assistant') {\n return `<|assistant|>\\n${content}<|end|>\\n`;\n } else if (role === 'system') {\n return `<|system|>\\n${content}<|end|>\\n`;\n } else if (role === 'function') {\n throw new Error('StarChat Beta does not support function calls.');\n }\n })\n .join('') + '<|assistant|>'\n );\n}\n\n/**\n * A prompt constructor for HuggingFace OpenAssistant models.\n * Does not support `function` or `system` messages.\n * @see https://huggingface.co/OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5\n */\nexport function experimental_buildOpenAssistantPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages\n .map(({ content, role }) => {\n if (role === 'user') {\n return `<|prompter|>${content}<|endoftext|>`;\n } else if (role === 'function') {\n throw new Error('OpenAssistant does not support function calls.');\n } else if (role === 'system') {\n throw new Error('OpenAssistant does not support system messages.');\n } else {\n return `<|assistant|>${content}<|endoftext|>`;\n }\n })\n .join('') + '<|assistant|>'\n );\n}\n\n/**\n * A prompt constructor for HuggingFace LLama 2 chat models.\n * Does not support `function` messages.\n * @see https://huggingface.co/meta-llama/Llama-2-70b-chat-hf and https://huggingface.co/blog/llama2#how-to-prompt-llama-2\n */\nexport function experimental_buildLlama2Prompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n const startPrompt = `<s>[INST] `;\n const endPrompt = ` [/INST]`;\n const conversation = messages.map(({ content, role }, index) => {\n if (role === 'user') {\n return content.trim();\n } else if (role === 'assistant') {\n return ` [/INST] ${content}</s><s>[INST] `;\n } else if (role === 'function') {\n throw new Error('Llama 2 does not support function calls.');\n } else if (role === 'system' && index === 0) {\n return `<<SYS>>\\n${content}\\n<</SYS>>\\n\\n`;\n } else {\n throw new Error(`Invalid message role: ${role}`);\n }\n });\n\n return startPrompt + conversation.join('') + endPrompt;\n}\n","import { Message } from '../shared/types';\n\nexport function experimental_buildOpenAIMessages(\n messages: Message[],\n): ChatCompletionMessageParam[] {\n return messages.map(message => {\n switch (message.role) {\n case 'system':\n case 'user':\n return {\n role: message.role,\n content: message.content,\n } satisfies ChatCompletionMessageParam;\n\n case 'assistant': {\n const function_call = message.function_call;\n\n if (\n function_call !== undefined &&\n (typeof function_call === 'string' ||\n function_call.arguments === undefined ||\n function_call.name === undefined)\n ) {\n throw new Error(\n 'Invalid function call in message. Expected a function call object',\n );\n }\n\n return {\n role: message.role,\n content: message.content,\n function_call:\n function_call === undefined\n ? undefined\n : {\n name: function_call.name!,\n arguments: function_call.arguments!,\n },\n } satisfies ChatCompletionMessageParam;\n }\n\n case 'function': {\n if (message.name === undefined) {\n throw new Error('Invalid function call in message. Expected a name');\n }\n\n return {\n role: message.role,\n content: message.content,\n name: message.name,\n } satisfies ChatCompletionMessageParam;\n }\n\n case 'data': {\n throw \"unsupported message role 'data'\";\n }\n }\n });\n}\n\n// copy of open ai messages (so we don't have a dependency on the openai package)\nexport type ChatCompletionMessageParam =\n | ChatCompletionSystemMessageParam\n | ChatCompletionUserMessageParam\n | ChatCompletionAssistantMessageParam\n | ChatCompletionToolMessageParam\n | ChatCompletionFunctionMessageParam;\n\nexport interface ChatCompletionSystemMessageParam {\n /**\n * The contents of the system message.\n */\n content: string | null;\n\n /**\n * The role of the messages author, in this case `system`.\n */\n role: 'system';\n}\n\nexport interface ChatCompletionUserMessageParam {\n /**\n * The contents of the user message.\n */\n content: string | Array<ChatCompletionContentPart> | null;\n\n /**\n * The role of the messages author, in this case `user`.\n */\n role: 'user';\n}\n\nexport type ChatCompletionContentPart =\n | ChatCompletionContentPartText\n | ChatCompletionContentPartImage;\n\nexport interface ChatCompletionContentPartText {\n /**\n * The text content.\n */\n text: string;\n\n /**\n * The type of the content part.\n */\n type: 'text';\n}\n\nexport interface ChatCompletionContentPartImage {\n image_url: ChatCompletionContentPartImage.ImageURL;\n\n /**\n * The type of the content part.\n */\n type: 'image_url';\n}\n\nexport namespace ChatCompletionContentPartImage {\n export interface ImageURL {\n /**\n * Specifies the detail level of the image.\n */\n detail?: 'auto' | 'low' | 'high';\n\n /**\n * Either a URL of the image or the base64 encoded image data.\n */\n url?: string;\n }\n}\n\nexport interface ChatCompletionAssistantMessageParam {\n /**\n * The contents of the assistant message.\n */\n content: string | null;\n\n /**\n * The role of the messages author, in this case `assistant`.\n */\n role: 'assistant';\n\n /**\n * Deprecated and replaced by `tool_calls`. The name and arguments of a function\n * that should be called, as generated by the model.\n */\n function_call?: ChatCompletionAssistantMessageParam.FunctionCall;\n\n /**\n * The tool calls generated by the model, such as function calls.\n */\n tool_calls?: Array<ChatCompletionMessageToolCall>;\n}\n\nexport namespace ChatCompletionAssistantMessageParam {\n /**\n * Deprecated and replaced by `tool_calls`. The name and arguments of a function\n * that should be called, as generated by the model.\n */\n export interface FunctionCall {\n /**\n * The arguments to call the function with, as generated by the model in JSON\n * format. Note that the model does not always generate valid JSON, and may\n * hallucinate parameters not defined by your function schema. Validate the\n * arguments in your code before calling your function.\n */\n arguments: string;\n\n /**\n * The name of the function to call.\n */\n name: string;\n }\n}\n\nexport interface ChatCompletionMessageToolCall {\n /**\n * The ID of the tool call.\n */\n id: string;\n\n /**\n * The function that the model called.\n */\n function: ChatCompletionMessageToolCall.Function;\n\n /**\n * The type of the tool. Currently, only `function` is supported.\n */\n type: 'function';\n}\n\nexport namespace ChatCompletionMessageToolCall {\n /**\n * The function that the model called.\n */\n export interface Function {\n /**\n * The arguments to call the function with, as generated by the model in JSON\n * format. Note that the model does not always generate valid JSON, and may\n * hallucinate parameters not defined by your function schema. Validate the\n * arguments in your code before calling your function.\n */\n arguments: string;\n\n /**\n * The name of the function to call.\n */\n name: string;\n }\n}\n\nexport interface ChatCompletionToolMessageParam {\n /**\n * The contents of the tool message.\n */\n content: string | null;\n\n /**\n * The role of the messages author, in this case `tool`.\n */\n role: 'tool';\n\n /**\n * Tool call that this message is responding to.\n */\n tool_call_id: string;\n}\n\nexport interface ChatCompletionFunctionMessageParam {\n /**\n * The return value from the function call, to return to the model.\n */\n content: string | null;\n\n /**\n * The name of the function to call.\n */\n name: string;\n\n /**\n * The role of the messages author, in this case `function`.\n */\n role: 'function';\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,SAAS,kCACd,UACA;AACA,SACE,SAAS,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;AAClC,QAAI,SAAS,QAAQ;AACnB,aAAO;AAAA;AAAA,SAAc;AAAA,IACvB,OAAO;AACL,aAAO;AAAA;AAAA,aAAkB;AAAA,IAC3B;AAAA,EACF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IAAI;AAC/C;;;AC3EO,SAAS,iCACd,UAC8B;AAC9B,SAAO,SAAS,IAAI,aAAW;AAC7B,YAAQ,QAAQ,MAAM;AAAA,MACpB,KAAK;AAAA,MACL,KAAK;AACH,eAAO;AAAA,UACL,MAAM,QAAQ;AAAA,UACd,SAAS,QAAQ;AAAA,QACnB;AAAA,MAEF,KAAK,aAAa;AAChB,cAAM,gBAAgB,QAAQ;AAE9B,YACE,kBAAkB,WACjB,OAAO,kBAAkB,YACxB,cAAc,cAAc,UAC5B,cAAc,SAAS,SACzB;AACA,gBAAM,IAAI;AAAA,YACR;AAAA,UACF;AAAA,QACF;AAEA,eAAO;AAAA,UACL,MAAM,QAAQ;AAAA,UACd,SAAS,QAAQ;AAAA,UACjB,eACE,kBAAkB,SACd,SACA;AAAA,YACE,MAAM,cAAc;AAAA,YACpB,WAAW,cAAc;AAAA,UAC3B;AAAA,QACR;AAAA,MACF;AAAA,MAEA,KAAK,YAAY;AACf,YAAI,QAAQ,SAAS,QAAW;AAC9B,gBAAM,IAAI,MAAM,mDAAmD;AAAA,QACrE;AAEA,eAAO;AAAA,UACL,MAAM,QAAQ;AAAA,UACd,SAAS,QAAQ;AAAA,UACjB,MAAM,QAAQ;AAAA,QAChB;AAAA,MACF;AAAA,MAEA,KAAK,QAAQ;AACX,cAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -68,9 +68,53 @@ ${content}
68
68
  });
69
69
  return startPrompt + conversation.join("") + endPrompt;
70
70
  }
71
+
72
+ // prompts/openai.tsx
73
+ function experimental_buildOpenAIMessages(messages) {
74
+ return messages.map((message) => {
75
+ switch (message.role) {
76
+ case "system":
77
+ case "user":
78
+ return {
79
+ role: message.role,
80
+ content: message.content
81
+ };
82
+ case "assistant": {
83
+ const function_call = message.function_call;
84
+ if (function_call !== void 0 && (typeof function_call === "string" || function_call.arguments === void 0 || function_call.name === void 0)) {
85
+ throw new Error(
86
+ "Invalid function call in message. Expected a function call object"
87
+ );
88
+ }
89
+ return {
90
+ role: message.role,
91
+ content: message.content,
92
+ function_call: function_call === void 0 ? void 0 : {
93
+ name: function_call.name,
94
+ arguments: function_call.arguments
95
+ }
96
+ };
97
+ }
98
+ case "function": {
99
+ if (message.name === void 0) {
100
+ throw new Error("Invalid function call in message. Expected a name");
101
+ }
102
+ return {
103
+ role: message.role,
104
+ content: message.content,
105
+ name: message.name
106
+ };
107
+ }
108
+ case "data": {
109
+ throw "unsupported message role 'data'";
110
+ }
111
+ }
112
+ });
113
+ }
71
114
  export {
72
115
  experimental_buildAnthropicPrompt,
73
116
  experimental_buildLlama2Prompt,
117
+ experimental_buildOpenAIMessages,
74
118
  experimental_buildOpenAssistantPrompt,
75
119
  experimental_buildStarChatBetaPrompt
76
120
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../anthropic.ts","../huggingface.ts"],"sourcesContent":["import { Message } from '../shared/types';\n\n/**\n * A prompt constructor for Anthropic models.\n * Does not support `function` messages.\n * @see https://docs.anthropic.com/claude/reference/getting-started-with-the-api\n */\nexport function experimental_buildAnthropicPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages.map(({ content, role }) => {\n if (role === 'user') {\n return `\\n\\nHuman: ${content}`;\n } else {\n return `\\n\\nAssistant: ${content}`;\n }\n }) + '\\n\\nAssistant:'\n );\n}\n","import { Message } from '../shared/types';\n\n/**\n * A prompt constructor for the HuggingFace StarChat Beta model.\n * Does not support `function` messages.\n * @see https://huggingface.co/HuggingFaceH4/starchat-beta\n */\nexport function experimental_buildStarChatBetaPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages\n .map(({ content, role }) => {\n if (role === 'user') {\n return `<|user|>\\n${content}<|end|>\\n`;\n } else if (role === 'assistant') {\n return `<|assistant|>\\n${content}<|end|>\\n`;\n } else if (role === 'system') {\n return `<|system|>\\n${content}<|end|>\\n`;\n } else if (role === 'function') {\n throw new Error('StarChat Beta does not support function calls.');\n }\n })\n .join('') + '<|assistant|>'\n );\n}\n\n/**\n * A prompt constructor for HuggingFace OpenAssistant models.\n * Does not support `function` or `system` messages.\n * @see https://huggingface.co/OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5\n */\nexport function experimental_buildOpenAssistantPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages\n .map(({ content, role }) => {\n if (role === 'user') {\n return `<|prompter|>${content}<|endoftext|>`;\n } else if (role === 'function') {\n throw new Error('OpenAssistant does not support function calls.');\n } else if (role === 'system') {\n throw new Error('OpenAssistant does not support system messages.');\n } else {\n return `<|assistant|>${content}<|endoftext|>`;\n }\n })\n .join('') + '<|assistant|>'\n );\n}\n\n/**\n * A prompt constructor for HuggingFace LLama 2 chat models.\n * Does not support `function` messages.\n * @see https://huggingface.co/meta-llama/Llama-2-70b-chat-hf and https://huggingface.co/blog/llama2#how-to-prompt-llama-2\n */\nexport function experimental_buildLlama2Prompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n const startPrompt = `<s>[INST] `;\n const endPrompt = ` [/INST]`;\n const conversation = messages.map(({ content, role }, index) => {\n if (role === 'user') {\n return content.trim();\n } else if (role === 'assistant') {\n return ` [/INST] ${content}</s><s>[INST] `;\n } else if (role === 'function') {\n throw new Error('Llama 2 does not support function calls.');\n } else if (role === 'system' && index === 0) {\n return `<<SYS>>\\n${content}\\n<</SYS>>\\n\\n`;\n } else {\n throw new Error(`Invalid message role: ${role}`);\n }\n });\n\n return startPrompt + conversation.join('') + endPrompt;\n}\n"],"mappings":";AAOO,SAAS,kCACd,UACA;AACA,SACE,SAAS,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;AAClC,QAAI,SAAS,QAAQ;AACnB,aAAO;AAAA;AAAA,SAAc;AAAA,IACvB,OAAO;AACL,aAAO;AAAA;AAAA,aAAkB;AAAA,IAC3B;AAAA,EACF,CAAC,IAAI;AAET;;;ACZO,SAAS,qCACd,UACA;AACA,SACE,SACG,IAAI,CAAC,EAAE,SAAS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":["import { Message } from '../shared/types';\n\n/**\n * A prompt constructor for Anthropic models.\n * Does not support `function` messages.\n * @see https://docs.anthropic.com/claude/reference/getting-started-with-the-api\n */\nexport function experimental_buildAnthropicPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages.map(({ content, role }) => {\n if (role === 'user') {\n return `\\n\\nHuman: ${content}`;\n } else {\n return `\\n\\nAssistant: ${content}`;\n }\n }) + '\\n\\nAssistant:'\n );\n}\n","import { Message } from '../shared/types';\n\n/**\n * A prompt constructor for the HuggingFace StarChat Beta model.\n * Does not support `function` messages.\n * @see https://huggingface.co/HuggingFaceH4/starchat-beta\n */\nexport function experimental_buildStarChatBetaPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages\n .map(({ content, role }) => {\n if (role === 'user') {\n return `<|user|>\\n${content}<|end|>\\n`;\n } else if (role === 'assistant') {\n return `<|assistant|>\\n${content}<|end|>\\n`;\n } else if (role === 'system') {\n return `<|system|>\\n${content}<|end|>\\n`;\n } else if (role === 'function') {\n throw new Error('StarChat Beta does not support function calls.');\n }\n })\n .join('') + '<|assistant|>'\n );\n}\n\n/**\n * A prompt constructor for HuggingFace OpenAssistant models.\n * Does not support `function` or `system` messages.\n * @see https://huggingface.co/OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5\n */\nexport function experimental_buildOpenAssistantPrompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n return (\n messages\n .map(({ content, role }) => {\n if (role === 'user') {\n return `<|prompter|>${content}<|endoftext|>`;\n } else if (role === 'function') {\n throw new Error('OpenAssistant does not support function calls.');\n } else if (role === 'system') {\n throw new Error('OpenAssistant does not support system messages.');\n } else {\n return `<|assistant|>${content}<|endoftext|>`;\n }\n })\n .join('') + '<|assistant|>'\n );\n}\n\n/**\n * A prompt constructor for HuggingFace LLama 2 chat models.\n * Does not support `function` messages.\n * @see https://huggingface.co/meta-llama/Llama-2-70b-chat-hf and https://huggingface.co/blog/llama2#how-to-prompt-llama-2\n */\nexport function experimental_buildLlama2Prompt(\n messages: Pick<Message, 'content' | 'role'>[],\n) {\n const startPrompt = `<s>[INST] `;\n const endPrompt = ` [/INST]`;\n const conversation = messages.map(({ content, role }, index) => {\n if (role === 'user') {\n return content.trim();\n } else if (role === 'assistant') {\n return ` [/INST] ${content}</s><s>[INST] `;\n } else if (role === 'function') {\n throw new Error('Llama 2 does not support function calls.');\n } else if (role === 'system' && index === 0) {\n return `<<SYS>>\\n${content}\\n<</SYS>>\\n\\n`;\n } else {\n throw new Error(`Invalid message role: ${role}`);\n }\n });\n\n return startPrompt + conversation.join('') + endPrompt;\n}\n","import { Message } from '../shared/types';\n\nexport function experimental_buildOpenAIMessages(\n messages: Message[],\n): ChatCompletionMessageParam[] {\n return messages.map(message => {\n switch (message.role) {\n case 'system':\n case 'user':\n return {\n role: message.role,\n content: message.content,\n } satisfies ChatCompletionMessageParam;\n\n case 'assistant': {\n const function_call = message.function_call;\n\n if (\n function_call !== undefined &&\n (typeof function_call === 'string' ||\n function_call.arguments === undefined ||\n function_call.name === undefined)\n ) {\n throw new Error(\n 'Invalid function call in message. Expected a function call object',\n );\n }\n\n return {\n role: message.role,\n content: message.content,\n function_call:\n function_call === undefined\n ? undefined\n : {\n name: function_call.name!,\n arguments: function_call.arguments!,\n },\n } satisfies ChatCompletionMessageParam;\n }\n\n case 'function': {\n if (message.name === undefined) {\n throw new Error('Invalid function call in message. Expected a name');\n }\n\n return {\n role: message.role,\n content: message.content,\n name: message.name,\n } satisfies ChatCompletionMessageParam;\n }\n\n case 'data': {\n throw \"unsupported message role 'data'\";\n }\n }\n });\n}\n\n// copy of open ai messages (so we don't have a dependency on the openai package)\nexport type ChatCompletionMessageParam =\n | ChatCompletionSystemMessageParam\n | ChatCompletionUserMessageParam\n | ChatCompletionAssistantMessageParam\n | ChatCompletionToolMessageParam\n | ChatCompletionFunctionMessageParam;\n\nexport interface ChatCompletionSystemMessageParam {\n /**\n * The contents of the system message.\n */\n content: string | null;\n\n /**\n * The role of the messages author, in this case `system`.\n */\n role: 'system';\n}\n\nexport interface ChatCompletionUserMessageParam {\n /**\n * The contents of the user message.\n */\n content: string | Array<ChatCompletionContentPart> | null;\n\n /**\n * The role of the messages author, in this case `user`.\n */\n role: 'user';\n}\n\nexport type ChatCompletionContentPart =\n | ChatCompletionContentPartText\n | ChatCompletionContentPartImage;\n\nexport interface ChatCompletionContentPartText {\n /**\n * The text content.\n */\n text: string;\n\n /**\n * The type of the content part.\n */\n type: 'text';\n}\n\nexport interface ChatCompletionContentPartImage {\n image_url: ChatCompletionContentPartImage.ImageURL;\n\n /**\n * The type of the content part.\n */\n type: 'image_url';\n}\n\nexport namespace ChatCompletionContentPartImage {\n export interface ImageURL {\n /**\n * Specifies the detail level of the image.\n */\n detail?: 'auto' | 'low' | 'high';\n\n /**\n * Either a URL of the image or the base64 encoded image data.\n */\n url?: string;\n }\n}\n\nexport interface ChatCompletionAssistantMessageParam {\n /**\n * The contents of the assistant message.\n */\n content: string | null;\n\n /**\n * The role of the messages author, in this case `assistant`.\n */\n role: 'assistant';\n\n /**\n * Deprecated and replaced by `tool_calls`. The name and arguments of a function\n * that should be called, as generated by the model.\n */\n function_call?: ChatCompletionAssistantMessageParam.FunctionCall;\n\n /**\n * The tool calls generated by the model, such as function calls.\n */\n tool_calls?: Array<ChatCompletionMessageToolCall>;\n}\n\nexport namespace ChatCompletionAssistantMessageParam {\n /**\n * Deprecated and replaced by `tool_calls`. The name and arguments of a function\n * that should be called, as generated by the model.\n */\n export interface FunctionCall {\n /**\n * The arguments to call the function with, as generated by the model in JSON\n * format. Note that the model does not always generate valid JSON, and may\n * hallucinate parameters not defined by your function schema. Validate the\n * arguments in your code before calling your function.\n */\n arguments: string;\n\n /**\n * The name of the function to call.\n */\n name: string;\n }\n}\n\nexport interface ChatCompletionMessageToolCall {\n /**\n * The ID of the tool call.\n */\n id: string;\n\n /**\n * The function that the model called.\n */\n function: ChatCompletionMessageToolCall.Function;\n\n /**\n * The type of the tool. Currently, only `function` is supported.\n */\n type: 'function';\n}\n\nexport namespace ChatCompletionMessageToolCall {\n /**\n * The function that the model called.\n */\n export interface Function {\n /**\n * The arguments to call the function with, as generated by the model in JSON\n * format. Note that the model does not always generate valid JSON, and may\n * hallucinate parameters not defined by your function schema. Validate the\n * arguments in your code before calling your function.\n */\n arguments: string;\n\n /**\n * The name of the function to call.\n */\n name: string;\n }\n}\n\nexport interface ChatCompletionToolMessageParam {\n /**\n * The contents of the tool message.\n */\n content: string | null;\n\n /**\n * The role of the messages author, in this case `tool`.\n */\n role: 'tool';\n\n /**\n * Tool call that this message is responding to.\n */\n tool_call_id: string;\n}\n\nexport interface ChatCompletionFunctionMessageParam {\n /**\n * The return value from the function call, to return to the model.\n */\n content: string | null;\n\n /**\n * The name of the function to call.\n */\n name: string;\n\n /**\n * The role of the messages author, in this case `function`.\n */\n role: 'function';\n}\n"],"mappings":";AAOO,SAAS,kCACd,UACA;AACA,SACE,SAAS,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;AAClC,QAAI,SAAS,QAAQ;AACnB,aAAO;AAAA;AAAA,SAAc;AAAA,IACvB,OAAO;AACL,aAAO;AAAA;AAAA,aAAkB;AAAA,IAC3B;AAAA,EACF,CAAC,IAAI;AAET;;;ACZO,SAAS,qCACd,UACA;AACA,SACE,SACG,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM;AAC1B,QAAI,SAAS,QAAQ;AACnB,aAAO;AAAA,EAAa;AAAA;AAAA,IACtB,WAAW,SAAS,aAAa;AAC/B,aAAO;AAAA,EAAkB;AAAA;AAAA,IAC3B,WAAW,SAAS,UAAU;AAC5B,aAAO;AAAA,EAAe;AAAA;AAAA,IACxB,WAAW,SAAS,YAAY;AAC9B,YAAM,IAAI,MAAM,gDAAgD;AAAA,IAClE;AAAA,EACF,CAAC,EACA,KAAK,EAAE,IAAI;AAElB;AAOO,SAAS,sCACd,UACA;AACA,SACE,SACG,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM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