@promptbook/fake-llm
Advanced tools
Comparing version 0.59.0-30 to 0.59.0-31
@@ -846,5 +846,5 @@ import { spaceTrim } from 'spacetrim'; | ||
*/ | ||
var PROMPTBOOK_VERSION = '0.59.0-29'; | ||
var PROMPTBOOK_VERSION = '0.59.0-30'; | ||
export { MockedEchoLlmExecutionTools, MockedFackedLlmExecutionTools, PROMPTBOOK_VERSION }; | ||
//# sourceMappingURL=index.es.js.map |
@@ -16,2 +16,3 @@ import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptbookString'; | ||
import { createPromptbookExecutor } from '../execution/createPromptbookExecutor'; | ||
import { embeddingVectorToString } from '../execution/embeddingVectorToString'; | ||
import { addUsage } from '../execution/utils/addUsage'; | ||
@@ -37,3 +38,3 @@ import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations'; | ||
export { ExecutionTypes }; | ||
export { addUsage, assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prepareKnowledgeFromMarkdown, prettifyPromptbookString, usageToWorktime, }; | ||
export { addUsage, assertsExecutionSuccessful, checkExpectations, embeddingVectorToString, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prepareKnowledgeFromMarkdown, prettifyPromptbookString, usageToWorktime, }; | ||
export { createLibraryFromJson, createLibraryFromPromise, createLibraryFromUrl, createSublibrary, libraryToJson }; | ||
@@ -40,0 +41,0 @@ export { SimplePromptInterfaceTools }; |
import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions'; | ||
import { EmbeddingVector } from '../execution/EmbeddingVector'; | ||
import type { ExecutionTools } from '../execution/ExecutionTools'; | ||
import type { AvailableModel, LlmExecutionTools } from '../execution/LlmExecutionTools'; | ||
import type { PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptResultUsage, PromptResultUsageCounts, UncertainNumber } from '../execution/PromptResult'; | ||
import type { PromptEmbeddingResult, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptResultUsage, PromptResultUsageCounts, UncertainNumber } from '../execution/PromptResult'; | ||
import type { PromptbookExecutor } from '../execution/PromptbookExecutor'; | ||
@@ -29,5 +30,5 @@ import type { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../execution/ScriptExecutionTools'; | ||
export { EXPECTATION_UNITS }; | ||
export type { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_person_fullname, string_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, string_script, string_sha256, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_version, TaskProgress, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, }; | ||
export type { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptEmbeddingResult, EmbeddingVector, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_person_fullname, string_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, string_script, string_sha256, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_version, TaskProgress, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, }; | ||
/** | ||
* TODO: Delete type aliases (from ../types/typeAliases) that are not exported here | ||
*/ |
@@ -7,2 +7,3 @@ import type { KebabCase } from 'type-fest'; | ||
import type { string_model_name } from '../types/typeAliases'; | ||
import type { EmbeddingVector } from './EmbeddingVector'; | ||
/** | ||
@@ -24,2 +25,12 @@ * Prompt result is the simplest concept of execution. | ||
export type PromptChatResult = PromptCommonResult & {}; | ||
/** | ||
* Prompt embedding result | ||
* It contains only the following text NOT the whole completion | ||
*/ | ||
export type PromptEmbeddingResult = Omit<PromptCommonResult, 'content'> & { | ||
/** | ||
* The response from the model | ||
*/ | ||
content: EmbeddingVector; | ||
}; | ||
export type PromptCommonResult = { | ||
@@ -26,0 +37,0 @@ /** |
import type OpenAI from 'openai'; | ||
import type { PromptResult } from '../../execution/PromptResult'; | ||
import type { PromptResultUsage } from '../../execution/PromptResult'; | ||
@@ -8,2 +7,5 @@ import type { Prompt } from '../../types/Prompt'; | ||
* | ||
* @param promptContent The content of the prompt | ||
* @param resultContent The content of the result (for embedding prompts or failed prompts pass empty string) | ||
* @param rawResponse The raw response from OpenAI API | ||
* @throws {PromptbookExecutionError} If the usage is not defined in the response from OpenAI | ||
@@ -13,2 +15,2 @@ * @private internal util of `OpenAiExecutionTools` | ||
export declare function computeOpenaiUsage(promptContent: Prompt['content'], // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer | ||
resultContent: PromptResult['content'], rawResponse: Pick<OpenAI.Chat.Completions.ChatCompletion | OpenAI.Completions.Completion, 'model' | 'usage'>): PromptResultUsage; | ||
resultContent: string, rawResponse: Pick<OpenAI.Chat.Completions.ChatCompletion | OpenAI.Completions.Completion | OpenAI.Embeddings.CreateEmbeddingResponse, 'model' | 'usage'>): PromptResultUsage; |
@@ -5,2 +5,3 @@ import type { AvailableModel } from '../../execution/LlmExecutionTools'; | ||
import type { PromptCompletionResult } from '../../execution/PromptResult'; | ||
import type { PromptEmbeddingResult } from '../../execution/PromptResult'; | ||
import type { Prompt } from '../../types/Prompt'; | ||
@@ -32,5 +33,5 @@ import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions'; | ||
/** | ||
* !!!! | ||
* Calls OpenAI API to use a embedding model | ||
*/ | ||
embed(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptCompletionResult>; | ||
embed(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptEmbeddingResult>; | ||
/** | ||
@@ -37,0 +38,0 @@ * Default model for chat variant. |
@@ -0,1 +1,2 @@ | ||
import type { EmbeddingVector } from '../../execution/EmbeddingVector'; | ||
import type { string_keyword } from '../../utils/normalization/IKeywords'; | ||
@@ -14,3 +15,3 @@ import type { string_href } from '../typeAliases'; | ||
modelName: string_model_name; | ||
position: Array<number>; | ||
position: EmbeddingVector; | ||
}>; | ||
@@ -17,0 +18,0 @@ readonly sources: Array<{ |
{ | ||
"name": "@promptbook/fake-llm", | ||
"version": "0.59.0-30", | ||
"version": "0.59.0-31", | ||
"description": "Library to supercharge your use of large language models", | ||
@@ -51,3 +51,3 @@ "private": false, | ||
"peerDependencies": { | ||
"@promptbook/core": "0.59.0-30" | ||
"@promptbook/core": "0.59.0-31" | ||
}, | ||
@@ -54,0 +54,0 @@ "main": "./umd/index.umd.js", |
@@ -849,3 +849,3 @@ (function (global, factory) { | ||
*/ | ||
var PROMPTBOOK_VERSION = '0.59.0-29'; | ||
var PROMPTBOOK_VERSION = '0.59.0-30'; | ||
@@ -852,0 +852,0 @@ exports.MockedEchoLlmExecutionTools = MockedEchoLlmExecutionTools; |
@@ -16,2 +16,3 @@ import { prettifyPromptbookString } from '../conversion/prettify/prettifyPromptbookString'; | ||
import { createPromptbookExecutor } from '../execution/createPromptbookExecutor'; | ||
import { embeddingVectorToString } from '../execution/embeddingVectorToString'; | ||
import { addUsage } from '../execution/utils/addUsage'; | ||
@@ -37,3 +38,3 @@ import { checkExpectations, isPassingExpectations } from '../execution/utils/checkExpectations'; | ||
export { ExecutionTypes }; | ||
export { addUsage, assertsExecutionSuccessful, checkExpectations, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prepareKnowledgeFromMarkdown, prettifyPromptbookString, usageToWorktime, }; | ||
export { addUsage, assertsExecutionSuccessful, checkExpectations, embeddingVectorToString, executionReportJsonToString, ExecutionReportStringOptions, ExecutionReportStringOptionsDefaults, isPassingExpectations, prepareKnowledgeFromMarkdown, prettifyPromptbookString, usageToWorktime, }; | ||
export { createLibraryFromJson, createLibraryFromPromise, createLibraryFromUrl, createSublibrary, libraryToJson }; | ||
@@ -40,0 +41,0 @@ export { SimplePromptInterfaceTools }; |
import type { CommonExecutionToolsOptions } from '../execution/CommonExecutionToolsOptions'; | ||
import { EmbeddingVector } from '../execution/EmbeddingVector'; | ||
import type { ExecutionTools } from '../execution/ExecutionTools'; | ||
import type { AvailableModel, LlmExecutionTools } from '../execution/LlmExecutionTools'; | ||
import type { PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptResultUsage, PromptResultUsageCounts, UncertainNumber } from '../execution/PromptResult'; | ||
import type { PromptEmbeddingResult, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptResult, PromptResultUsage, PromptResultUsageCounts, UncertainNumber } from '../execution/PromptResult'; | ||
import type { PromptbookExecutor } from '../execution/PromptbookExecutor'; | ||
@@ -29,5 +30,5 @@ import type { ScriptExecutionTools, ScriptExecutionToolsExecuteOptions } from '../execution/ScriptExecutionTools'; | ||
export { EXPECTATION_UNITS }; | ||
export type { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_person_fullname, string_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, string_script, string_sha256, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_version, TaskProgress, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, }; | ||
export type { AvailableModel, client_id, CommonExecutionToolsOptions, ExecutionReportJson, ExecutionTools, ExecutionType, ExpectationAmount, Expectations, ExpectationUnit, FromtoItems, KnowledgeJson, LlmExecutionTools, LlmTemplateJson, MaterialKnowledgePieceJson, ModelRequirements, ModelVariant, Parameters, Prompt, PromptbookExecutor, PromptbookJson, PromptbookLibrary, PromptbookString, PromptChatResult, PromptEmbeddingResult, EmbeddingVector, PromptCommonResult, PromptCompletionResult, PromptDialogJson, PromptResult, PromptResultUsage, PromptResultUsageCounts, PromptTemplateJson, PromptTemplateParameterJson, ScriptExecutionTools, ScriptExecutionToolsExecuteOptions, ScriptJson, ScriptLanguage, SimpleTemplateJson, string_char, string_char_emoji, string_chat_prompt, string_completion_prompt, string_data_url, string_domain, string_email, string_file_absolute_path, string_file_extension, string_file_path, string_file_relative_path, string_filename, string_folder_absolute_path, string_folder_path, string_folder_relative_path, string_host, string_hostname, string_href, string_html, string_javascript, string_javascript_name, string_license, string_markdown, string_markdown_text, string_mime_type, string_mime_type_with_wildcard, string_model_name, string_name, string_person_fullname, string_prompt, string_promptbook_url, string_promptbook_url_with_hashtemplate, string_script, string_sha256, string_tdl, string_template, string_text_prompt, string_title, string_token, string_translate_language, string_uri, string_uri_part, string_url, string_url_image, string_version, TaskProgress, UncertainNumber, UserInterfaceTools, UserInterfaceToolsPromptDialogOptions, }; | ||
/** | ||
* TODO: Delete type aliases (from ../types/typeAliases) that are not exported here | ||
*/ |
@@ -7,2 +7,3 @@ import type { KebabCase } from 'type-fest'; | ||
import type { string_model_name } from '../types/typeAliases'; | ||
import type { EmbeddingVector } from './EmbeddingVector'; | ||
/** | ||
@@ -24,2 +25,12 @@ * Prompt result is the simplest concept of execution. | ||
export type PromptChatResult = PromptCommonResult & {}; | ||
/** | ||
* Prompt embedding result | ||
* It contains only the following text NOT the whole completion | ||
*/ | ||
export type PromptEmbeddingResult = Omit<PromptCommonResult, 'content'> & { | ||
/** | ||
* The response from the model | ||
*/ | ||
content: EmbeddingVector; | ||
}; | ||
export type PromptCommonResult = { | ||
@@ -26,0 +37,0 @@ /** |
import type OpenAI from 'openai'; | ||
import type { PromptResult } from '../../execution/PromptResult'; | ||
import type { PromptResultUsage } from '../../execution/PromptResult'; | ||
@@ -8,2 +7,5 @@ import type { Prompt } from '../../types/Prompt'; | ||
* | ||
* @param promptContent The content of the prompt | ||
* @param resultContent The content of the result (for embedding prompts or failed prompts pass empty string) | ||
* @param rawResponse The raw response from OpenAI API | ||
* @throws {PromptbookExecutionError} If the usage is not defined in the response from OpenAI | ||
@@ -13,2 +15,2 @@ * @private internal util of `OpenAiExecutionTools` | ||
export declare function computeOpenaiUsage(promptContent: Prompt['content'], // <- Note: Intentionally using [] to access type properties to bring jsdoc from Prompt/PromptResult to consumer | ||
resultContent: PromptResult['content'], rawResponse: Pick<OpenAI.Chat.Completions.ChatCompletion | OpenAI.Completions.Completion, 'model' | 'usage'>): PromptResultUsage; | ||
resultContent: string, rawResponse: Pick<OpenAI.Chat.Completions.ChatCompletion | OpenAI.Completions.Completion | OpenAI.Embeddings.CreateEmbeddingResponse, 'model' | 'usage'>): PromptResultUsage; |
@@ -5,2 +5,3 @@ import type { AvailableModel } from '../../execution/LlmExecutionTools'; | ||
import type { PromptCompletionResult } from '../../execution/PromptResult'; | ||
import type { PromptEmbeddingResult } from '../../execution/PromptResult'; | ||
import type { Prompt } from '../../types/Prompt'; | ||
@@ -32,5 +33,5 @@ import type { OpenAiExecutionToolsOptions } from './OpenAiExecutionToolsOptions'; | ||
/** | ||
* !!!! | ||
* Calls OpenAI API to use a embedding model | ||
*/ | ||
embed(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptCompletionResult>; | ||
embed(prompt: Pick<Prompt, 'content' | 'modelRequirements'>): Promise<PromptEmbeddingResult>; | ||
/** | ||
@@ -37,0 +38,0 @@ * Default model for chat variant. |
@@ -0,1 +1,2 @@ | ||
import type { EmbeddingVector } from '../../execution/EmbeddingVector'; | ||
import type { string_keyword } from '../../utils/normalization/IKeywords'; | ||
@@ -14,3 +15,3 @@ import type { string_href } from '../typeAliases'; | ||
modelName: string_model_name; | ||
position: Array<number>; | ||
position: EmbeddingVector; | ||
}>; | ||
@@ -17,0 +18,0 @@ readonly sources: Array<{ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
575505
580
10047