@promptbook/types 0.101.0-0 → 0.101.0-2
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/README.md +130 -1
- package/esm/typings/src/_packages/components.index.d.ts +12 -0
- package/esm/typings/src/book-components/Chat/Chat/Chat.d.ts +0 -5
- package/esm/typings/src/book-components/Chat/Chat/ChatProps.d.ts +8 -2
- package/esm/typings/src/book-components/Chat/Chat/constants.d.ts +8 -0
- package/esm/typings/src/book-components/Chat/examples/ChatMarkdownDemo.d.ts +16 -0
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.d.ts +21 -0
- package/esm/typings/src/book-components/Chat/utils/renderMarkdown.test.d.ts +1 -0
- package/esm/typings/src/book-components/icons/ArrowIcon.d.ts +9 -0
- package/esm/typings/src/book-components/icons/ResetIcon.d.ts +6 -0
- package/esm/typings/src/book-components/icons/SendIcon.d.ts +8 -0
- package/esm/typings/src/book-components/icons/TemplateIcon.d.ts +8 -0
- package/esm/typings/src/utils/markdown/escapeMarkdownBlock.d.ts +2 -0
- package/esm/typings/src/utils/markdown/humanizeAiText.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextEllipsis.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextEmdashed.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextQuotes.d.ts +1 -0
- package/esm/typings/src/utils/markdown/humanizeAiTextWhitespace.d.ts +1 -0
- package/esm/typings/src/utils/markdown/prettifyMarkdown.d.ts +8 -0
- package/esm/typings/src/utils/markdown/promptbookifyAiText.d.ts +1 -0
- package/esm/typings/src/utils/normalization/capitalize.d.ts +2 -0
- package/esm/typings/src/utils/normalization/decapitalize.d.ts +3 -1
- package/esm/typings/src/utils/normalization/normalizeTo_SCREAMING_CASE.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeTo_snake_case.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeWhitespaces.d.ts +2 -0
- package/esm/typings/src/utils/normalization/removeDiacritics.d.ts +2 -0
- package/esm/typings/src/utils/parseNumber.d.ts +1 -0
- package/esm/typings/src/utils/removeEmojis.d.ts +2 -0
- package/esm/typings/src/utils/removeQuotes.d.ts +1 -0
- package/esm/typings/src/utils/serialization/deepClone.d.ts +1 -0
- package/esm/typings/src/utils/trimCodeBlock.d.ts +1 -0
- package/esm/typings/src/utils/validators/url/isValidUrl.d.ts +1 -0
- package/esm/typings/src/utils/validators/uuid/isValidUuid.d.ts +2 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -47,7 +47,34 @@ npm i ptbk
|
|
|
47
47
|
npm i -D @promptbook/types
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
The types package provides comprehensive TypeScript type definitions for all Promptbook entities. It enables type-safe development when working with Promptbook APIs, ensuring compile-time validation and excellent IDE support.
|
|
51
|
+
|
|
52
|
+
## 🎯 Purpose and Motivation
|
|
53
|
+
|
|
54
|
+
This package centralizes all TypeScript type definitions used throughout the Promptbook ecosystem. It enables developers to write type-safe code when working with promptbooks, pipelines, LLM providers, and other Promptbook components, providing excellent IntelliSense and compile-time error checking.
|
|
55
|
+
|
|
56
|
+
## 🔧 High-Level Functionality
|
|
57
|
+
|
|
58
|
+
The package provides type definitions for:
|
|
59
|
+
- **Pipeline Structures**: Complete type definitions for promptbook JSON structures
|
|
60
|
+
- **Execution Types**: Types for pipeline execution, results, and error handling
|
|
61
|
+
- **LLM Provider Types**: Configuration and option types for all supported providers
|
|
62
|
+
- **Command Types**: Type definitions for all promptbook commands
|
|
63
|
+
- **Utility Types**: Helper types for common patterns and data structures
|
|
64
|
+
- **Component Types**: React component prop types for UI components
|
|
65
|
+
|
|
66
|
+
## ✨ Key Features
|
|
67
|
+
|
|
68
|
+
- 📝 **Complete Type Coverage** - Types for all Promptbook entities and APIs
|
|
69
|
+
- 🔒 **Type Safety** - Compile-time validation and error prevention
|
|
70
|
+
- 💡 **Excellent IntelliSense** - Rich IDE support with autocomplete and documentation
|
|
71
|
+
- 🏗️ **Structural Types** - Detailed types for promptbook JSON structures
|
|
72
|
+
- 🔧 **Provider-Agnostic** - Generic types that work across all LLM providers
|
|
73
|
+
- 📊 **Execution Types** - Comprehensive types for pipeline execution and results
|
|
74
|
+
- 🎨 **Component Types** - React component prop types for UI development
|
|
75
|
+
- 🔄 **Version Compatibility** - Types that evolve with the Promptbook ecosystem
|
|
76
|
+
|
|
77
|
+
## Usage Example
|
|
51
78
|
|
|
52
79
|
```typescript
|
|
53
80
|
import type { PipelineJson } from '@promptbook/types';
|
|
@@ -73,6 +100,108 @@ const promptbook: PipelineJson = compilePipeline(
|
|
|
73
100
|
);
|
|
74
101
|
```
|
|
75
102
|
|
|
103
|
+
## 📦 Exported Type Categories
|
|
104
|
+
|
|
105
|
+
### Agent and Book Types
|
|
106
|
+
- `AgentBasicInformation` - Basic agent information structure
|
|
107
|
+
- `AgentModelRequirements` - Model requirements for agents
|
|
108
|
+
- `string_book` - Book content string type
|
|
109
|
+
- `BookCommitment` - Book commitment structure
|
|
110
|
+
- `CommitmentDefinition` - Commitment definition interface
|
|
111
|
+
- `ParsedCommitment` - Parsed commitment structure
|
|
112
|
+
|
|
113
|
+
### Component Types
|
|
114
|
+
- `AvatarChipProps` - Avatar chip component props
|
|
115
|
+
- `AvatarChipFromSourceProps` - Avatar chip from source props
|
|
116
|
+
- `AvatarProfileProps` - Avatar profile component props
|
|
117
|
+
- `AvatarProfileFromSourceProps` - Avatar profile from source props
|
|
118
|
+
- `BookEditorProps` - Book editor component props
|
|
119
|
+
- `ChatProps` - Chat component props
|
|
120
|
+
- `LlmChatProps` - LLM chat component props
|
|
121
|
+
- `ChatMessage` - Chat message structure
|
|
122
|
+
- `ChatParticipant` - Chat participant information
|
|
123
|
+
|
|
124
|
+
### Collection and Pipeline Types
|
|
125
|
+
- `PipelineCollection` - Pipeline collection interface
|
|
126
|
+
- `PipelineJson` - Complete pipeline JSON structure
|
|
127
|
+
- `PipelineString` - Pipeline string format
|
|
128
|
+
- `PipelineInterface` - Pipeline interface definition
|
|
129
|
+
- `TaskJson` - Task JSON structure
|
|
130
|
+
- `PromptTaskJson` - Prompt task structure
|
|
131
|
+
- `ScriptTaskJson` - Script task structure
|
|
132
|
+
- `SimpleTaskJson` - Simple task structure
|
|
133
|
+
- `DialogTaskJson` - Dialog task structure
|
|
134
|
+
- `CommonTaskJson` - Common task properties
|
|
135
|
+
|
|
136
|
+
### Command Types
|
|
137
|
+
- `Command` - Base command interface
|
|
138
|
+
- `CommandParser` - Command parser interface
|
|
139
|
+
- `CommandType` - Command type enumeration
|
|
140
|
+
- `CommandUsagePlace` - Command usage context
|
|
141
|
+
- `BookVersionCommand` - Book version command
|
|
142
|
+
- `ExpectCommand` - Expect command structure
|
|
143
|
+
- `ForeachCommand` - Foreach command structure
|
|
144
|
+
- `FormatCommand` - Format command structure
|
|
145
|
+
- `FormfactorCommand` - Formfactor command structure
|
|
146
|
+
- `KnowledgeCommand` - Knowledge command structure
|
|
147
|
+
- `ModelCommand` - Model command structure
|
|
148
|
+
- `ParameterCommand` - Parameter command structure
|
|
149
|
+
- `PersonaCommand` - Persona command structure
|
|
150
|
+
- `PostprocessCommand` - Postprocess command structure
|
|
151
|
+
|
|
152
|
+
### Execution Types
|
|
153
|
+
- `ExecutionTools` - Execution tools interface
|
|
154
|
+
- `LlmExecutionTools` - LLM execution tools interface
|
|
155
|
+
- `PipelineExecutor` - Pipeline executor interface
|
|
156
|
+
- `PipelineExecutorResult` - Execution result structure
|
|
157
|
+
- `ExecutionTask` - Execution task structure
|
|
158
|
+
- `ExecutionReportJson` - Execution report structure
|
|
159
|
+
- `PromptResult` - Prompt execution result
|
|
160
|
+
- `Usage` - Usage tracking structure
|
|
161
|
+
- `AvailableModel` - Available model information
|
|
162
|
+
|
|
163
|
+
### LLM Provider Configuration Types
|
|
164
|
+
- `AnthropicClaudeExecutionToolsOptions` - Anthropic Claude configuration
|
|
165
|
+
- `OpenAiExecutionToolsOptions` - OpenAI configuration
|
|
166
|
+
- `AzureOpenAiExecutionToolsOptions` - Azure OpenAI configuration
|
|
167
|
+
- `GoogleExecutionToolsOptions` - Google configuration
|
|
168
|
+
- `DeepseekExecutionToolsOptions` - Deepseek configuration
|
|
169
|
+
- `OllamaExecutionToolsOptions` - Ollama configuration
|
|
170
|
+
- `VercelExecutionToolsOptions` - Vercel configuration
|
|
171
|
+
|
|
172
|
+
### Parameter and Data Types
|
|
173
|
+
- `ParameterJson` - Parameter definition structure
|
|
174
|
+
- `InputParameterJson` - Input parameter structure
|
|
175
|
+
- `OutputParameterJson` - Output parameter structure
|
|
176
|
+
- `Parameters` - Parameter collection type
|
|
177
|
+
- `Expectations` - Expectation validation structure
|
|
178
|
+
- `PersonaJson` - Persona definition structure
|
|
179
|
+
- `KnowledgeSourceJson` - Knowledge source structure
|
|
180
|
+
|
|
181
|
+
### Utility and Helper Types
|
|
182
|
+
- `string_prompt` - Prompt string type
|
|
183
|
+
- `string_template` - Template string type
|
|
184
|
+
- `string_parameter_name` - Parameter name type
|
|
185
|
+
- `string_model_name` - Model name type
|
|
186
|
+
- `string_url` - URL string type
|
|
187
|
+
- `string_filename` - Filename string type
|
|
188
|
+
- `number_tokens` - Token count type
|
|
189
|
+
- `number_usd` - USD amount type
|
|
190
|
+
- `ModelVariant` - Model variant enumeration
|
|
191
|
+
- `ScriptLanguage` - Script language enumeration
|
|
192
|
+
- `TaskType` - Task type enumeration
|
|
193
|
+
|
|
194
|
+
### Remote Server Types
|
|
195
|
+
- `RemoteServerOptions` - Remote server configuration
|
|
196
|
+
- `RemoteClientOptions` - Remote client configuration
|
|
197
|
+
- `Identification` - User identification structure
|
|
198
|
+
|
|
199
|
+
### Storage and Scraper Types
|
|
200
|
+
- `PromptbookStorage` - Storage interface
|
|
201
|
+
- `Scraper` - Scraper interface
|
|
202
|
+
- `ScraperConstructor` - Scraper constructor type
|
|
203
|
+
- `Converter` - Content converter interface
|
|
204
|
+
|
|
76
205
|
_Note: `@promptbook/types` does not export brand-specific types like `OpenAiExecutionToolsOptions`, `ClaudeExecutionToolsOptions`, `LangchainExecutionToolsOptions`,... etc._
|
|
77
206
|
|
|
78
207
|
|
|
@@ -16,6 +16,12 @@ import { LlmChat } from '../book-components/Chat/LlmChat/LlmChat';
|
|
|
16
16
|
import type { LlmChatProps } from '../book-components/Chat/LlmChat/LlmChatProps';
|
|
17
17
|
import type { ChatMessage } from '../book-components/Chat/types/ChatMessage';
|
|
18
18
|
import type { ChatParticipant } from '../book-components/Chat/types/ChatParticipant';
|
|
19
|
+
import { renderMarkdown } from '../book-components/Chat/utils/renderMarkdown';
|
|
20
|
+
import { isMarkdownContent } from '../book-components/Chat/utils/renderMarkdown';
|
|
21
|
+
import { ArrowIcon } from '../book-components/icons/ArrowIcon';
|
|
22
|
+
import { ResetIcon } from '../book-components/icons/ResetIcon';
|
|
23
|
+
import { SendIcon } from '../book-components/icons/SendIcon';
|
|
24
|
+
import { TemplateIcon } from '../book-components/icons/TemplateIcon';
|
|
19
25
|
export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION };
|
|
20
26
|
export type { AvatarChipProps };
|
|
21
27
|
export { AvatarChip };
|
|
@@ -34,3 +40,9 @@ export { LlmChat };
|
|
|
34
40
|
export type { LlmChatProps };
|
|
35
41
|
export type { ChatMessage };
|
|
36
42
|
export type { ChatParticipant };
|
|
43
|
+
export { renderMarkdown };
|
|
44
|
+
export { isMarkdownContent };
|
|
45
|
+
export { ArrowIcon };
|
|
46
|
+
export { ResetIcon };
|
|
47
|
+
export { SendIcon };
|
|
48
|
+
export { TemplateIcon };
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import type { ChatProps } from './ChatProps';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated use `isComplete` instead
|
|
4
|
-
* @private util of `<Chat />`
|
|
5
|
-
*/
|
|
6
|
-
export declare const LOADING_INTERACTIVE_IMAGE = "Loading...";
|
|
7
2
|
/**
|
|
8
3
|
* Renders a chat with messages and input for new messages
|
|
9
4
|
*
|
|
@@ -23,10 +23,16 @@ export type ChatProps = {
|
|
|
23
23
|
* Called when user sends a message
|
|
24
24
|
*
|
|
25
25
|
* Note: You must handle the message yourself and add it to the `messages` array
|
|
26
|
+
*
|
|
27
|
+
* - When set, the send textarea and button will be shown
|
|
28
|
+
* - When undefined, the chat has no input and is read-only showing only the messages
|
|
26
29
|
*/
|
|
27
|
-
onMessage(messageContent: string): Promisable<void>;
|
|
30
|
+
onMessage?(messageContent: string): Promisable<void>;
|
|
28
31
|
/**
|
|
29
|
-
* Optional callback
|
|
32
|
+
* Optional callback
|
|
33
|
+
*
|
|
34
|
+
* - When set, button for resetting chat will be shown
|
|
35
|
+
* - When undefined, no reset button will be shown
|
|
30
36
|
*/
|
|
31
37
|
onReset?(): Promisable<void>;
|
|
32
38
|
/**
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Demo component showing Chat with markdown rendering capabilities
|
|
3
|
+
*
|
|
4
|
+
* This example demonstrates various markdown features supported by the Chat component:
|
|
5
|
+
* - Headers
|
|
6
|
+
* - Bold and italic text
|
|
7
|
+
* - Code blocks and inline code
|
|
8
|
+
* - Lists (ordered and unordered)
|
|
9
|
+
* - Links
|
|
10
|
+
* - Blockquotes
|
|
11
|
+
* - Tables
|
|
12
|
+
* - Strikethrough text
|
|
13
|
+
*
|
|
14
|
+
* @private temporary for testing purposes
|
|
15
|
+
*/
|
|
16
|
+
export declare function ChatMarkdownDemo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { string_html, string_markdown } from '../../../types/typeAliases';
|
|
2
|
+
/**
|
|
3
|
+
* Convert markdown content to HTML for display in chat messages
|
|
4
|
+
*
|
|
5
|
+
* @param markdown - The markdown content to convert
|
|
6
|
+
* @returns HTML string ready for rendering
|
|
7
|
+
*
|
|
8
|
+
* @public exported from `@promptbook/components`
|
|
9
|
+
* <- TODO: [🧠] Maybe export from `@promptbook/markdown-utils`
|
|
10
|
+
*/
|
|
11
|
+
export declare function renderMarkdown(markdown: string_markdown): string_html;
|
|
12
|
+
/**
|
|
13
|
+
* Check if content appears to be markdown (contains markdown syntax)
|
|
14
|
+
*
|
|
15
|
+
* @param content - Content to check
|
|
16
|
+
* @returns true if content appears to contain markdown syntax
|
|
17
|
+
*
|
|
18
|
+
* @public exported from `@promptbook/components`
|
|
19
|
+
* <- TODO: [🧠] Maybe export from `@promptbook/markdown-utils`
|
|
20
|
+
*/
|
|
21
|
+
export declare function isMarkdownContent(content: string): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,6 +3,8 @@ import type { string_markdown_text } from '../../types/typeAliases';
|
|
|
3
3
|
* Function escapeMarkdownBlock will escape markdown block if needed
|
|
4
4
|
* It is useful when you want have block in block
|
|
5
5
|
*
|
|
6
|
+
* Note: [🔂] This function is idempotent.
|
|
7
|
+
*
|
|
6
8
|
* @public exported from `@promptbook/markdown-utils`
|
|
7
9
|
*/
|
|
8
10
|
export declare function escapeMarkdownBlock(value: string_markdown_text): string_markdown_text;
|
|
@@ -2,6 +2,7 @@ import { string_markdown } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Function `humanizeAiText` will remove traces of AI text generation artifacts
|
|
4
4
|
*
|
|
5
|
+
* Note: [🔂] This function is idempotent.
|
|
5
6
|
* Tip: If you want more control, look for other functions for example `humanizeAiTextEmdashed` exported `@promptbook/markdown-utils`
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/markdown-utils`
|
|
@@ -2,6 +2,7 @@ import { string_markdown } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Change ellipsis character to three dots `…` -> `...`
|
|
4
4
|
*
|
|
5
|
+
* Note: [🔂] This function is idempotent.
|
|
5
6
|
* Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/markdown-utils`
|
|
@@ -2,6 +2,7 @@ import { string_markdown } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Change em-dashes to regular dashes `—` -> `-`
|
|
4
4
|
*
|
|
5
|
+
* Note: [🔂] This function is idempotent.
|
|
5
6
|
* Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/markdown-utils`
|
|
@@ -2,6 +2,7 @@ import { string_markdown } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Change smart quotes to regular quotes
|
|
4
4
|
*
|
|
5
|
+
* Note: [🔂] This function is idempotent.
|
|
5
6
|
* Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/markdown-utils`
|
|
@@ -2,6 +2,7 @@ import { string_markdown } from '../../types/typeAliases';
|
|
|
2
2
|
/**
|
|
3
3
|
* Change unprintable hard spaces to regular spaces
|
|
4
4
|
*
|
|
5
|
+
* Note: [🔂] This function is idempotent.
|
|
5
6
|
* Tip: If you want to do the full cleanup, look for `humanizeAiText` exported `@promptbook/markdown-utils`
|
|
6
7
|
*
|
|
7
8
|
* @public exported from `@promptbook/markdown-utils`
|
|
@@ -7,3 +7,11 @@ import type { string_html } from '../../types/typeAliases';
|
|
|
7
7
|
* @private withing the package because of HUGE size of prettier dependency
|
|
8
8
|
*/
|
|
9
9
|
export declare function prettifyMarkdown<TContent extends string_html>(content: TContent): TContent;
|
|
10
|
+
/**
|
|
11
|
+
* Async version of prettifyMarkdown using dynamic imports
|
|
12
|
+
*
|
|
13
|
+
* @param content raw html code
|
|
14
|
+
* @returns formatted html code
|
|
15
|
+
* @private withing the package because of HUGE size of prettier dependency
|
|
16
|
+
*/
|
|
17
|
+
export declare function prettifyMarkdownAsync<TContent extends string_html>(content: TContent): Promise<TContent>;
|
|
@@ -6,6 +6,7 @@ import { string_markdown } from '../../types/typeAliases';
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function promptbookifyAiText(text: string_markdown): string_markdown;
|
|
8
8
|
/**
|
|
9
|
+
* TODO: !!!!! Make the function idempotent and add "Note: [🔂] This function is idempotent."
|
|
9
10
|
* TODO: [🅾️]!!! Use this across the project where AI text is involved
|
|
10
11
|
* TODO: [🧠][✌️] Make some Promptbook-native token system
|
|
11
12
|
*/
|
|
@@ -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
|
* 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
|
* 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.
|
|
18
|
+
* It follows semantic versioning (e.g., `0.101.0-1`).
|
|
19
19
|
*
|
|
20
20
|
* @generated
|
|
21
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@promptbook/types",
|
|
3
|
-
"version": "0.101.0-
|
|
3
|
+
"version": "0.101.0-2",
|
|
4
4
|
"description": "Promptbook: Run AI apps in plain human language across multiple models and platforms",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -92,6 +92,6 @@
|
|
|
92
92
|
},
|
|
93
93
|
"typings": "./esm/typings/src/_packages/types.index.d.ts",
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@promptbook/core": "0.101.0-
|
|
95
|
+
"@promptbook/core": "0.101.0-2"
|
|
96
96
|
}
|
|
97
97
|
}
|