@promptbook/anthropic-claude
Advanced tools
Comparing version 0.55.0-1 to 0.55.0-2
@@ -538,2 +538,16 @@ import Anthropic from '@anthropic-ai/sdk'; | ||
/** | ||
* Make UncertainNumber | ||
* | ||
* @param value | ||
* | ||
* @private utility for initializating UncertainNumber | ||
*/ | ||
function uncertainNumber(value) { | ||
if (value === null || value === undefined || Number.isNaN(NaN)) { | ||
return { value: 0, isUncertain: true }; | ||
} | ||
return { value: value }; | ||
} | ||
/** | ||
* Execution Tools for calling Anthropic Claude API. | ||
@@ -604,4 +618,4 @@ */ | ||
price: { value: 0, isUncertain: true } /* <- TODO: [๐] Compute usage */, | ||
input: __assign({ tokensCount: { value: rawResponse.usage.input_tokens /* uncertainNumber */ } }, computeUsageCounts(prompt.content)), | ||
output: __assign({ tokensCount: { value: rawResponse.usage.output_tokens /* uncertainNumber */ } }, computeUsageCounts(prompt.content)), | ||
input: __assign({ tokensCount: uncertainNumber(rawResponse.usage.input_tokens) }, computeUsageCounts(prompt.content)), | ||
output: __assign({ tokensCount: uncertainNumber(rawResponse.usage.output_tokens) }, computeUsageCounts(prompt.content)), | ||
}; | ||
@@ -608,0 +622,0 @@ if (!resultContent) { |
@@ -14,3 +14,2 @@ import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptbookString'; | ||
import { UnexpectedError } from '../errors/UnexpectedError'; | ||
import { addPromptResultUsage } from '../execution/addPromptResultUsage'; | ||
import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful'; | ||
@@ -22,3 +21,5 @@ import { createPromptbookExecutor } from '../execution/createPromptbookExecutor'; | ||
import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools'; | ||
import { addUsage } from '../execution/utils/addUsage'; | ||
import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations'; | ||
import { usageToWorktime } from '../execution/utils/usageToWorktime'; | ||
import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory'; | ||
@@ -36,3 +37,3 @@ import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources'; | ||
export { ExecutionTypes, PROMPTBOOK_VERSION }; | ||
export { addPromptResultUsage, assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, }; | ||
export { addUsage, assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, usageToWorktime, }; | ||
export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, SimplePromptbookLibrary, }; | ||
@@ -39,0 +40,0 @@ export { SimplePromptInterfaceTools }; |
@@ -5,2 +5,3 @@ import type { Promisable } from 'type-fest'; | ||
import type { string_name } from '../types/typeAliases'; | ||
import type { PromptResultUsage } from './PromptResult'; | ||
/** | ||
@@ -17,11 +18,15 @@ * Executor is a simple async function that takes INPUT PARAMETERs and returns result parameters _(along with all intermediate parameters and INPUT PARAMETERs = it extends input object)_. | ||
/** | ||
* Whether the execution was successful | ||
* Whether the execution was successful, details are aviable in `executionReport` | ||
*/ | ||
isSuccessful: boolean; | ||
/** | ||
* Errors that occured during the execution | ||
* Added usage of whole execution, detailed usage is aviable in `executionReport` | ||
*/ | ||
usage: PromptResultUsage; | ||
/** | ||
* Errors that occured during the execution, details are aviable in `executionReport` | ||
*/ | ||
errors: Array<Error>; | ||
/** | ||
* The report of the execution | ||
* The report of the execution with all details | ||
*/ | ||
@@ -28,0 +33,0 @@ executionReport: ExecutionReportJson; |
{ | ||
"name": "@promptbook/anthropic-claude", | ||
"version": "0.55.0-1", | ||
"version": "0.55.0-2", | ||
"description": "Library to supercharge your use of large language models", | ||
@@ -51,3 +51,3 @@ "private": false, | ||
"peerDependencies": { | ||
"@promptbook/core": "0.55.0-1" | ||
"@promptbook/core": "0.55.0-2" | ||
}, | ||
@@ -54,0 +54,0 @@ "main": "./umd/index.umd.js", |
@@ -546,2 +546,16 @@ (function (global, factory) { | ||
/** | ||
* Make UncertainNumber | ||
* | ||
* @param value | ||
* | ||
* @private utility for initializating UncertainNumber | ||
*/ | ||
function uncertainNumber(value) { | ||
if (value === null || value === undefined || Number.isNaN(NaN)) { | ||
return { value: 0, isUncertain: true }; | ||
} | ||
return { value: value }; | ||
} | ||
/** | ||
* Execution Tools for calling Anthropic Claude API. | ||
@@ -612,4 +626,4 @@ */ | ||
price: { value: 0, isUncertain: true } /* <- TODO: [๐] Compute usage */, | ||
input: __assign({ tokensCount: { value: rawResponse.usage.input_tokens /* uncertainNumber */ } }, computeUsageCounts(prompt.content)), | ||
output: __assign({ tokensCount: { value: rawResponse.usage.output_tokens /* uncertainNumber */ } }, computeUsageCounts(prompt.content)), | ||
input: __assign({ tokensCount: uncertainNumber(rawResponse.usage.input_tokens) }, computeUsageCounts(prompt.content)), | ||
output: __assign({ tokensCount: uncertainNumber(rawResponse.usage.output_tokens) }, computeUsageCounts(prompt.content)), | ||
}; | ||
@@ -616,0 +630,0 @@ if (!resultContent) { |
@@ -14,3 +14,2 @@ import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptbookString'; | ||
import { UnexpectedError } from '../errors/UnexpectedError'; | ||
import { addPromptResultUsage } from '../execution/addPromptResultUsage'; | ||
import { assertsExecutionSuccessful } from '../execution/assertsExecutionSuccessful'; | ||
@@ -22,3 +21,5 @@ import { createPromptbookExecutor } from '../execution/createPromptbookExecutor'; | ||
import { SimplePromptInterfaceTools } from '../execution/plugins/user-interface-execution-tools/simple-prompt/SimplePromptInterfaceTools'; | ||
import { addUsage } from '../execution/utils/addUsage'; | ||
import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations'; | ||
import { usageToWorktime } from '../execution/utils/usageToWorktime'; | ||
import { createPromptbookLibraryFromDirectory } from '../library/constructors/createPromptbookLibraryFromDirectory'; | ||
@@ -36,3 +37,3 @@ import { createPromptbookLibraryFromSources } from '../library/constructors/createPromptbookLibraryFromSources'; | ||
export { ExecutionTypes, PROMPTBOOK_VERSION }; | ||
export { addPromptResultUsage, assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, }; | ||
export { addUsage, assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prettifyPromptbookString, usageToWorktime, }; | ||
export { createPromptbookLibraryFromDirectory, createPromptbookLibraryFromSources, createPromptbookLibraryFromUrl, createPromptbookSublibrary, SimplePromptbookLibrary, }; | ||
@@ -39,0 +40,0 @@ export { SimplePromptInterfaceTools }; |
@@ -5,2 +5,3 @@ import type { Promisable } from 'type-fest'; | ||
import type { string_name } from '../types/typeAliases'; | ||
import type { PromptResultUsage } from './PromptResult'; | ||
/** | ||
@@ -17,11 +18,15 @@ * Executor is a simple async function that takes INPUT PARAMETERs and returns result parameters _(along with all intermediate parameters and INPUT PARAMETERs = it extends input object)_. | ||
/** | ||
* Whether the execution was successful | ||
* Whether the execution was successful, details are aviable in `executionReport` | ||
*/ | ||
isSuccessful: boolean; | ||
/** | ||
* Errors that occured during the execution | ||
* Added usage of whole execution, detailed usage is aviable in `executionReport` | ||
*/ | ||
usage: PromptResultUsage; | ||
/** | ||
* Errors that occured during the execution, details are aviable in `executionReport` | ||
*/ | ||
errors: Array<Error>; | ||
/** | ||
* The report of the execution | ||
* The report of the execution with all details | ||
*/ | ||
@@ -28,0 +33,0 @@ executionReport: ExecutionReportJson; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
534832
532
8974