@promptbook/documents 0.89.0-7 → 0.89.0-9
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/esm/index.es.js +27 -6
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +4 -0
- package/esm/typings/src/_packages/remote-client.index.d.ts +6 -6
- package/esm/typings/src/_packages/remote-server.index.d.ts +6 -6
- package/esm/typings/src/_packages/types.index.d.ts +10 -16
- package/esm/typings/src/errors/0-index.d.ts +3 -0
- package/esm/typings/src/errors/PromptbookFetchError.d.ts +9 -0
- package/esm/typings/src/llm-providers/_common/register/$provideEnvFilepath.d.ts +12 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsConfigurationFromEnv.d.ts +2 -8
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForTestingAndScriptsAndPlayground.d.ts +2 -0
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsForWizzardOrCli.d.ts +5 -3
- package/esm/typings/src/llm-providers/_common/register/$provideLlmToolsFromEnv.d.ts +1 -0
- package/esm/typings/src/remote-server/socket-types/_subtypes/{PromptbookServer_Identification.d.ts → Identification.d.ts} +3 -3
- package/esm/typings/src/remote-server/socket-types/listModels/PromptbookServer_ListModels_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prepare/PromptbookServer_PreparePipeline_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/socket-types/prompt/PromptbookServer_Prompt_Request.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteClientOptions.d.ts +2 -2
- package/esm/typings/src/remote-server/types/RemoteServerOptions.d.ts +63 -21
- package/esm/typings/src/scrapers/_common/utils/{scraperFetch.d.ts → promptbookFetch.d.ts} +2 -2
- package/package.json +2 -2
- package/umd/index.umd.js +27 -6
- package/umd/index.umd.js.map +1 -1
- package/esm/typings/src/playground/BrjappConnector.d.ts +0 -67
- package/esm/typings/src/playground/brjapp-api-schema.d.ts +0 -12879
package/esm/index.es.js
CHANGED
|
@@ -28,7 +28,7 @@ const BOOK_LANGUAGE_VERSION = '1.0.0';
|
|
|
28
28
|
* @generated
|
|
29
29
|
* @see https://github.com/webgptorg/promptbook
|
|
30
30
|
*/
|
|
31
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-
|
|
31
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.89.0-9';
|
|
32
32
|
/**
|
|
33
33
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
34
34
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -2387,6 +2387,19 @@ class NotYetImplementedError extends Error {
|
|
|
2387
2387
|
}
|
|
2388
2388
|
}
|
|
2389
2389
|
|
|
2390
|
+
/**
|
|
2391
|
+
* Error thrown when a fetch request fails
|
|
2392
|
+
*
|
|
2393
|
+
* @public exported from `@promptbook/core`
|
|
2394
|
+
*/
|
|
2395
|
+
class PromptbookFetchError extends Error {
|
|
2396
|
+
constructor(message) {
|
|
2397
|
+
super(message);
|
|
2398
|
+
this.name = 'PromptbookFetchError';
|
|
2399
|
+
Object.setPrototypeOf(this, PromptbookFetchError.prototype);
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
|
|
2390
2403
|
/**
|
|
2391
2404
|
* Index of all custom errors
|
|
2392
2405
|
*
|
|
@@ -2425,6 +2438,7 @@ const COMMON_JAVASCRIPT_ERRORS = {
|
|
|
2425
2438
|
URIError,
|
|
2426
2439
|
AggregateError,
|
|
2427
2440
|
AuthenticationError,
|
|
2441
|
+
PromptbookFetchError,
|
|
2428
2442
|
/*
|
|
2429
2443
|
Note: Not widely supported
|
|
2430
2444
|
> InternalError,
|
|
@@ -3394,17 +3408,24 @@ function mimeTypeToExtension(value) {
|
|
|
3394
3408
|
/**
|
|
3395
3409
|
* The built-in `fetch' function with a lightweight error handling wrapper as default fetch function used in Promptbook scrapers
|
|
3396
3410
|
*
|
|
3397
|
-
* @
|
|
3411
|
+
* @public exported from `@promptbook/core`
|
|
3398
3412
|
*/
|
|
3399
|
-
const
|
|
3413
|
+
const promptbookFetch = async (urlOrRequest, init) => {
|
|
3400
3414
|
try {
|
|
3401
|
-
return await fetch(
|
|
3415
|
+
return await fetch(urlOrRequest, init);
|
|
3402
3416
|
}
|
|
3403
3417
|
catch (error) {
|
|
3404
3418
|
if (!(error instanceof Error)) {
|
|
3405
3419
|
throw error;
|
|
3406
3420
|
}
|
|
3407
|
-
|
|
3421
|
+
let url;
|
|
3422
|
+
if (typeof urlOrRequest === 'string') {
|
|
3423
|
+
url = urlOrRequest;
|
|
3424
|
+
}
|
|
3425
|
+
else if (urlOrRequest instanceof Request) {
|
|
3426
|
+
url = urlOrRequest.url;
|
|
3427
|
+
}
|
|
3428
|
+
throw new PromptbookFetchError(spaceTrim$1((block) => `
|
|
3408
3429
|
Can not fetch "${url}"
|
|
3409
3430
|
|
|
3410
3431
|
Fetch error:
|
|
@@ -3425,7 +3446,7 @@ const scraperFetch = async (url, init) => {
|
|
|
3425
3446
|
async function makeKnowledgeSourceHandler(knowledgeSource, tools, options) {
|
|
3426
3447
|
// console.log('!! makeKnowledgeSourceHandler', knowledgeSource);
|
|
3427
3448
|
var _a;
|
|
3428
|
-
const { fetch =
|
|
3449
|
+
const { fetch = promptbookFetch } = tools;
|
|
3429
3450
|
const { knowledgeSourceContent } = knowledgeSource;
|
|
3430
3451
|
let { name } = knowledgeSource;
|
|
3431
3452
|
const { rootDirname = null,
|