@promptbook/wizard 0.102.0-4 → 0.102.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/esm/index.es.js CHANGED
@@ -36,7 +36,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
36
36
  * @generated
37
37
  * @see https://github.com/webgptorg/promptbook
38
38
  */
39
- const PROMPTBOOK_ENGINE_VERSION = '0.102.0-4';
39
+ const PROMPTBOOK_ENGINE_VERSION = '0.102.0-5';
40
40
  /**
41
41
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
42
42
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -4782,6 +4782,14 @@ class OpenAiCompatibleExecutionTools {
4782
4782
  // <- TODO: [🚸] Not all models are compatible with JSON mode
4783
4783
  // > 'response_format' of type 'json_object' is not supported with this model.
4784
4784
  const rawPromptContent = templateParameters(content, { ...parameters, modelName });
4785
+ // Convert thread to OpenAI format if present
4786
+ let threadMessages = [];
4787
+ if ('thread' in prompt && Array.isArray(prompt.thread)) {
4788
+ threadMessages = prompt.thread.map((msg) => ({
4789
+ role: msg.role === 'assistant' ? 'assistant' : 'user',
4790
+ content: msg.content,
4791
+ }));
4792
+ }
4785
4793
  const rawRequest = {
4786
4794
  ...modelSettings,
4787
4795
  messages: [
@@ -4793,6 +4801,7 @@ class OpenAiCompatibleExecutionTools {
4793
4801
  content: currentModelRequirements.systemMessage,
4794
4802
  },
4795
4803
  ]),
4804
+ ...threadMessages,
4796
4805
  {
4797
4806
  role: 'user',
4798
4807
  content: rawPromptContent,