@promptbook/fake-llm 0.105.0-6 → 0.105.0-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.
@@ -44,7 +44,7 @@ import { NotYetImplementedCommitmentDefinition } from './_base/NotYetImplemented
44
44
  *
45
45
  * @private Use functions to access commitments instead of this array directly
46
46
  */
47
- export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseTimeCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
47
+ export declare const COMMITMENT_REGISTRY: readonly [PersonaCommitmentDefinition, PersonaCommitmentDefinition, KnowledgeCommitmentDefinition, MemoryCommitmentDefinition, MemoryCommitmentDefinition, StyleCommitmentDefinition, StyleCommitmentDefinition, RuleCommitmentDefinition, RuleCommitmentDefinition, LanguageCommitmentDefinition, LanguageCommitmentDefinition, SampleCommitmentDefinition, SampleCommitmentDefinition, FormatCommitmentDefinition, FormatCommitmentDefinition, FromCommitmentDefinition, ImportCommitmentDefinition, ImportCommitmentDefinition, ModelCommitmentDefinition, ModelCommitmentDefinition, ActionCommitmentDefinition, ActionCommitmentDefinition, ComponentCommitmentDefinition, MetaImageCommitmentDefinition, MetaColorCommitmentDefinition, MetaFontCommitmentDefinition, MetaLinkCommitmentDefinition, MetaCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, NoteCommitmentDefinition, GoalCommitmentDefinition, GoalCommitmentDefinition, InitialMessageCommitmentDefinition, UserMessageCommitmentDefinition, AgentMessageCommitmentDefinition, MessageCommitmentDefinition, MessageCommitmentDefinition, ScenarioCommitmentDefinition, ScenarioCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DeleteCommitmentDefinition, DictionaryCommitmentDefinition, OpenCommitmentDefinition, ClosedCommitmentDefinition, UseBrowserCommitmentDefinition, UseSearchEngineCommitmentDefinition, UseTimeCommitmentDefinition, UseMcpCommitmentDefinition, UseCommitmentDefinition, NotYetImplementedCommitmentDefinition<"EXPECT">, NotYetImplementedCommitmentDefinition<"BEHAVIOUR">, NotYetImplementedCommitmentDefinition<"BEHAVIOURS">, NotYetImplementedCommitmentDefinition<"AVOID">, NotYetImplementedCommitmentDefinition<"AVOIDANCE">, NotYetImplementedCommitmentDefinition<"CONTEXT">];
48
48
  /**
49
49
  * Gets a commitment definition by its type
50
50
  * @param type The commitment type to look up
@@ -72,6 +72,7 @@ export declare class Agent extends AgentLlmExecutionTools implements LlmExecutio
72
72
  */
73
73
  get parameters(): Array<BookParameter>;
74
74
  readonly agentSource: BehaviorSubject<string_book>;
75
+ private readonly teacherAgent;
75
76
  constructor(options: AgentOptions);
76
77
  /**
77
78
  * Calls the chat model with agent-specific system prompt and requirements with streaming
@@ -2,6 +2,7 @@ import type { string_book } from '../../book-2.0/agent-source/string_book';
2
2
  import type { CommonToolsOptions } from '../../execution/CommonToolsOptions';
3
3
  import type { ExecutionTools } from '../../execution/ExecutionTools';
4
4
  import type { Updatable } from '../../types/Updatable';
5
+ import { Agent } from './Agent';
5
6
  /**
6
7
  * Options for creating an Agent
7
8
  */
@@ -16,4 +17,10 @@ export type AgentOptions = CommonToolsOptions & {
16
17
  * The source of the agent
17
18
  */
18
19
  agentSource: Updatable<string_book>;
20
+ /**
21
+ * Teacher agent for self-learning
22
+ *
23
+ * Note: If provided, the agent can do full self-learning from the teacher agent during its operation.
24
+ */
25
+ teacherAgent: Agent | null;
19
26
  };
@@ -3,7 +3,7 @@ import type { string_agent_url } from '../../types/typeAliases';
3
3
  /**
4
4
  * Options for creating a Remote Agent
5
5
  */
