Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@promptbook/anthropic-claude

Package Overview
Dependencies
Maintainers
0
Versions
312
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@promptbook/anthropic-claude - npm Package Compare versions

Comparing version 0.65.0 to 0.66.0-0

esm/typings/src/utils/environment/getGlobalScope.d.ts

45

esm/index.es.js

@@ -10,3 +10,3 @@ import Anthropic from '@anthropic-ai/sdk';

*/
var PROMPTBOOK_VERSION = '0.65.0-7';
var PROMPTBOOK_VERSION = '0.65.0';
// TODO: !!!! List here all the versions and annotate + put into script

@@ -136,3 +136,3 @@

*
* Note: Done at 2024-05-25
* Note: Done at 2024-08-16
*

@@ -145,2 +145,11 @@ * @see https://docs.anthropic.com/en/docs/models-overview

modelVariant: 'CHAT',
modelTitle: 'Claude 3.5 Sonnet',
modelName: 'claude-3-5-sonnet-20240620',
pricing: {
prompt: computeUsage("$3.00 / 1M tokens"),
output: computeUsage("$15.00 / 1M tokens"),
},
},
{
modelVariant: 'CHAT',
modelTitle: 'Claude 3 Opus',

@@ -205,3 +214,3 @@ modelName: 'claude-3-opus-20240229',

* TODO: [🧠][👮‍♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
* TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
* TODO: [🎰] Some mechanism to auto-update available models
*/

@@ -623,2 +632,3 @@

*
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object

@@ -629,3 +639,3 @@ *

*/
function deepFreeze(objectValue) {
function $deepFreeze(objectValue) {
var e_1, _a;

@@ -638,3 +648,3 @@ var propertyNames = Object.getOwnPropertyNames(objectValue);

if (value && typeof value === 'object') {
deepFreeze(value);
$deepFreeze(value);
}

@@ -674,3 +684,3 @@ }

*/
deepFreeze([
$deepFreeze([
'content',

@@ -812,3 +822,5 @@ 'context',

delete anthropicOptions.isProxied;
this.client = new Anthropic(anthropicOptions);
this.client = new Anthropic(
// <- TODO: [🧱] Implement in a functional (not new Class) way
anthropicOptions);
}

@@ -834,3 +846,3 @@ Object.defineProperty(AnthropicClaudeExecutionTools.prototype, "title", {

return __awaiter(this, void 0, void 0, function () {
var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, contentBlock, resultContent, usage;
return __generator(this, function (_a) {

@@ -881,7 +893,12 @@ switch (_a.label) {

}
resultContent = rawResponse.content[0].text;
contentBlock = rawResponse.content[0];
if (contentBlock.type !== 'text') {
throw new PipelineExecutionError("Returned content is not \"text\" type but \"".concat(contentBlock.type, "\""));
}
console.log('!!!!!! rawResponse.usage', rawResponse.usage);
resultContent = contentBlock.text;
// eslint-disable-next-line prefer-const
complete = getCurrentIsoDate();
usage = {
price: { value: 0, isUncertain: true } /* <- TODO: [🐞] Compute usage */,
price: { value: 0, isUncertain: true } /* <- TODO: [🐞] !!!!!! Compute usage */,
input: __assign({ tokensCount: uncertainNumber(rawResponse.usage.input_tokens) }, computeUsageCounts(prompt.content)),

@@ -1054,3 +1071,5 @@ output: __assign({ tokensCount: uncertainNumber(rawResponse.usage.output_tokens) }, computeUsageCounts(prompt.content)),

var _this = this;
return new Promise(function (resolve, reject) {
return new Promise(
// <- TODO: [🧱] Implement in a functional (not new Class) way
function (resolve, reject) {
var socket = io(_this.options.remoteUrl, {

@@ -1180,3 +1199,5 @@ path: _this.options.path,

}
return new AnthropicClaudeExecutionTools(options);
return new AnthropicClaudeExecutionTools(
// <- TODO: [🧱] Implement in a functional (not new Class) way
options);
}

@@ -1183,0 +1204,0 @@ /**

@@ -13,3 +13,7 @@ import { PROMPTBOOK_VERSION } from '../version';

import { deepClone } from '../utils/deepClone';
import { deepFreeze } from '../utils/deepFreeze';
import { $deepFreeze } from '../utils/deepFreeze';
import { $getGlobalScope } from '../utils/environment/getGlobalScope';
import { $isRunningInBrowser } from '../utils/environment/isRunningInBrowser';
import { $isRunningInNode } from '../utils/environment/isRunningInNode';
import { $isRunningInWebWorker } from '../utils/environment/isRunningInWebWorker';
import { countCharacters } from '../utils/expectation-counters/countCharacters';

@@ -24,5 +28,2 @@ import { countLines } from '../utils/expectation-counters/countLines';

import { extractParameterNames } from '../utils/extractParameterNames';
import { isRunningInBrowser } from '../utils/isRunningInWhatever';
import { isRunningInNode } from '../utils/isRunningInWhatever';
import { isRunningInWebWorker } from '../utils/isRunningInWhatever';
import { capitalize } from '../utils/normalization/capitalize';

@@ -83,3 +84,7 @@ import { decapitalize } from '../utils/normalization/decapitalize';

export { deepClone };
export { deepFreeze };
export { $deepFreeze };
export { $getGlobalScope };
export { $isRunningInBrowser };
export { $isRunningInNode };
export { $isRunningInWebWorker };
export { countCharacters };

@@ -94,5 +99,2 @@ export { countLines };

export { extractParameterNames };
export { isRunningInBrowser };
export { isRunningInNode };
export { isRunningInWebWorker };
export { capitalize };

@@ -99,0 +101,0 @@ export { decapitalize };

@@ -6,3 +6,3 @@ import type { AvailableModel } from '../../execution/LlmExecutionTools';

*
* Note: Done at 2024-05-25
* Note: Done at 2024-08-16
*

@@ -23,3 +23,3 @@ * @see https://docs.anthropic.com/en/docs/models-overview

* TODO: [🧠][👮‍♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
* TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
* TODO: [🎰] Some mechanism to auto-update available models
*/

@@ -6,2 +6,3 @@ import type { PostprocessingFunction } from '../../scripting/javascript/JavascriptExecutionToolsOptions';

*
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
* Note: You can provide postprocessing functions to modify the text before checking the expectations

@@ -8,0 +9,0 @@ * The result will be the text BEFORE the postprocessing

@@ -21,2 +21,2 @@ import type { LlmExecutionTools } from '../../execution/LlmExecutionTools';

* TODO: [👷‍♂️] @@@ Manual about construction of llmTools
*/
*/

@@ -21,3 +21,4 @@ import type { AvailableModel } from '../../execution/LlmExecutionTools';

* TODO: [🧠] Some mechanism to propagate unsureness
* TODO: [🕚][👮‍♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
* TODO: [🎰] Some mechanism to auto-update available models
* TODO: [🎰][👮‍♀️] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
* TODO: [🧠][👮‍♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...

@@ -24,0 +25,0 @@ * @see https://platform.openai.com/docs/models/gpt-4-turbo-and-gpt-4

@@ -5,2 +5,4 @@ import type { string_date_iso8601 } from '../types/typeAliases';

*
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic because it depends on the current time
*
* @returns string_date branded type

@@ -7,0 +9,0 @@ * @public exported from `@promptbook/utils`

@@ -5,2 +5,3 @@ import type { ReadonlyDeep } from 'type-fest';

*
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object

@@ -11,3 +12,3 @@ *

*/
export declare function deepFreeze<TObject>(objectValue: TObject): ReadonlyDeep<TObject>;
export declare function $deepFreeze<TObject>(objectValue: TObject): ReadonlyDeep<TObject>;
/**

@@ -14,0 +15,0 @@ * @@@

@@ -5,5 +5,7 @@ import type { string_folder_path } from '../../types/typeAliases';

*
* Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
*
* @private within the repository
*/
export declare function isDirectoryExisting(directoryPath: string_folder_path): Promise<boolean>;
export declare function $isDirectoryExisting(directoryPath: string_folder_path): Promise<boolean>;
/**

@@ -10,0 +12,0 @@ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`

@@ -5,5 +5,7 @@ import type { string_file_path } from '../../types/typeAliases';

*
* Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
*
* @private within the repository
*/
export declare function isFileExisting(filePath: string_file_path): Promise<boolean>;
export declare function $isFileExisting(filePath: string_file_path): Promise<boolean>;
/**

@@ -10,0 +12,0 @@ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`

@@ -6,2 +6,4 @@ import type { string_file_path } from '../../types/typeAliases';

*
* Note: `$` is used to indicate that this function is not a pure function - it looks at the filesystem
*
* @param path

@@ -12,3 +14,3 @@ * @param isRecursive

*/
export declare function listAllFiles(path: string_folder_path, isRecursive: boolean): Promise<Array<string_file_path>>;
export declare function $listAllFiles(path: string_folder_path, isRecursive: boolean): Promise<Array<string_file_path>>;
/**

@@ -15,0 +17,0 @@ * Note: [🟢] This code should never be published outside of `@promptbook/node` and `@promptbook/cli` and `@promptbook/cli`

@@ -5,2 +5,3 @@ import type { number_seed } from '../../types/typeAliases';

*
* Note: `$` is used to indicate that this function is not a pure function - it is not deterministic
* Warning: This function is not cryptographically secure (it uses Math.random internally)

@@ -7,0 +8,0 @@ * @public exported from `@promptbook/utils`

{
"name": "@promptbook/anthropic-claude",
"version": "0.65.0",
"version": "0.66.0-0",
"description": "Supercharge your use of large language models",

@@ -50,6 +50,6 @@ "private": false,

"peerDependencies": {
"@promptbook/core": "0.65.0"
"@promptbook/core": "0.66.0-0"
},
"dependencies": {
"@anthropic-ai/sdk": "0.21.1",
"@anthropic-ai/sdk": "0.26.1",
"colors": "1.4.0",

@@ -56,0 +56,0 @@ "socket.io-client": "4.7.2",

@@ -52,7 +52,13 @@ <!-- ⚠️ WARNING: This code has been generated so that any manual changes will be overwritten -->

const tools = {
llm: new AnthropicClaudeExecutionTools({
isVerbose: true,
apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
}),
script: [new JavascriptExecutionTools()],
llm: new AnthropicClaudeExecutionTools(
// <- TODO: [🧱] Implement in a functional (not new Class) way
{
isVerbose: true,
apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
},
),
script: [
new JavascriptExecutionTools(),
// <- TODO: [🧱] Implement in a functional (not new Class) way
],
};

@@ -96,3 +102,6 @@

llm: createLlmToolsFromEnv(),
script: [new JavascriptExecutionTools()],
script: [
new JavascriptExecutionTools(),
// <- TODO: [🧱] Implement in a functional (not new Class) way
],
};

@@ -137,15 +146,27 @@

// The best model will be chosen automatically according to the prompt and the model's capabilities.
new AnthropicClaudeExecutionTools({
apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
}),
new OpenAiExecutionTools({
apiKey: process.env.OPENAI_API_KEY,
}),
new AzureOpenAiExecutionTools({
resourceName: process.env.AZUREOPENAI_RESOURCE_NAME,
deploymentName: process.env.AZUREOPENAI_DEPLOYMENT_NAME,
apiKey: process.env.AZUREOPENAI_API_KEY,
}),
new AnthropicClaudeExecutionTools(
// <- TODO: [🧱] Implement in a functional (not new Class) way
{
apiKey: process.env.ANTHROPIC_CLAUDE_API_KEY,
},
),
new OpenAiExecutionTools(
// <- TODO: [🧱] Implement in a functional (not new Class) way
{
apiKey: process.env.OPENAI_API_KEY,
},
),
new AzureOpenAiExecutionTools(
// <- TODO: [🧱] Implement in a functional (not new Class) way
{
resourceName: process.env.AZUREOPENAI_RESOURCE_NAME,
deploymentName: process.env.AZUREOPENAI_DEPLOYMENT_NAME,
apiKey: process.env.AZUREOPENAI_API_KEY,
},
),
],
script: [new JavascriptExecutionTools()],
script: [
new JavascriptExecutionTools(),
// <- TODO: [🧱] Implement in a functional (not new Class) way
],
};

@@ -152,0 +173,0 @@

@@ -17,3 +17,3 @@ (function (global, factory) {

*/
var PROMPTBOOK_VERSION = '0.65.0-7';
var PROMPTBOOK_VERSION = '0.65.0';
// TODO: !!!! List here all the versions and annotate + put into script

@@ -143,3 +143,3 @@

*
* Note: Done at 2024-05-25
* Note: Done at 2024-08-16
*

@@ -152,2 +152,11 @@ * @see https://docs.anthropic.com/en/docs/models-overview

modelVariant: 'CHAT',
modelTitle: 'Claude 3.5 Sonnet',
modelName: 'claude-3-5-sonnet-20240620',
pricing: {
prompt: computeUsage("$3.00 / 1M tokens"),
output: computeUsage("$15.00 / 1M tokens"),
},
},
{
modelVariant: 'CHAT',
modelTitle: 'Claude 3 Opus',

@@ -212,3 +221,3 @@ modelName: 'claude-3-opus-20240229',

* TODO: [🧠][👮‍♀️] Put here more info like description, isVision, trainingDateCutoff, languages, strengths ( Top-level performance, intelligence, fluency, and understanding), contextWindow,...
* TODO: [🕚] Make this list dynamic - dynamically can be listed modelNames but not modelVariant, legacy status, context length and pricing
* TODO: [🎰] Some mechanism to auto-update available models
*/

@@ -630,2 +639,3 @@

*
* Note: `$` is used to indicate that this function is not a pure function - it mutates given object
* Note: This function mutates the object and returns the original (but mutated-deep-freezed) object

@@ -636,3 +646,3 @@ *

*/
function deepFreeze(objectValue) {
function $deepFreeze(objectValue) {
var e_1, _a;

@@ -645,3 +655,3 @@ var propertyNames = Object.getOwnPropertyNames(objectValue);

if (value && typeof value === 'object') {
deepFreeze(value);
$deepFreeze(value);
}

@@ -681,3 +691,3 @@ }

*/
deepFreeze([
$deepFreeze([
'content',

@@ -819,3 +829,5 @@ 'context',

delete anthropicOptions.isProxied;
this.client = new Anthropic__default["default"](anthropicOptions);
this.client = new Anthropic__default["default"](
// <- TODO: [🧱] Implement in a functional (not new Class) way
anthropicOptions);
}

@@ -841,3 +853,3 @@ Object.defineProperty(AnthropicClaudeExecutionTools.prototype, "title", {

return __awaiter(this, void 0, void 0, function () {
var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, resultContent, usage;
var content, parameters, modelRequirements, modelName, rawPromptContent, rawRequest, start, complete, rawResponse, contentBlock, resultContent, usage;
return __generator(this, function (_a) {

@@ -888,7 +900,12 @@ switch (_a.label) {

}
resultContent = rawResponse.content[0].text;
contentBlock = rawResponse.content[0];
if (contentBlock.type !== 'text') {
throw new PipelineExecutionError("Returned content is not \"text\" type but \"".concat(contentBlock.type, "\""));
}
console.log('!!!!!! rawResponse.usage', rawResponse.usage);
resultContent = contentBlock.text;
// eslint-disable-next-line prefer-const
complete = getCurrentIsoDate();
usage = {
price: { value: 0, isUncertain: true } /* <- TODO: [🐞] Compute usage */,
price: { value: 0, isUncertain: true } /* <- TODO: [🐞] !!!!!! Compute usage */,
input: __assign({ tokensCount: uncertainNumber(rawResponse.usage.input_tokens) }, computeUsageCounts(prompt.content)),

@@ -1061,3 +1078,5 @@ output: __assign({ tokensCount: uncertainNumber(rawResponse.usage.output_tokens) }, computeUsageCounts(prompt.content)),

var _this = this;
return new Promise(function (resolve, reject) {
return new Promise(
// <- TODO: [🧱] Implement in a functional (not new Class) way
function (resolve, reject) {
var socket = socket_ioClient.io(_this.options.remoteUrl, {

@@ -1187,3 +1206,5 @@ path: _this.options.path,

}
return new AnthropicClaudeExecutionTools(options);
return new AnthropicClaudeExecutionTools(
// <- TODO: [🧱] Implement in a functional (not new Class) way
options);
}

@@ -1190,0 +1211,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc