@promptbook/openai 0.100.4-0 → 0.101.0-1

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 (82) hide show
  1. package/README.md +53 -1
  2. package/esm/index.es.js +17 -2
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/components.index.d.ts +4 -0
  5. package/esm/typings/src/_packages/core.index.d.ts +4 -2
  6. package/esm/typings/src/_packages/markdown-utils.index.d.ts +14 -0
  7. package/esm/typings/src/_packages/types.index.d.ts +4 -6
  8. package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +21 -0
  9. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/AgentModelRequirements.d.ts +1 -1
  10. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/AgentSourceParseResult.d.ts +3 -1
  11. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createAgentModelRequirements.d.ts +2 -2
  12. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createAgentModelRequirementsWithCommitments.d.ts +3 -3
  13. package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/createCommitmentRegex.d.ts +2 -2
  14. package/esm/typings/src/book-2.0/agent-source/extractMetaLinks.d.ts +8 -0
  15. package/esm/typings/src/book-2.0/agent-source/parseAgentSource.d.ts +4 -19
  16. package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +9 -0
  17. package/esm/typings/src/book-2.0/commitments/ACTION/ACTION.d.ts +1 -1
  18. package/esm/typings/src/book-2.0/commitments/FORMAT/FORMAT.d.ts +1 -1
  19. package/esm/typings/src/book-2.0/commitments/KNOWLEDGE/KNOWLEDGE.d.ts +1 -1
  20. package/esm/typings/src/book-2.0/commitments/META_IMAGE/META_IMAGE.d.ts +1 -1
  21. package/esm/typings/src/book-2.0/commitments/META_LINK/META_LINK.d.ts +1 -1
  22. package/esm/typings/src/book-2.0/commitments/MODEL/MODEL.d.ts +1 -1
  23. package/esm/typings/src/book-2.0/commitments/NOTE/NOTE.d.ts +1 -1
  24. package/esm/typings/src/book-2.0/commitments/PERSONA/PERSONA.d.ts +1 -1
  25. package/esm/typings/src/book-2.0/commitments/RULE/RULE.d.ts +1 -1
  26. package/esm/typings/src/book-2.0/commitments/SAMPLE/SAMPLE.d.ts +1 -1
  27. package/esm/typings/src/book-2.0/commitments/STYLE/STYLE.d.ts +1 -1
  28. package/esm/typings/src/book-2.0/commitments/_base/BaseCommitmentDefinition.d.ts +1 -1
  29. package/esm/typings/src/book-2.0/commitments/_base/CommitmentDefinition.d.ts +1 -1
  30. package/esm/typings/src/book-2.0/commitments/_base/NotYetImplementedCommitmentDefinition.d.ts +1 -1
  31. package/esm/typings/src/book-2.0/commitments/{_misc → _base}/ParsedCommitment.d.ts +1 -1
  32. package/esm/typings/src/book-2.0/commitments/_base/createEmptyAgentModelRequirements.d.ts +1 -1
  33. package/esm/typings/src/book-2.0/utils/extractAgentMetadata.d.ts +17 -0
  34. package/esm/typings/src/book-2.0/utils/extractProfileImageFromSystemMessage.d.ts +12 -0
  35. package/esm/typings/src/book-2.0/utils/generateGravatarUrl.d.ts +10 -0
  36. package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +10 -0
  37. package/esm/typings/src/book-components/AvatarProfile/AvatarChip/AvatarChip.d.ts +1 -1
  38. package/esm/typings/src/book-components/AvatarProfile/AvatarProfile/AvatarProfile.d.ts +2 -8
  39. package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +6 -0
  40. package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
  41. package/esm/typings/src/book-components/Chat/types/ChatParticipant.d.ts +1 -1
  42. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
  43. package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
  44. package/esm/typings/src/llm-providers/_common/profiles/llmProviderProfiles.d.ts +1 -1
  45. package/esm/typings/src/utils/expectation-counters/countCharacters.d.ts +2 -1
  46. package/esm/typings/src/utils/expectation-counters/countLines.d.ts +2 -1
  47. package/esm/typings/src/utils/expectation-counters/countPages.d.ts +2 -1
  48. package/esm/typings/src/utils/expectation-counters/countParagraphs.d.ts +2 -1
  49. package/esm/typings/src/utils/expectation-counters/countSentences.d.ts +1 -0
  50. package/esm/typings/src/utils/expectation-counters/countWords.d.ts +3 -1
  51. package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
  52. package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +13 -0
  53. package/esm/typings/src/utils/markdown/humanizeAiText.test.d.ts +1 -0
  54. package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +13 -0
  55. package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +13 -0
  56. package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +13 -0
  57. package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +13 -0
  58. package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
  59. package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +12 -0
  60. package/esm/typings/src/utils/markdown/promptbookifyAiText.test.d.ts +1 -0
  61. package/esm/typings/src/utils/markdown/removeMarkdownLinks.d.ts +11 -0
  62. package/esm/typings/src/utils/markdown/removeMarkdownLinks.test.d.ts +4 -0
  63. package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
  64. package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
  65. package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
  66. package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
  67. package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
  68. package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
  69. package/esm/typings/src/utils/parseNumber.d.ts +1 -0
  70. package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
  71. package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
  72. package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
  73. package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
  74. package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
  75. package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
  76. package/esm/typings/src/version.d.ts +1 -1
  77. package/package.json +2 -2
  78. package/umd/index.umd.js +17 -2
  79. package/umd/index.umd.js.map +1 -1
  80. package/esm/typings/src/book-2.0/commitments/_misc/parseAgentSourceWithCommitments.d.ts +0 -24
  81. package/esm/typings/src/book-2.0/utils/profileImageUtils.d.ts +0 -39
  82. /package/esm/typings/src/book-2.0/{commitments/_misc → agent-source}/removeCommentsFromSystemMessage.d.ts +0 -0
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Removes Markdown link tags from a string.
3
+ *
4
+ * @param {string} str - The string to remove Markdown tags from.
5
+ * @returns {string} The input string with all Markdown tags removed.
6
+ * @public exported from `@promptbook/markdown-utils`
7
+ */
8
+ export declare function removeMarkdownLinks(str: string): string;
9
+ /**
10
+ * @see https://chat.openai.com/chat/bb7c3a5b-fe9c-4ccc-9057-f47e0fd66489
11
+ */
@@ -0,0 +1,4 @@
1
+ export {};
2
+ /**
3
+ * @see https://chat.openai.com/chat/bb7c3a5b-fe9c-4ccc-9057-f47e0fd66489
4
+ */
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Makes first letter of a string uppercase
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @public exported from `@promptbook/utils`
5
7
  */
6
8
  export declare function capitalize(word: string): string;
@@ -1,5 +1,7 @@
1
1
  /**
2
- * Makes first letter of a string uppercase
2
+ * Makes first letter of a string lowercase
3
+ *
4
+ * Note: [🔂] This function is idempotent.
3
5
  *
4
6
  * @public exported from `@promptbook/utils`
5
7
  */
@@ -9,6 +9,8 @@ export type string_SCREAMING_CASE = string;
9
9
  /**
10
10
  * Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
11
11
  *
12
+ * Note: [🔂] This function is idempotent.
13
+ *
12
14
  * @param text The text string to be converted to SCREAMING_CASE format.
13
15
  * @returns The normalized text in SCREAMING_CASE format.
14
16
  * @example 'HELLO_WORLD'
@@ -8,6 +8,8 @@ export type string_snake_case = string;
8
8
  /**
9
9
  * Normalizes a text string to snake_case format.
10
10
  *
11
+ * Note: [🔂] This function is idempotent.
12
+ *
11
13
  * @param text The text string to be converted to snake_case format.
12
14
  * @returns The normalized text in snake_case format.
13
15
  * @example 'hello_world'
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Take every whitespace (space, new line, tab) and replace it with a single space
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @public exported from `@promptbook/utils`
5
7
  */
