@promptbook/openai 0.71.0-0 → 0.72.0-0

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 (76) hide show
  1. package/README.md +6 -5
  2. package/esm/index.es.js +244 -20
  3. package/esm/index.es.js.map +1 -1
  4. package/esm/typings/src/_packages/core.index.d.ts +5 -11
  5. package/esm/typings/src/_packages/openai.index.d.ts +4 -0
  6. package/esm/typings/src/_packages/types.index.d.ts +2 -12
  7. package/esm/typings/src/_packages/utils.index.d.ts +4 -4
  8. package/esm/typings/src/commands/FOREACH/ForeachCommand.d.ts +2 -3
  9. package/esm/typings/src/commands/FOREACH/foreachCommandParser.d.ts +1 -1
  10. package/esm/typings/src/commands/_common/types/CommandParser.d.ts +1 -16
  11. package/esm/typings/src/config.d.ts +1 -14
  12. package/esm/typings/src/conversion/prettify/renderPipelineMermaidOptions.d.ts +0 -3
  13. package/esm/typings/src/conversion/utils/extractParameterNamesFromTemplate.d.ts +1 -2
  14. package/esm/typings/src/conversion/validation/validatePipeline.d.ts +0 -5
  15. package/esm/typings/src/execution/PipelineExecutorResult.d.ts +8 -9
  16. package/esm/typings/src/execution/createPipelineExecutor.d.ts +72 -0
  17. package/esm/typings/src/execution/translation/automatic-translate/automatic-translators/LindatAutomaticTranslator.d.ts +1 -1
  18. package/esm/typings/src/execution/utils/addUsage.d.ts +0 -56
  19. package/esm/typings/src/execution/utils/checkExpectations.d.ts +0 -2
  20. package/esm/typings/src/execution/utils/usage-constants.d.ts +127 -0
  21. package/esm/typings/src/execution/utils/usageToHuman.d.ts +4 -3
  22. package/esm/typings/src/formats/_common/FormatDefinition.d.ts +15 -14
  23. package/esm/typings/src/formats/csv/{CsvFormatDefinition.d.ts → ListFormatDefinition.d.ts} +3 -6
  24. package/esm/typings/src/formats/index.d.ts +1 -1
  25. package/esm/typings/src/formats/json/JsonFormatDefinition.d.ts +3 -4
  26. package/esm/typings/src/formats/list/ListFormatDefinition.d.ts +16 -0
  27. package/esm/typings/src/formats/xml/XmlFormatDefinition.d.ts +3 -4
  28. package/esm/typings/src/knowledge/dialogs/callback/CallbackInterfaceTools.d.ts +1 -1
  29. package/esm/typings/src/knowledge/dialogs/simple-prompt/SimplePromptInterfaceTools.d.ts +1 -1
  30. package/esm/typings/src/llm-providers/anthropic-claude/AnthropicClaudeExecutionTools.d.ts +3 -2
  31. package/esm/typings/src/llm-providers/azure-openai/AzureOpenAiExecutionTools.d.ts +3 -2
  32. package/esm/typings/src/llm-providers/mocked/MockedEchoLlmExecutionTools.d.ts +1 -1
  33. package/esm/typings/src/llm-providers/mocked/MockedFackedLlmExecutionTools.d.ts +1 -1
  34. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +37 -0
  35. package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionToolsOptions.d.ts +14 -0
  36. package/esm/typings/src/llm-providers/openai/OpenAiExecutionTools.d.ts +3 -2
  37. package/esm/typings/src/llm-providers/remote/RemoteLlmExecutionTools.d.ts +1 -1
  38. package/esm/typings/src/scripting/javascript/JavascriptEvalExecutionTools.d.ts +1 -1
  39. package/esm/typings/src/scripting/python/PythonExecutionTools.d.ts +1 -1
  40. package/esm/typings/src/scripting/typescript/TypescriptExecutionTools.d.ts +1 -1
  41. package/esm/typings/src/storage/files-storage/FilesStorage.d.ts +1 -1
  42. package/esm/typings/src/types/PipelineJson/KnowledgeSourceJson.d.ts +2 -9
  43. package/esm/typings/src/types/PipelineJson/ParameterJson.d.ts +0 -1
  44. package/esm/typings/src/types/PipelineJson/TemplateJsonCommon.d.ts +0 -5
  45. package/esm/typings/src/types/execution-report/ExecutionReportJson.d.ts +0 -3
  46. package/esm/typings/src/utils/expectation-counters/index.d.ts +0 -3
  47. package/esm/typings/src/utils/{parameters/extractParameterNames.d.ts → extractParameterNames.d.ts} +2 -2
  48. package/esm/typings/src/utils/organization/{empty_object.d.ts → f.d.ts} +1 -5
  49. package/esm/typings/src/utils/{parameters/replaceParameters.d.ts → replaceParameters.d.ts} +2 -2
  50. package/package.json +13 -17
  51. package/umd/index.umd.js +244 -19
  52. package/umd/index.umd.js.map +1 -1
  53. package/esm/typings/src/commands/FOREACH/ForeachJson.d.ts +0 -23
  54. package/esm/typings/src/execution/createPipelineExecutor/$OngoingTemplateResult.d.ts +0 -45
  55. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorOptions.d.ts +0 -20
  56. package/esm/typings/src/execution/createPipelineExecutor/00-CreatePipelineExecutorSettings.d.ts +0 -40
  57. package/esm/typings/src/execution/createPipelineExecutor/00-createPipelineExecutor.d.ts +0 -10
  58. package/esm/typings/src/execution/createPipelineExecutor/10-executePipeline.d.ts +0 -55
  59. package/esm/typings/src/execution/createPipelineExecutor/20-executeTemplate.d.ts +0 -62
  60. package/esm/typings/src/execution/createPipelineExecutor/30-executeFormatCells.d.ts +0 -19
  61. package/esm/typings/src/execution/createPipelineExecutor/40-executeAttempts.d.ts +0 -74
  62. package/esm/typings/src/execution/createPipelineExecutor/filterJustOutputParameters.d.ts +0 -34
  63. package/esm/typings/src/execution/createPipelineExecutor/getContextForTemplate.d.ts +0 -10
  64. package/esm/typings/src/execution/createPipelineExecutor/getKnowledgeForTemplate.d.ts +0 -27
  65. package/esm/typings/src/execution/createPipelineExecutor/getReservedParametersForTemplate.d.ts +0 -30
  66. package/esm/typings/src/execution/createPipelineExecutor/getSamplesForTemplate.d.ts +0 -10
  67. package/esm/typings/src/formats/_common/FormatSubvalueDefinition.d.ts +0 -30
  68. package/esm/typings/src/formats/csv/CsvSettings.d.ts +0 -13
  69. package/esm/typings/src/formats/text/TextFormatDefinition.d.ts +0 -19
  70. package/esm/typings/src/utils/organization/just_empty_object.d.ts +0 -12
  71. package/esm/typings/src/utils/parameters/mapAvailableToExpectedParameters.d.ts +0 -27
  72. package/esm/typings/src/utils/validators/parameterName/validateParameterName.d.ts +0 -10
  73. package/esm/typings/src/utils/validators/parameterName/validateParameterName.test.d.ts +0 -1
  74. /package/esm/typings/src/{utils/parameters/extractParameterNames.test.d.ts → execution/utils/usageToHuman.test.d.ts} +0 -0
  75. /package/esm/typings/src/utils/{parameters/mapAvailableToExpectedParameters.test.d.ts → extractParameterNames.test.d.ts} +0 -0
  76. /package/esm/typings/src/utils/{parameters/replaceParameters.test.d.ts → replaceParameters.test.d.ts} +0 -0
