@promptbook/openai 0.101.0-2 โ†’ 0.101.0-3

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 CHANGED
@@ -48,28 +48,32 @@ npm i ptbk
48
48
  npm install @promptbook/openai
49
49
  ```
50
50
 
51
- `@promptbook/openai` integrates [OpenAI's API](https://openai.com/) with [Promptbook](https://github.com/webgptorg/promptbook). It provides execution tools for OpenAI GPT models, OpenAI Assistants, and OpenAI-compatible APIs, enabling seamless integration with the Promptbook ecosystem.
51
+ OpenAI integration for Promptbook, providing execution tools for OpenAI GPT models, OpenAI Assistants, and OpenAI-compatible APIs within the Promptbook ecosystem.
52
52
 
53
53
  ## ๐ŸŽฏ Purpose and Motivation
54
54
 
55
- This package bridges the gap between Promptbook's unified pipeline execution system and OpenAI's powerful language models. It provides a standardized interface for accessing OpenAI's various services while maintaining compatibility with Promptbook's execution framework.
55
+ This package bridges the gap between Promptbook's unified pipeline execution system and OpenAI's powerful language models. It provides a standardized interface for accessing OpenAI's various services while maintaining compatibility with Promptbook's execution framework, enabling seamless integration with different OpenAI offerings.
56
56
 
57
57
  ## ๐Ÿ”ง High-Level Functionality
58
58
 
59
59
  The package offers three main integration paths:
60
- - **Standard OpenAI API**: Direct integration with OpenAI's chat completions and embeddings
61
- - **OpenAI Assistants**: Integration with OpenAI's Assistant API (GPTs)
62
- - **OpenAI-Compatible APIs**: Support for third-party APIs that follow OpenAI's interface
60
+
61
+ - **Standard OpenAI API**: Direct integration with OpenAI's chat completions and embeddings
62
+ - **OpenAI Assistants**: Integration with OpenAI's Assistant API (GPTs)
63
+ - **OpenAI-Compatible APIs**: Support for third-party APIs that follow OpenAI's interface
64
+ - **Model Management**: Automatic model selection and configuration
65
+ - **Usage Tracking**: Built-in monitoring for tokens and costs
63
66
 
64
67
  ## โœจ Key Features
65
68
 
66
- - ๐Ÿค– **Multiple OpenAI Integrations** - Support for standard API, Assistants, and compatible services
67
- - ๐Ÿ”„ **Seamless Provider Switching** - Easy integration with other LLM providers
68
- - ๐ŸŽฏ **Model Selection** - Access to all available OpenAI models with automatic selection
69
- - ๐Ÿ”ง **Configuration Flexibility** - Support for custom endpoints, API keys, and parameters
70
- - ๐Ÿ“Š **Usage Tracking** - Built-in token usage and cost monitoring
71
- - ๐Ÿ›ก๏ธ **Error Handling** - Comprehensive error handling and retry logic
72
- - ๐Ÿš€ **Performance Optimization** - Caching and request optimization
69
+ - ๐Ÿค– **Multiple OpenAI Integrations** - Support for standard API, Assistants, and compatible services
70
+ - ๐Ÿ”„ **Seamless Provider Switching** - Easy integration with other LLM providers
71
+ - ๐ŸŽฏ **Model Selection** - Access to all available OpenAI models with automatic selection
72
+ - ๐Ÿ”ง **Configuration Flexibility** - Support for custom endpoints, API keys, and parameters
73
+ - ๐Ÿ“Š **Usage Tracking** - Built-in token usage and cost monitoring
74
+ - ๐Ÿ›ก๏ธ **Error Handling** - Comprehensive error handling and retry logic
75
+ - ๐Ÿš€ **Performance Optimization** - Caching and request optimization
76
+ - ๐Ÿ”Œ **OpenAI-Compatible Server** - Use Promptbook books as OpenAI-compatible models
73
77
 
74
78
  ## ๐Ÿงก Usage
75
79
 
@@ -323,36 +327,46 @@ This allows you to:
323
327
  - Integrate Promptbook into existing OpenAI-based applications
324
328
  - Use Promptbook books as models in other AI frameworks
325
329
 
330
+
331
+
326
332
  ## ๐Ÿ“ฆ Exported Entities
327
333
 
328
334
  ### Version Information
329
- - `BOOK_LANGUAGE_VERSION` - Current book language version
330
- - `PROMPTBOOK_ENGINE_VERSION` - Current engine version
335
+
336
+ - `BOOK_LANGUAGE_VERSION` - Current book language version
337
+ - `PROMPTBOOK_ENGINE_VERSION` - Current engine version
331
338
 
332
339
  ### Execution Tools Creation Functions
333
- - `createOpenAiAssistantExecutionTools` - Create OpenAI Assistant execution tools
334
- - `createOpenAiCompatibleExecutionTools` - Create OpenAI-compatible execution tools
335
- - `createOpenAiExecutionTools` - Create standard OpenAI execution tools
340
+
341
+ - `createOpenAiAssistantExecutionTools` - Create OpenAI Assistant execution tools
342
+ - `createOpenAiCompatibleExecutionTools` - Create OpenAI-compatible execution tools
343
+ - `createOpenAiExecutionTools` - Create standard OpenAI execution tools
336
344
 
337
345
  ### Model Information
338
- - `OPENAI_MODELS` - Available OpenAI models configuration
346
+
347
+ - `OPENAI_MODELS` - Available OpenAI models configuration
339
348
 
340
349
  ### Execution Tools Classes
341
- - `OpenAiAssistantExecutionTools` - OpenAI Assistant execution tools class
342
- - `OpenAiCompatibleExecutionTools` - OpenAI-compatible execution tools class
343
- - `OpenAiExecutionTools` - Standard OpenAI execution tools class
350
+
351
+ - `OpenAiAssistantExecutionTools` - OpenAI Assistant execution tools class
352
+ - `OpenAiCompatibleExecutionTools` - OpenAI-compatible execution tools class
353
+ - `OpenAiExecutionTools` - Standard OpenAI execution tools class
344
354
 
345
355
  ### Configuration Types
346
- - `OpenAiAssistantExecutionToolsOptions` - Configuration options for OpenAI Assistant tools (type)
347
- - `OpenAiCompatibleExecutionToolsOptions` - Configuration options for OpenAI-compatible tools (type)
348
- - `OpenAiCompatibleExecutionToolsNonProxiedOptions` - Non-proxied configuration options (type)
349
- - `OpenAiCompatibleExecutionToolsProxiedOptions` - Proxied configuration options (type)
350
- - `OpenAiExecutionToolsOptions` - Configuration options for standard OpenAI tools (type)
356
+
357
+ - `OpenAiAssistantExecutionToolsOptions` - Configuration options for OpenAI Assistant tools (type)
358
+ - `OpenAiCompatibleExecutionToolsOptions` - Configuration options for OpenAI-compatible tools (type)
359
+ - `OpenAiCompatibleExecutionToolsNonProxiedOptions` - Non-proxied configuration options (type)
360
+ - `OpenAiCompatibleExecutionToolsProxiedOptions` - Proxied configuration options (type)
361
+ - `OpenAiExecutionToolsOptions` - Configuration options for standard OpenAI tools (type)
351
362
 
352
363
  ### Provider Registrations
353
- - `_OpenAiRegistration` - Standard OpenAI provider registration
354
- - `_OpenAiAssistantRegistration` - OpenAI Assistant provider registration
355
- - `_OpenAiCompatibleRegistration` - OpenAI-compatible provider registration
364
+
365
+ - `_OpenAiRegistration` - Standard OpenAI provider registration
366
+ - `_OpenAiAssistantRegistration` - OpenAI Assistant provider registration
367
+ - `_OpenAiCompatibleRegistration` - OpenAI-compatible provider registration
368
+
369
+ > ๐Ÿ’ก This package provides OpenAI integration for promptbook applications. For the core functionality, see [@promptbook/core](#-packages) or install all packages with `npm i ptbk`
356
370
 
357
371
 
358
372
  ---
package/esm/index.es.js CHANGED
@@ -19,7 +19,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
19
19
  * @generated
20
20
  * @see https://github.com/webgptorg/promptbook
21
21
  */
22
- const PROMPTBOOK_ENGINE_VERSION = '0.101.0-2';
22
+ const PROMPTBOOK_ENGINE_VERSION = '0.101.0-3';
23
23
  /**
24
24
  * TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
25
25
  * Note: [๐Ÿ’ž] Ignore a discrepancy between file name and entity name
@@ -119,4 +119,24 @@ export type ChatProps = {
119
119
  * Keys should match ChatMessage.from values (e.g., 'USER', 'AGENT_{id}', etc.)
120
120
  */
121
121
  readonly participants?: ReadonlyArray<ChatParticipant>;
122
+ /**
123
+ * Optional callback for handling user feedback on messages
124
+ * When provided, star rating buttons (1-5 stars) will be displayed next to each message
125
+ *
126
+ * @param feedback - Object containing the feedback data
127
+ * @param feedback.message - The message being rated
128
+ * @param feedback.rating - Star rating from 1 to 5
129
+ * @param feedback.textRating - Optional text feedback/note from user
130
+ * @param feedback.chatThread - Complete chat thread as string
131
+ * @param feedback.expectedAnswer - Optional expected answer provided by user
132
+ * @param feedback.url - Current page URL where feedback was given
133
+ */
134
+ onFeedback?(feedback: {
135
+ message: ChatMessage;
136
+ rating: number;
137
+ textRating: string;
138
+ chatThread: string;
139
+ expectedAnswer: string | null;
140
+ url: string;
141
+ }): Promisable<void>;
122
142
  };
@@ -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.101.0-1`).
18
+ * It follows semantic versioning (e.g., `0.101.0-2`).
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.101.0-2",
3
+ "version": "0.101.0-3",
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.101.0-2"
105
+ "@promptbook/core": "0.101.0-3"
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.101.0-2';
28
+ const PROMPTBOOK_ENGINE_VERSION = '0.101.0-3';
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