6
8
  export declare function normalizeWhitespaces(sentence: string): string;
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Removes diacritic marks (accents) from characters in a string.
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @param input The string containing diacritics to be normalized.
5
7
  * @returns The string with diacritics removed or normalized.
6
8
  * @public exported from `@promptbook/utils`
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Function parseNumber will parse number from string
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
4
5
  * Unlike Number.parseInt, Number.parseFloat it will never ever result in NaN
5
6
  * Note: it also works only with decimal numbers
6
7
  *
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * Removes emojis from a string and fix whitespaces
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
5
+ *
4
6
  * @param text with emojis
5
7
  * @returns text without emojis
6
8
  * @public exported from `@promptbook/utils`
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Removes quotes from a string
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
4
5
  * Tip: This is very useful for post-processing of the result of the LLM model
5
6
  * Note: This function removes only the same quotes from the beginning and the end of the string
6
7
  * Note: There are two similar functions:
@@ -2,6 +2,7 @@ import type { WritableDeep } from 'type-fest';
2
2
  /**
3
3
  * Creates a deep clone of the given object
4
4
  *
5
+ * Note: [🔂] This function is idempotent.
5
6
  * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
6
7
  *
7
8
  * @param objectValue The object to clone.
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Function trimCodeBlock will trim starting and ending code block from the string if it is present.
3
3
  *
4
+ * Note: [🔂] This function is idempotent.
4
5
  * Note: This is useful for post-processing of the result of the chat LLM model
5
6
  * when the model wraps the result in the (markdown) code block.
6
7
  *
@@ -3,6 +3,7 @@ import type { really_unknown } from '../../organization/really_unknown';
3
3
  /**
4
4
  * Tests if given string is valid URL.
5
5
  *
6
+ * Note: [🔂] This function is idempotent.
6
7
  * Note: Dataurl are considered perfectly valid.
7
8
  * Note: There are two similar functions:
8
9
  * - `isValidUrl` which tests any URL
@@ -3,6 +3,8 @@ import type { really_unknown } from '../../organization/really_unknown';
3
3
  /**
4
4
  * Checks if value is valid uuid
5
5
  *
6
+ * Note: [🔂] This function is idempotent.
7
+ *
6
8
  * @public exported from `@promptbook/utils`
7
9
  */
8
10
  export declare function isValidUuid(value: really_unknown): value is string_uuid;
@@ -15,7 +15,7 @@ export declare const BOOK_LANGUAGE_VERSION: string_semantic_version;
15
15
  export declare const PROMPTBOOK_ENGINE_VERSION: string_promptbook_version;
16
16
  /**
17
17
  * Represents the version string of the Promptbook engine.
18
- * It follows semantic versioning (e.g., `0.100.3-0`).
18
+ * It follows semantic versioning (e.g., `0.101.0-0`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.100.4-0",
3
+ "version": "0.101.0-1",
4
4
  "description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -102,7 +102,7 @@
102
102
  "module": "./esm/index.es.js",
103
103
  "typings": "./esm/typings/src/_packages/openai.index.d.ts",
104
104
  "peerDependencies": {
105
- "@promptbook/core": "0.100.4-0"
105
+ "@promptbook/core": "0.101.0-1"
106
106
  },
107
107
  "dependencies": {
108
108
  "bottleneck": "^2.19.5",
package/umd/index.umd.js CHANGED
@@ -25,7 +25,7 @@
25
25
  * @generated
26
26
  * @see https://github.com/webgptorg/promptbook
27
27
  */