@@ -7,10 +7,11 @@ import type { PromptResultUsage } from '../PromptResultUsage';
7
7
  */
8
8
  export declare function usageToHuman(usage: PromptResultUsage): string_markdown;
9
9
  /**
10
- * TODO: [🍓][🧞‍♂️] Use "$1" not "1 USD"
11
- * TODO: [🍓][🧞‍♂️] Use markdown formatting like "Cost approximately **$1**"
12
- * TODO: [🍓][🧞‍♂️] Report in minutes, seconds, days NOT 0.1 hours
10
+ * TODO: Use "$1" not "1 USD"
11
+ * TODO: Use markdown formatting like "Cost approximately **$1**"
12
+ * TODO: Report in minutes, seconds, days NOT 0.1 hours
13
13
  * TODO: [🧠] Maybe make from `uncertainNumberToHuman` separate exported utility
14
+ * TODO: When negligible usage, report "Negligible" or just don't report it
14
15
  * TODO: [🧠] Maybe use "~" instead of "approximately"
15
16
  * TODO: [🏛] Maybe make some markdown builder
16
17
  */
@@ -1,27 +1,22 @@
1
1
  import type { string_mime_type } from '../../types/typeAliases';
2
2
  import type { string_name } from '../../types/typeAliases';
3
- import type { string_SCREAMING_CASE } from '../../utils/normalization/normalizeTo_SCREAMING_CASE';
4
- import type { empty_object } from '../../utils/organization/empty_object';
5
- import type { FormatSubvalueDefinition } from './FormatSubvalueDefinition';
6
3
  /**
7
4
  * A format definition is a set of functions that define how to validate, heal and convert response from LLM
8
5
  *
9
- * @@@ Describe setting vs schema
10
- *
11
6
  * @see https://github.com/webgptorg/promptbook/discussions/36
12
7
  * @private still in development [🏢]
13
8
  */