6
- export type RemoteAgentOptions = CommonToolsOptions & {
6
+ export type RemoteAgentOptions = Omit<CommonToolsOptions, 'teacherAgent'> & {
7
7
  /**
8
8
  * Url of the remote agent
9
9
  */
@@ -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.105.0-5`).
18
+ * It follows semantic versioning (e.g., `0.105.0-6`).
19
19
  *
20
20
  * @generated
21
21
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/fake-llm",
3
- "version": "0.105.0-6",
3
+ "version": "0.105.0-7",
4
4
  "description": "Promptbook: Turn your company's scattered knowledge into AI ready books",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -96,7 +96,7 @@
96
96
  "module": "./esm/index.es.js",
97
97
  "typings": "./esm/typings/src/_packages/fake-llm.index.d.ts",
98
98
  "peerDependencies": {
99
- "@promptbook/core": "0.105.0-6"
99
+ "@promptbook/core": "0.105.0-7"
100
100
  },
101
101
  "dependencies": {
102
102
  "crypto": "1.0.1",
package/umd/index.umd.js CHANGED
@@ -22,7 +22,7 @@
22
22
  * @generated
23
23
  * @see https://github.com/webgptorg/promptbook
24
24
  */
25
- const PROMPTBOOK_ENGINE_VERSION = '0.105.0-6';
25
+ const PROMPTBOOK_ENGINE_VERSION = '0.105.0-7';
26
26
  /**
27
27
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
28
28
  * Note: [💞] Ignore a discrepancy between file name and entity name
@@ -2777,6 +2777,16 @@
2777
2777
  trimmedText = spaceTrim$1.spaceTrim(trimmedText);
2778
2778
  }
2779
2779
  let processedText = trimmedText;
2780
+ // Check for markdown code block
2781
+ const codeBlockRegex = /^```[a-z]*\n([\s\S]*?)\n```\s*$/;
2782
+ const codeBlockMatch = processedText.match(codeBlockRegex);
2783
+ if (codeBlockMatch && codeBlockMatch[1] !== undefined) {
2784
+ // Check if there's only one code block
2785
+ const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
2786
+ if (codeBlockCount === 1) {
2787
+ return unwrapResult(codeBlockMatch[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
2788
+ }
2789
+ }
2780
2790
  if (isIntroduceSentenceRemoved) {
2781
2791
  const introduceSentenceRegex = /^[a-zěščřžýáíéúů:\s]*:\s*/i;
2782
2792
  if (introduceSentenceRegex.test(text)) {
@@ -2784,6 +2794,14 @@
2784
2794
  processedText = processedText.replace(introduceSentenceRegex, '');
2785
2795
  }
2786
2796
  processedText = spaceTrim$1.spaceTrim(processedText);
2797
+ // Check again for code block after removing introduce sentence
2798
+ const codeBlockMatch2 = processedText.match(codeBlockRegex);
2799
+ if (codeBlockMatch2 && codeBlockMatch2[1] !== undefined) {
2800
+ const codeBlockCount = (processedText.match(/```/g) || []).length / 2;
2801
+ if (codeBlockCount === 1) {
2802
+ return unwrapResult(codeBlockMatch2[1], { isTrimmed: false, isIntroduceSentenceRemoved: false });
2803
+ }
2804
+ }
2787
2805
  }
2788
2806
  if (processedText.length < 3) {
2789
2807
  return trimmedText;
@@ -6503,6 +6521,7 @@
6503
6521
  new NoteCommitmentDefinition('NOTES'),
6504
6522
  new NoteCommitmentDefinition('COMMENT'),
6505
6523
  new NoteCommitmentDefinition('NONCE'),
6524
+ new NoteCommitmentDefinition('TODO'),
6506
6525
  new GoalCommitmentDefinition('GOAL'),
6507
6526
  new GoalCommitmentDefinition('GOALS'),
6508
6527
  new InitialMessageCommitmentDefinition(),