@promptbook/remote-server 0.89.0-17 → 0.89.0-19
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 +9 -7
- package/esm/index.es.js +51 -45
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +40 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -2
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/config.d.ts +0 -6
- package/esm/typings/src/types/typeAliases.d.ts +7 -0
- package/package.json +2 -2
- package/umd/index.umd.js +51 -45
- package/umd/index.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -244,6 +244,10 @@ But unlike programming languages, it is designed to be understandable by non-pro
|
|
|
244
244
|
|
|
245
245
|
|
|
246
246
|
|
|
247
|
+
## 🔒 Security
|
|
248
|
+
|
|
249
|
+
For information on reporting security vulnerabilities, see our [Security Policy](./SECURITY.md).
|
|
250
|
+
|
|
247
251
|
## 📦 Packages _(for developers)_
|
|
248
252
|
|
|
249
253
|
This library is divided into several packages, all are published from [single monorepo](https://github.com/webgptorg/promptbook).
|
|
@@ -300,7 +304,7 @@ The following glossary is used to clarify certain concepts:
|
|
|
300
304
|
### General LLM / AI terms
|
|
301
305
|
|
|
302
306
|
- **Prompt drift** is a phenomenon where the AI model starts to generate outputs that are not aligned with the original prompt. This can happen due to the model's training data, the prompt's wording, or the model's architecture.
|
|
303
|
-
- **Pipeline, workflow or chain** is a sequence of tasks that are executed in a specific order. In the context of AI, a pipeline can refer to a sequence of AI models that are used to process data.
|
|
307
|
+
- [**Pipeline, workflow scenario or chain** is a sequence of tasks that are executed in a specific order. In the context of AI, a pipeline can refer to a sequence of AI models that are used to process data.](https://github.com/webgptorg/promptbook/discussions/88)
|
|
304
308
|
- **Fine-tuning** is a process where a pre-trained AI model is further trained on a specific dataset to improve its performance on a specific task.
|
|
305
309
|
- **Zero-shot learning** is a machine learning paradigm where a model is trained to perform a task without any labeled examples. Instead, the model is provided with a description of the task and is expected to generate the correct output.
|
|
306
310
|
- **Few-shot learning** is a machine learning paradigm where a model is trained to perform a task with only a few labeled examples. This is in contrast to traditional machine learning, where models are trained on large datasets.
|
|
@@ -308,10 +312,6 @@ The following glossary is used to clarify certain concepts:
|
|
|
308
312
|
- **Retrieval-augmented generation** is a machine learning paradigm where a model generates text by retrieving relevant information from a large database of text. This approach combines the benefits of generative models and retrieval models.
|
|
309
313
|
- **Longtail** refers to non-common or rare events, items, or entities that are not well-represented in the training data of machine learning models. Longtail items are often challenging for models to predict accurately.
|
|
310
314
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
315
|
_Note: This section is not complete dictionary, more list of general AI / LLM terms that has connection with Promptbook_
|
|
316
316
|
|
|
317
317
|
|
|
@@ -425,6 +425,8 @@ See [TODO.md](./TODO.md)
|
|
|
425
425
|
|
|
426
426
|
## 🖋️ Contributing
|
|
427
427
|
|
|
428
|
-
We are open to pull requests, feedback, and suggestions.
|
|
428
|
+
You can also ⭐ star the project, [follow us on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).We are open to [pull requests, feedback, and suggestions](./CONTRIBUTING.md).
|
|
429
|
+
|
|
430
|
+
## 📞 Support
|
|
429
431
|
|
|
430
|
-
|
|
432
|
+
If you need help or have questions, please check our [Support Resources](./SUPPORT.md).
|
package/esm/index.es.js
CHANGED
|
@@ -33,25 +33,12 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
33
33
|
* @generated
|
|
34
34
|
* @see https://github.com/webgptorg/promptbook
|
|
35
35
|
*/
|
|
36
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
36
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-19';
|
|
37
37
|
/**
|
|
38
38
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
39
39
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
|
-
/**
|
|
43
|
-
* Error thrown when a fetch request fails
|
|
44
|
-
*
|
|
45
|
-
* @public exported from `@promptbook/core`
|
|
46
|
-
*/
|
|
47
|
-
class PromptbookFetchError extends Error {
|
|
48
|
-
constructor(message) {
|
|
49
|
-
super(message);
|
|
50
|
-
this.name = 'PromptbookFetchError';
|
|
51
|
-
Object.setPrototypeOf(this, PromptbookFetchError.prototype);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
42
|
/**
|
|
56
43
|
* Returns the same value that is passed as argument.
|
|
57
44
|
* No side effects.
|
|
@@ -344,37 +331,6 @@ function assertsError(whatWasThrown) {
|
|
|
344
331
|
throw new WrappedError(whatWasThrown);
|
|
345
332
|
}
|
|
346
333
|
|
|
347
|
-
/**
|
|
348
|
-
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
349
|
-
*
|
|
350
|
-
* @public exported from `@promptbook/core`
|
|
351
|
-
*/
|
|
352
|
-
const promptbookFetch = async (urlOrRequest, init) => {
|
|
353
|
-
try {
|
|
354
|
-
return await fetch(urlOrRequest, init);
|
|
355
|
-
}
|
|
356
|
-
catch (error) {
|
|
357
|
-
assertsError(error);
|
|
358
|
-
let url;
|
|
359
|
-
if (typeof urlOrRequest === 'string') {
|
|
360
|
-
url = urlOrRequest;
|
|
361
|
-
}
|
|
362
|
-
else if (urlOrRequest instanceof Request) {
|
|
363
|
-
url = urlOrRequest.url;
|
|
364
|
-
}
|
|
365
|
-
throw new PromptbookFetchError(spaceTrim((block) => `
|
|
366
|
-
Can not fetch "${url}"
|
|
367
|
-
|
|
368
|
-
Fetch error:
|
|
369
|
-
${block(error.message)}
|
|
370
|
-
|
|
371
|
-
`));
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
|
-
/**
|
|
375
|
-
* TODO: [🧠] Maybe rename because it is not used only for scrapers but also in `$getCompiledBook`
|
|
376
|
-
*/
|
|
377
|
-
|
|
378
334
|
/**
|
|
379
335
|
* AuthenticationError is thrown from login function which is dependency of remote server
|
|
380
336
|
*
|
|
@@ -616,6 +572,19 @@ class PipelineUrlError extends Error {
|
|
|
616
572
|
}
|
|
617
573
|
}
|
|
618
574
|
|
|
575
|
+
/**
|
|
576
|
+
* Error thrown when a fetch request fails
|
|
577
|
+
*
|
|
578
|
+
* @public exported from `@promptbook/core`
|
|
579
|
+
*/
|
|
580
|
+
class PromptbookFetchError extends Error {
|
|
581
|
+
constructor(message) {
|
|
582
|
+
super(message);
|
|
583
|
+
this.name = 'PromptbookFetchError';
|
|
584
|
+
Object.setPrototypeOf(this, PromptbookFetchError.prototype);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
619
588
|
/**
|
|
620
589
|
* Index of all custom errors
|
|
621
590
|
*
|
|
@@ -3652,6 +3621,37 @@ function titleToName(value) {
|
|
|
3652
3621
|
return value;
|
|
3653
3622
|
}
|
|
3654
3623
|
|
|
3624
|
+
/**
|
|
3625
|
+
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
3626
|
+
*
|
|
3627
|
+
* @public exported from `@promptbook/core`
|
|
3628
|
+
*/
|
|
3629
|
+
const promptbookFetch = async (urlOrRequest, init) => {
|
|
3630
|
+
try {
|
|
3631
|
+
return await fetch(urlOrRequest, init);
|
|
3632
|
+
}
|
|
3633
|
+
catch (error) {
|
|
3634
|
+
assertsError(error);
|
|
3635
|
+
let url;
|
|
3636
|
+
if (typeof urlOrRequest === 'string') {
|
|
3637
|
+
url = urlOrRequest;
|
|
3638
|
+
}
|
|
3639
|
+
else if (urlOrRequest instanceof Request) {
|
|
3640
|
+
url = urlOrRequest.url;
|
|
3641
|
+
}
|
|
3642
|
+
throw new PromptbookFetchError(spaceTrim((block) => `
|
|
3643
|
+
Can not fetch "${url}"
|
|
3644
|
+
|
|
3645
|
+
Fetch error:
|
|
3646
|
+
${block(error.message)}
|
|
3647
|
+
|
|
3648
|
+
`));
|
|
3649
|
+
}
|
|
3650
|
+
};
|
|
3651
|
+
/**
|
|
3652
|
+
* TODO: [🧠] Maybe rename because it is not used only for scrapers but also in `$getCompiledBook`
|
|
3653
|
+
*/
|
|
3654
|
+
|
|
3655
3655
|
/**
|
|
3656
3656
|
* @@@
|
|
3657
3657
|
*
|
|
@@ -7241,6 +7241,12 @@ function startRemoteServer(options) {
|
|
|
7241
7241
|
response.status(400).send({ error: serializeError(error) });
|
|
7242
7242
|
}
|
|
7243
7243
|
});
|
|
7244
|
+
/**
|
|
7245
|
+
* Catch-all handler for unmatched routes
|
|
7246
|
+
*/
|
|
7247
|
+
app.use((request, response) => {
|
|
7248
|
+
response.status(404).send(`URL "${request.originalUrl}" was not found on Promptbook server.`);
|
|
7249
|
+
});
|
|
7244
7250
|
const httpServer = http.createServer(app);
|
|
7245
7251
|
const server = new Server(httpServer, {
|
|
7246
7252
|
path: socketioPath,
|