14
- export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends string, TSettings extends empty_object, TSchema extends empty_object> = {
9
+ export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends string, TSchema extends object> = {
15
10
  /**
16
11
  * The name of the format used in .ptbk.md files
17
12
  *
18
13
  * @sample "JSON"
19
14
  */
20
- readonly formatName: string_name & string_SCREAMING_CASE;
15
+ readonly name: string_name;
21
16
  /**
22
- * Aliases for the `formatName`
17
+ * Aliases for the name
23
18
  */
24
- readonly aliases?: Array<string_name & string_SCREAMING_CASE>;
19
+ readonly aliases?: Array<string_name>;
25
20
  /**
26
21
  * The mime type of the format (if any)
27
22
  *
@@ -34,7 +29,7 @@ export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends
34
29
  * @param value The value to check, for example "{\"foo\": true}"
35
30
  * @param schema Optional schema to do extra validation
36
31
  */
37
- isValid(value: string, settings?: TSettings, schema?: TSchema): value is TValue;
32
+ isValid(value: string, schema?: TSchema): value is TValue;
38
33
  /**
39
34
  * Check if a first part of a value is valid
40
35
  *
@@ -43,7 +38,7 @@ export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends
43
38
  * @param partialValue Partial value to check, for example "{\"foo\": t"
44
39
  * @param schema Optional schema to do extra validation
45
40
  */
46
- canBeValid(partialValue: string, settings?: TSettings, schema?: TSchema): partialValue is TPartialValue;
41
+ canBeValid(partialValue: string, schema?: TSchema): partialValue is TPartialValue;
47
42
  /**
48
43
  * Heal a value to make it valid if possible
49
44
  *
@@ -54,11 +49,17 @@ export type FormatDefinition<TValue extends TPartialValue, TPartialValue extends
54
49
  * @param scheme
55
50
  * @throws {Error} If the value cannot be healed
56
51
  */
57
- heal(value: string, settings?: TSettings, scheme?: TSchema): TValue;
52
+ heal(value: string, scheme?: TSchema): TValue;
58
53
  /**
59
- * @@@
54
+ * Parses just the values and removes structural information
55
+ *
56
+ * Note: This is useful when you want to combine format expectations with counting words, characters,...
57
+ *
58
+ * @param value The value to check, for example "{\"name\": "John Smith"}"
59
+ * @param schema Optional schema
60
+ * @example "{\"name\": "John Smith"}" -> ["John Smith"]
60
61
  */
61
- readonly subvalueDefinitions: Array<FormatSubvalueDefinition<TValue, TSettings>>;
62
+ extractValues(value: string, schema?: TSchema): Array<string>;
62
63
  };
63
64
  /**
64
65
  * TODO: [♏] Add some prepare hook to modify prompt according to the format
@@ -1,17 +1,14 @@
1
- import type { TODO_any } from '../../utils/organization/TODO_any';
2
1
  import type { FormatDefinition } from '../_common/FormatDefinition';
3
- import type { CsvSettings } from './CsvSettings';
4
2
  /**
5
3
  * Definition for CSV spreadsheet
6
4
  *
7
- * @public exported from `@promptbook/core`
8
- * <- TODO: [🏢] Export from package `@promptbook/csv`
5
+ * @private still in development [🏢]
9
6
  */
10
- export declare const CsvFormatDefinition: FormatDefinition<string, string, CsvSettings, TODO_any>;
7
+ export declare const CsvFormatDefinition: FormatDefinition<string, string, object>;
11
8
  /**
12
9
  * TODO: [🍓] In `CsvFormatDefinition` implement simple `isValid`
13
10
  * TODO: [🍓] In `CsvFormatDefinition` implement partial `canBeValid`
14
11
  * TODO: [🍓] In `CsvFormatDefinition` implement `heal
15
- * TODO: [🍓] In `CsvFormatDefinition` implement `subvalueDefinitions`
12
+ * TODO: [🍓] In `CsvFormatDefinition` implement `extractValues`
16
13
  * TODO: [🏢] Allow to expect something inside CSV objects and other formats
17
14
  */
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * @private internal index of `...` <- TODO [🏢]
5
5
  */
6
- export declare const FORMAT_DEFINITIONS: readonly [import("./_common/FormatDefinition").FormatDefinition<string, string, any, any>, import("./_common/FormatDefinition").FormatDefinition<string, string, any, any>, import("./_common/FormatDefinition").FormatDefinition<string, string, any, any>, import("./_common/FormatDefinition").FormatDefinition<string, string, import("./csv/CsvSettings").CsvSettings, any>];
6
+ export declare const FORMAT_DEFINITIONS: import("./_common/FormatDefinition").FormatDefinition<string, string, object>[];
@@ -1,19 +1,18 @@
1
- import type { TODO_any } from '../../utils/organization/TODO_any';
2
1
  import type { FormatDefinition } from '../_common/FormatDefinition';
3
2
  /**
4
3
  * Definition for JSON format
5
4
  *
6
5
  * @private still in development [🏢]
7
6
  */
8
- export declare const JsonFormatDefinition: FormatDefinition<string, string, TODO_any, TODO_any>;
7
+ export declare const JsonFormatDefinition: FormatDefinition<string, string, object>;
9
8
  /**
10
9
  * TODO: [🧠] Maybe propper instance of object
11
10
  * TODO: [0] Make string_serialized_json
12
- * TODO: [1] Make type for JSON Settings and Schema
11
+ * TODO: [1] Make type for JSON Schema
13
12
  * TODO: [🧠] What to use for validating JSONs - JSON Schema, ZoD, typescript types/interfaces,...?
14
13
  * TODO: [🍓] In `JsonFormatDefinition` implement simple `isValid`
15
14
  * TODO: [🍓] In `JsonFormatDefinition` implement partial `canBeValid`
16
15
  * TODO: [🍓] In `JsonFormatDefinition` implement `heal
17
- * TODO: [🍓] In `JsonFormatDefinition` implement `subvalueDefinitions`
16
+ * TODO: [🍓] In `JsonFormatDefinition` implement `extractValues`
18
17
  * TODO: [🏢] Allow to expect something inside JSON objects and other formats
19
18
  */
@@ -0,0 +1,16 @@
1
+ import type { FormatDefinition } from '../_common/FormatDefinition';
2
+ /**
3
+ * Definition for list of multiple items
4
+ *
5
+ * Note: list is just a string with multiple lines or multiple items separated by comma
6
+ *
7
+ * @private still in development [🏢]
8
+ */
9
+ export declare const ListFormatDefinition: FormatDefinition<string, string, object>;
10
+ /**
11
+ * TODO: [🍓] In `ListFormatDefinition` implement simple `isValid`
12
+ * TODO: [🍓] In `ListFormatDefinition` implement partial `canBeValid`
13
+ * TODO: [🍓] In `ListFormatDefinition` implement `heal
14
+ * TODO: [🍓] In `ListFormatDefinition` implement `extractValues`
15
+ * TODO: [🏢] Allow to expect something inside each item of list and other formats
16
+ */
@@ -1,19 +1,18 @@
1
- import type { TODO_any } from '../../utils/organization/TODO_any';
2
1
  import type { FormatDefinition } from '../_common/FormatDefinition';
3
2
  /**
4
3
  * Definition for XML format
5
4
  *
6
5
  * @private still in development [🏢]
7
6
  */
8
- export declare const XmlFormatDefinition: FormatDefinition<string, string, TODO_any, TODO_any>;
7
+ export declare const XmlFormatDefinition: FormatDefinition<string, string, object>;
9
8
  /**
10
9
  * TODO: [🧠] Maybe propper instance of object
11
10
  * TODO: [0] Make string_serialized_xml
12
- * TODO: [1] Make type for XML Settings and Schema
11
+ * TODO: [1] Make type for XML Schema
13
12
  * TODO: [🧠] What to use for validating XMLs - XSD,...
14
13
  * TODO: [🍓] In `XmlFormatDefinition` implement simple `isValid`
15
14
  * TODO: [🍓] In `XmlFormatDefinition` implement partial `canBeValid`
16
15
  * TODO: [🍓] In `XmlFormatDefinition` implement `heal
17
- * TODO: [🍓] In `XmlFormatDefinition` implement `subvalueDefinitions`
16
+ * TODO: [🍓] In `XmlFormatDefinition` implement `extractValues`
18
17
  * TODO: [🏢] Allow to expect something inside XML and other formats
19
18
  */
@@ -8,7 +8,7 @@ import type { CallbackInterfaceToolsOptions } from './CallbackInterfaceToolsOpti
8
8
  * @public exported from `@promptbook/core`
9
9
  */
10
10
  export declare class CallbackInterfaceTools implements UserInterfaceTools {
11
- private readonly options;
11
+ protected readonly options: CallbackInterfaceToolsOptions;
12
12
  constructor(options: CallbackInterfaceToolsOptions);
13
13
  /**
14
14
  * Trigger the custom callback function
@@ -10,7 +10,7 @@ import type { UserInterfaceToolsPromptDialogOptions } from '../../../execution/U
10
10
  * @public exported from `@promptbook/browser`
11
11
  */
12
12
  export declare class SimplePromptInterfaceTools implements UserInterfaceTools {
13
- private readonly options;
13
+ protected readonly options: CommonExecutionToolsOptions;
14
14
  constructor(options?: CommonExecutionToolsOptions);
15
15
  /**
16
16
  * Trigger window.DIALOG TEMPLATE
@@ -1,3 +1,4 @@
1
+ import Anthropic from '@anthropic-ai/sdk';
1
2
  import type { AvailableModel } from '../../execution/AvailableModel';
2
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
4
  import type { ChatPromptResult } from '../../execution/PromptResult';
@@ -13,7 +14,7 @@ import type { AnthropicClaudeExecutionToolsDirectOptions } from './AnthropicClau
13
14
  * @deprecated use `createAnthropicClaudeExecutionTools` instead
14
15
  */
15
16
  export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools {
16
- private readonly options;
17
+ protected readonly options: AnthropicClaudeExecutionToolsDirectOptions;
17
18
  /**
18
19
  * Anthropic Claude API client.
19
20
  */
@@ -26,7 +27,7 @@ export declare class AnthropicClaudeExecutionTools implements LlmExecutionTools
26
27
  constructor(options?: AnthropicClaudeExecutionToolsDirectOptions);
27
28
  get title(): string_title & string_markdown_text;
28
29
  get description(): string_markdown;
29
- private getClient;
30
+ getClient(): Promise<Anthropic>;
30
31
  /**
31
32
  * Check the `options` passed to `constructor`
32
33
  */
@@ -1,3 +1,4 @@
1
+ import { OpenAIClient } from '@azure/openai';
1
2
  import type { AvailableModel } from '../../execution/AvailableModel';
2
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
4
  import type { ChatPromptResult } from '../../execution/PromptResult';
@@ -13,7 +14,7 @@ import type { AzureOpenAiExecutionToolsOptions } from './AzureOpenAiExecutionToo
13
14
  * @public exported from `@promptbook/azure-openai`
14
15
  */
15
16
  export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
16
- private readonly options;
17
+ protected readonly options: AzureOpenAiExecutionToolsOptions;
17
18
  /**
18
19
  * OpenAI Azure API client.
19
20
  */
@@ -26,7 +27,7 @@ export declare class AzureOpenAiExecutionTools implements LlmExecutionTools {
26
27
  constructor(options: AzureOpenAiExecutionToolsOptions);
27
28
  get title(): string_title & string_markdown_text;
28
29
  get description(): string_markdown;
29
- private getClient;
30
+ getClient(): Promise<OpenAIClient>;
30
31
  /**
31
32
  * Check the `options` passed to `constructor`
32
33
  */
@@ -13,7 +13,7 @@ import type { string_title } from '../../types/typeAliases';
13
13
  * @public exported from `@promptbook/fake-llm`
14
14
  */
15
15
  export declare class MockedEchoLlmExecutionTools implements LlmExecutionTools {
16
- private readonly options;
16
+ protected readonly options: CommonExecutionToolsOptions;
17
17
  constructor(options?: CommonExecutionToolsOptions);
18
18
  get title(): string_title & string_markdown_text;
19
19
  get description(): string_markdown;
@@ -14,7 +14,7 @@ import type { string_title } from '../../types/typeAliases';
14
14
  * @public exported from `@promptbook/fake-llm`
15
15
  */
16
16
  export declare class MockedFackedLlmExecutionTools implements LlmExecutionTools {
17
- private readonly options;
17
+ protected readonly options: CommonExecutionToolsOptions;
18
18
  constructor(options?: CommonExecutionToolsOptions);
19
19
  get title(): string_title & string_markdown_text;
20
20
  get description(): string_markdown;
@@ -0,0 +1,37 @@
1
+ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
2
+ import type { ChatPromptResult } from '../../execution/PromptResult';
3
+ import type { Prompt } from '../../types/Prompt';
4
+ import type { string_markdown } from '../../types/typeAliases';
5
+ import type { string_markdown_text } from '../../types/typeAliases';
6
+ import type { string_title } from '../../types/typeAliases';
7
+ import type { OpenAiAssistantExecutionToolsOptions } from './OpenAiAssistantExecutionToolsOptions';
8
+ import { OpenAiExecutionTools } from './OpenAiExecutionTools';
9
+ /**
10
+ * Execution Tools for calling OpenAI API Assistants
11
+ *
12
+ * This is usefull for calling OpenAI API with a single assistant, for more wide usage use `OpenAiExecutionTools`.
13
+ *
14
+ * @public exported from `@promptbook/openai`
15
+ */
16
+ export declare class OpenAiAssistantExecutionTools extends OpenAiExecutionTools implements LlmExecutionTools {
17
+ private readonly assistantId?;
18
+ /**
19
+ * Creates OpenAI Execution Tools.
20
+ *
21
+ * @param options which are relevant are directly passed to the OpenAI client
22
+ */
23
+ constructor(options?: OpenAiAssistantExecutionToolsOptions);
24
+ get title(): string_title & string_markdown_text;
25
+ get description(): string_markdown;
26
+ /**
27
+ * Calls OpenAI API to use a chat model.
28
+ */
29
+ callChatModel(prompt: Pick<Prompt, 'content' | 'parameters' | 'modelRequirements' | 'format'>): Promise<ChatPromptResult>;
30
+ }
31
+ /**
32
+ * TODO: !!!!!! DO not use colors - can be used in browser
33
+ * TODO: [🧠][🧙‍♂️] Maybe there can be some wizzard for thoose who want to use just OpenAI
34
+ * TODO: Maybe make custom OpenAiError
35
+ * TODO: [🧠][🈁] Maybe use `isDeterministic` from options
36
+ * TODO: [🧠][🌰] Allow to pass `title` for tracking purposes
37
+ */
@@ -0,0 +1,14 @@
1
+ import type { ClientOptions } from 'openai';
2
+ import type { string_token } from '../../types/typeAliases';
3
+ import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions';
4
+ /**
5
+ * Options for `OpenAiAssistantExecutionTools`
6
+ *
7
+ * @public exported from `@promptbook/openai`
8
+ */
9
+ export type OpenAiAssistantExecutionToolsOptions = OpenAiExecutionToolsOptions & ClientOptions & {
10
+ /**
11
+ * Which assistant to use
12
+ */
13
+ assistantId?: string_token;
14
+ };
@@ -1,3 +1,4 @@
1
+ import OpenAI from 'openai';
1
2
  import type { AvailableModel } from '../../execution/AvailableModel';
2
3
  import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';
3
4
  import type { ChatPromptResult } from '../../execution/PromptResult';
@@ -14,7 +15,7 @@ import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions'
14
15
  * @public exported from `@promptbook/openai`
15
16
  */
16
17
  export declare class OpenAiExecutionTools implements LlmExecutionTools {
17
- private readonly options;
18
+ protected readonly options: OpenAiExecutionToolsOptions;
18
19
  /**
19
20
  * OpenAI API client.
20
21
  */
@@ -27,7 +28,7 @@ export declare class OpenAiExecutionTools implements LlmExecutionTools {
27
28
  constructor(options?: OpenAiExecutionToolsOptions);
28
29
  get title(): string_title & string_markdown_text;
29
30
  get description(): string_markdown;
30
- private getClient;
31
+ getClient(): Promise<OpenAI>;
31
32
  /**
32
33
  * Check the `options` passed to `constructor`
33
34
  */
@@ -20,7 +20,7 @@ import type { RemoteLlmExecutionToolsOptions } from './interfaces/RemoteLlmExecu
20
20
  * @public exported from `@promptbook/remote-client`
21
21
  */
22
22
  export declare class RemoteLlmExecutionTools implements LlmExecutionTools {
23
- private readonly options;
23
+ protected readonly options: RemoteLlmExecutionToolsOptions;
24
24
  constructor(options: RemoteLlmExecutionToolsOptions);
25
25
  get title(): string_title & string_markdown_text;
26
26
  get description(): string_markdown;
@@ -9,7 +9,7 @@ import type { JavascriptExecutionToolsOptions } from './JavascriptExecutionTools
9
9
  * @public exported from `@promptbook/execute-javascript`
10
10
  */
11
11
  export declare class JavascriptEvalExecutionTools implements ScriptExecutionTools {
12
- private readonly options;
12
+ protected readonly options: JavascriptExecutionToolsOptions;
13
13
  constructor(options?: JavascriptExecutionToolsOptions);
14
14
  /**
15
15
  * Executes a JavaScript
@@ -9,7 +9,7 @@ import type { ScriptExecutionToolsExecuteOptions } from '../../execution/ScriptE
9
9
  * @private still in development
10
10
  */
11
11
  export declare class PythonExecutionTools implements ScriptExecutionTools {
12
- private readonly options;
12
+ protected readonly options: CommonExecutionToolsOptions;
13
13
  constructor(options?: CommonExecutionToolsOptions);
14
14
  /**
15
15
  * Executes a Python
@@ -9,7 +9,7 @@ import type { ScriptExecutionToolsExecuteOptions } from '../../execution/ScriptE
9
9
  * @private still in development
10
10
  */
11
11
  export declare class TypescriptExecutionTools implements ScriptExecutionTools {
12
- private readonly options;
12
+ protected readonly options: CommonExecutionToolsOptions;
13
13
  constructor(options?: CommonExecutionToolsOptions);
14
14
  /**
15
15
  * Executes a TypeScript
@@ -6,7 +6,7 @@ import type { FilesStorageOptions } from './FilesStorageOptions';
6
6
  * @public exported from `@promptbook/node`
7
7
  */
8
8
  export declare class FilesStorage<TItem> implements PromptbookStorage<TItem> {
9
- private readonly options;
9
+ protected readonly options: FilesStorageOptions;
10
10
  constructor(options: FilesStorageOptions);
11
11
  /**
12
12
  * @@@
@@ -11,18 +11,11 @@ import type { string_name } from '../typeAliases';
11
11
  */
12
12
  export type KnowledgeSourceJson = {
13
13
  /**
14
- * Unique identifier of the knowledge source
14
+ * @@@
15
15
  */
16
16
  readonly name: string_name;
17
17
  /**
18
- * Source of one knowledge
19
- *
20
- * It can be a link, a relative path to file or direct text or combination of those
21
- *
22
- * For example `"https://pavolhejny.com/"`
23
- * For example `"./pavol-hejny-cv.pdf"`
24
- * For example `"Pavol Hejný has web https://pavolhejny.com/"`
25
- * For example `"Pavol Hejný is web developer and creator of Promptbook and Collboard"`
18
+ * @@@
26
19
  */
27
20
  readonly sourceContent: string_knowledge_source_content;
28
21
  };
@@ -33,7 +33,6 @@ export type ParameterJson = {
33
33
  readonly sampleValues?: Array<string_parameter_value>;
34
34
  };
35
35
  /**
36
- * TODO: [🧠] !!!!!! Should be here registered subparameter from foreach or not?
37
36
  * TODO: [♈] Probbably move expectations from templates to parameters
38
37
  * TODO: [🍙] Make some standard order of json properties
39
38
  */
@@ -1,4 +1,3 @@
1
- import type { ForeachJson } from '../../commands/FOREACH/ForeachJson';
2
1
  import type { FormatCommand } from '../../commands/FORMAT/FormatCommand';
3
2
  import type { TemplateType } from '../../commands/TEMPLATE/TemplateTypes';
4
3
  import type { string_javascript } from '../typeAliases';
@@ -43,10 +42,6 @@ export interface TemplateJsonCommon {
43
42
  * @see https://github.com/webgptorg/promptbook/discussions/66
44
43
  */
45
44
  readonly jokerParameterNames?: Array<string_parameter_name>;
46
- /**
47
- * @@@
48
- */
49
- readonly foreach?: ForeachJson;
50
45
  /**
51
46
  * Type of the execution
52
47
  * This determines if the template is send to LLM, user or some scripting evaluation
@@ -39,6 +39,3 @@ export type ExecutionReportJson = {
39
39
  */
40
40
  readonly promptExecutions: Array<ExecutionPromptReportJson>;
41
41
  };
42
- /**
43
- * TODO: !!!!!! FOREACH in report
44
- */
@@ -6,6 +6,3 @@ import type { ExpectationUnit } from '../../types/PipelineJson/Expectations';
6
6
  * @public exported from `@promptbook/utils`
7
7
  */
8
8
  export declare const CountUtils: Record<ExpectationUnit, (text: string) => ExpectationAmount>;
9
- /**
10
- * TODO: [🧠][🤠] This should be probbably as part of `TextFormatDefinition`
11
- */
@@ -1,5 +1,5 @@
1
- import type { string_parameter_name } from '../../types/typeAliases';
2
- import type { string_template } from '../../types/typeAliases';
1
+ import type { string_parameter_name } from '../types/typeAliases';
2
+ import type { string_template } from '../types/typeAliases';
3
3
  /**
4
4
  * Parses the template and returns the list of all parameter names
5
5
  *
@@ -1,10 +1,6 @@
1
1
  /**
2
2
  * Organizational helper to better mark the place where to really use empty object `{}`
3
3
  *
4
- * Note: There are 2 similar types>
5
- * - `empty_object` @@@
6
- * - `just_empty_object` @@@
7
- *
8
4
  * @private within the repository
9
5
  */
10
- export type empty_object = {};
6
+ export type really_empty_object = Record<string, never>;
@@ -1,5 +1,5 @@
1
- import type { Parameters } from '../../types/typeAliases';
2
- import type { string_template } from '../../types/typeAliases';
1
+ import type { Parameters } from '../types/typeAliases';
2
+ import type { string_template } from '../types/typeAliases';
3
3
  /**
4
4
  * Replaces parameters in template with values from parameters object
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptbook/openai",
3
- "version": "0.71.0-0",
3
+ "version": "0.72.0-0",
4
4
  "description": "Supercharge your use of large language models",
5
5
  "private": false,
6
6
  "sideEffects": false,
@@ -12,25 +12,21 @@
12
12
  "Pavol Hejný <me@pavolhejny.com> (https://www.pavolhejny.com/)"
13
13
  ],
14
14
  "keywords": [
15
- "ai",
16
- "llm",
17
- "prompt",
18
- "template",
19
- "language-model",
20
- "chatgpt",
21
15
  "autogpt",
22
- "machine-learning",
23
- "natural-language-processing",
24
- "nlp",
25
16
  "openai",
26
17
  "gpt-3",
27
18
  "gpt-4",
28
- "gpt-4o",
29
- "gpt-4o-mini",
30
- "o1",
31
- "o1-mini",
32
- "o1-preview",
33
- "anthropic"
19
+ "chatgpt",
20
+ "ai",
21
+ "machine-learning",
22
+ "natural-language-processing",
23
+ "nlp",
24
+ "prompt",
25
+ "template",
26
+ "pipeline",
27
+ "automation",
28
+ "text-generation",
29
+ "language-model"
34
30
  ],
35
31
  "license": "CC-BY-4.0",
36
32
  "bugs": {
@@ -51,7 +47,7 @@
51
47
  "module": "./esm/index.es.js",
52
48
  "typings": "./esm/typings/src/_packages/openai.index.d.ts",
53
49
  "peerDependencies": {
54
- "@promptbook/core": "0.71.0-0"
50
+ "@promptbook/core": "0.72.0-0"
55
51
  },
56
52
  "dependencies": {
57
53
  "colors": "1.4.0",