@premai/api-sdk 1.0.46 → 1.0.47

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.
@@ -8,7 +8,7 @@ type AnthropicContentPart = AnthropicTextBlock | {
8
8
  [key: string]: unknown;
9
9
  };
10
10
  export type AnthropicMessage = {
11
- role: "user" | "assistant";
11
+ role: "user" | "assistant" | "system";
12
12
  content: string | AnthropicContentPart[];
13
13
  };
14
14
  export type AnthropicMessagesCreateBody = {
@@ -615,6 +615,10 @@ function anthropicMessagesCreateToOpenAI(body) {
615
615
  messages.push(...systemToOpenAiMessages(body.system));
616
616
  }
617
617
  for (const m of body.messages) {
618
+ if (m.role === "system") {
619
+ messages.push(...systemToOpenAiMessages(m.content));
620
+ continue;
621
+ }
618
622
  if (m.role !== "user" && m.role !== "assistant") {
619
623
  throw new AnthropicRequestValidationError(`Invalid message role "${m.role}".`);
620
624
  }
package/dist/cli.mjs CHANGED
@@ -1898,6 +1898,10 @@ function anthropicMessagesCreateToOpenAI(body) {
1898
1898
  messages.push(...systemToOpenAiMessages(body.system));
1899
1899
  }
1900
1900
  for (const m of body.messages) {
1901
+ if (m.role === "system") {
1902
+ messages.push(...systemToOpenAiMessages(m.content));
1903
+ continue;
1904
+ }
1901
1905
  if (m.role !== "user" && m.role !== "assistant") {
1902
1906
  throw new AnthropicRequestValidationError(`Invalid message role "${m.role}".`);
1903
1907
  }
package/dist/index.cjs CHANGED
@@ -2017,6 +2017,10 @@ function anthropicMessagesCreateToOpenAI(body) {
2017
2017
  messages.push(...systemToOpenAiMessages(body.system));
2018
2018
  }
2019
2019
  for (const m of body.messages) {
2020
+ if (m.role === "system") {
2021
+ messages.push(...systemToOpenAiMessages(m.content));
2022
+ continue;
2023
+ }
2020
2024
  if (m.role !== "user" && m.role !== "assistant") {
2021
2025
  throw new AnthropicRequestValidationError(`Invalid message role "${m.role}".`);
2022
2026
  }
package/dist/index.mjs CHANGED
@@ -1932,6 +1932,10 @@ function anthropicMessagesCreateToOpenAI(body) {
1932
1932
  messages.push(...systemToOpenAiMessages(body.system));
1933
1933
  }
1934
1934
  for (const m of body.messages) {
1935
+ if (m.role === "system") {
1936
+ messages.push(...systemToOpenAiMessages(m.content));
1937
+ continue;
1938
+ }
1935
1939
  if (m.role !== "user" && m.role !== "assistant") {
1936
1940
  throw new AnthropicRequestValidationError(`Invalid message role "${m.role}".`);
1937
1941
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  },
5
5
  "homepage": "https://github.com/premai-io/api-sdk-ts",
6
6
  "name": "@premai/api-sdk",
7
- "version": "1.0.46",
7
+ "version": "1.0.47",
8
8
  "main": "./dist/index.cjs",
9
9
  "bin": {
10
10
  "confidential-proxy": "./dist/cli.mjs",