28
- const PROMPTBOOK_ENGINE_VERSION = '0.100.4-0';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.101.0-1';
29
29
  /**
30
30
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
31
31
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -600,6 +600,7 @@
600
600
  /**
601
601
  * Creates a deep clone of the given object
602
602
  *
603
+ * Note: [🔂] This function is idempotent.
603
604
  * Note: This method only works for objects that are fully serializable to JSON and do not contain functions, Dates, or special types.
604
605
  *
605
606
  * @param objectValue The object to clone.
@@ -937,7 +938,7 @@
937
938
  };
938
939
  /**
939
940
  * TODO: Refactor this - each profile must be alongside the provider definition
940
- * TODO: [🕛] Unite `AvatarProfileProps`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
941
+ * TODO: [🕛] Unite `AgentBasicInformation`, `ChatParticipant`, `LlmExecutionTools` + `LlmToolsMetadata`
941
942
  * Note: [💞] Ignore a discrepancy between file name and entity name
942
943
  */
943
944
 
@@ -957,6 +958,7 @@
957
958
  }
958
959
  /**
959
960
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
961
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
960
962
  */
961
963
 
962
964
  /**
@@ -991,6 +993,7 @@
991
993
  }
992
994
  /**
993
995
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
996
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
994
997
  */
995
998
 
996
999
  /**
@@ -1005,6 +1008,7 @@
1005
1008
  }
1006
1009
  /**
1007
1010
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
1011
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
1008
1012
  */
1009
1013
 
1010
1014
  /**
@@ -1017,6 +1021,7 @@
1017
1021
  }
1018
1022
  /**
1019
1023
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
1024
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
1020
1025
  */
1021
1026
 
1022
1027
  /**
@@ -1037,6 +1042,7 @@
1037
1042
  }
1038
1043
  /**
1039
1044
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
1045
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
1040
1046
  */
1041
1047
 
1042
1048
  const defaultDiacriticsRemovalMap = [
@@ -1286,6 +1292,8 @@
1286
1292
  /**
1287
1293
  * Removes diacritic marks (accents) from characters in a string.
1288
1294
  *
1295
+ * Note: [🔂] This function is idempotent.
1296
+ *
1289
1297
  * @param input The string containing diacritics to be normalized.
1290
1298
  * @returns The string with diacritics removed or normalized.
1291
1299
  * @public exported from `@promptbook/utils`
@@ -1314,6 +1322,8 @@
1314
1322
  }
1315
1323
  /**
1316
1324
  * TODO: [🥴] Implement counting in formats - like JSON, CSV, XML,...
1325
+ * TODO: [🧠][✌️] Make some Promptbook-native token system
1326
+ * TODO: [✌️] `countWords` should be just `splitWords(...).length`, and all other counters should use this pattern as well
1317
1327
  */
1318
1328
 
1319
1329
  /**
@@ -2938,6 +2948,7 @@
2938
2948
  /**
2939
2949
  * Tests if given string is valid URL.
2940
2950
  *
2951
+ * Note: [🔂] This function is idempotent.
2941
2952
  * Note: Dataurl are considered perfectly valid.
2942
2953
  * Note: There are two similar functions:
2943
2954
  * - `isValidUrl` which tests any URL
@@ -3268,6 +3279,8 @@
3268
3279
  /**
3269
3280
  * Normalizes a text string to SCREAMING_CASE (all uppercase with underscores).
3270
3281
  *
3282
+ * Note: [🔂] This function is idempotent.
3283
+ *
3271
3284
  * @param text The text string to be converted to SCREAMING_CASE format.
3272
3285
  * @returns The normalized text in SCREAMING_CASE format.
3273
3286
  * @example 'HELLO_WORLD'
@@ -3323,6 +3336,8 @@
3323
3336
  /**
3324
3337
  * Normalizes a text string to snake_case format.
3325
3338
  *
3339
+ * Note: [🔂] This function is idempotent.
3340
+ *
3326
3341
  * @param text The text string to be converted to snake_case format.
3327
3342
  * @returns The normalized text in snake_case format.
3328
3343
  * @example 'hello_world'