UNPKG

@promptbook/azure-openai

Version:

Promptbook: Run AI apps in plain human language across multiple models and platforms

299 lines (298 loc) 16.5 kB
import { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION } from '../version'; import { collectionToJson } from '../collection/collectionToJson'; import { createCollectionFromJson } from '../collection/constructors/createCollectionFromJson'; import { createCollectionFromPromise } from '../collection/constructors/createCollectionFromPromise'; import { createCollectionFromUrl } from '../collection/constructors/createCollectionFromUrl'; import { createSubcollection } from '../collection/constructors/createSubcollection'; import { NAME } from '../config'; import { ADMIN_EMAIL } from '../config'; import { ADMIN_GITHUB_NAME } from '../config'; import { CLAIM } from '../config'; import { DEFAULT_BOOK_TITLE } from '../config'; import { DEFAULT_TASK_TITLE } from '../config'; import { DEFAULT_PROMPT_TASK_TITLE } from '../config'; import { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME } from '../config'; import { DEFAULT_MAX_FILE_SIZE } from '../config'; import { BIG_DATASET_TRESHOLD } from '../config'; import { FAILED_VALUE_PLACEHOLDER } from '../config'; import { PENDING_VALUE_PLACEHOLDER } from '../config'; import { MAX_FILENAME_LENGTH } from '../config'; import { DEFAULT_INTERMEDIATE_FILES_STRATEGY } from '../config'; import { DEFAULT_MAX_PARALLEL_COUNT } from '../config'; import { DEFAULT_MAX_EXECUTION_ATTEMPTS } from '../config'; import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH } from '../config'; import { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL } from '../config'; import { DEFAULT_BOOKS_DIRNAME } from '../config'; import { DEFAULT_DOWNLOAD_CACHE_DIRNAME } from '../config'; import { DEFAULT_EXECUTION_CACHE_DIRNAME } from '../config'; import { DEFAULT_SCRAPE_CACHE_DIRNAME } from '../config'; import { CLI_APP_ID } from '../config'; import { PLAYGROUND_APP_ID } from '../config'; import { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME } from '../config'; import { DEFAULT_REMOTE_SERVER_URL } from '../config'; import { DEFAULT_CSV_SETTINGS } from '../config'; import { DEFAULT_IS_VERBOSE } from '../config'; import { SET_IS_VERBOSE } from '../config'; import { DEFAULT_IS_AUTO_INSTALLED } from '../config'; import { DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME } from '../config'; import { DEFAULT_MAX_REQUESTS_PER_MINUTE } from '../config'; import { MODEL_TRUST_LEVELS } from '../constants'; import { MODEL_ORDERS } from '../constants'; import { ORDER_OF_PIPELINE_JSON } from '../constants'; import { RESERVED_PARAMETER_NAMES } from '../constants'; import { compilePipeline } from '../conversion/compilePipeline'; import { parsePipeline } from '../conversion/parsePipeline'; import { pipelineJsonToString } from '../conversion/pipelineJsonToString'; import { prettifyPipelineString } from '../conversion/prettify/prettifyPipelineString'; import { extractParameterNamesFromTask } from '../conversion/utils/extractParameterNamesFromTask'; import { validatePipeline } from '../conversion/validation/validatePipeline'; import { CallbackInterfaceTools } from '../dialogs/callback/CallbackInterfaceTools'; import type { CallbackInterfaceToolsOptions } from '../dialogs/callback/CallbackInterfaceToolsOptions'; import { BoilerplateError } from '../errors/0-BoilerplateError'; import { PROMPTBOOK_ERRORS } from '../errors/0-index'; import { AbstractFormatError } from '../errors/AbstractFormatError'; import { AuthenticationError } from '../errors/AuthenticationError'; import { CollectionError } from '../errors/CollectionError'; import { EnvironmentMismatchError } from '../errors/EnvironmentMismatchError'; import { ExpectError } from '../errors/ExpectError'; import { KnowledgeScrapeError } from '../errors/KnowledgeScrapeError'; import { LimitReachedError } from '../errors/LimitReachedError'; import { MissingToolsError } from '../errors/MissingToolsError'; import { NotFoundError } from '../errors/NotFoundError'; import { NotYetImplementedError } from '../errors/NotYetImplementedError'; import { ParseError } from '../errors/ParseError'; import { PipelineExecutionError } from '../errors/PipelineExecutionError'; import { PipelineLogicError } from '../errors/PipelineLogicError'; import { PipelineUrlError } from '../errors/PipelineUrlError'; import { PromptbookFetchError } from '../errors/PromptbookFetchError'; import { UnexpectedError } from '../errors/UnexpectedError'; import { WrappedError } from '../errors/WrappedError'; import { createPipelineExecutor } from '../execution/createPipelineExecutor/00-createPipelineExecutor'; import { computeCosineSimilarity } from '../execution/createPipelineExecutor/computeCosineSimilarity'; import { embeddingVectorToString } from '../execution/embeddingVectorToString'; import { executionReportJsonToString } from '../execution/execution-report/executionReportJsonToString'; import type { ExecutionReportStringOptions } from '../execution/execution-report/ExecutionReportStringOptions'; import { ExecutionReportStringOptionsDefaults } from '../execution/execution-report/ExecutionReportStringOptions'; import { addUsage } from '../execution/utils/addUsage'; import { isPassingExpectations } from '../execution/utils/checkExpectations'; import { ZERO_VALUE } from '../execution/utils/usage-constants'; import { UNCERTAIN_ZERO_VALUE } from '../execution/utils/usage-constants'; import { ZERO_USAGE } from '../execution/utils/usage-constants'; import { UNCERTAIN_USAGE } from '../execution/utils/usage-constants'; import { usageToHuman } from '../execution/utils/usageToHuman'; import { usageToWorktime } from '../execution/utils/usageToWorktime'; import { CsvFormatError } from '../formats/csv/CsvFormatError'; import { CsvFormatParser } from '../formats/csv/CsvFormatParser'; import { MANDATORY_CSV_SETTINGS } from '../formats/csv/CsvSettings'; import { TextFormatParser } from '../formats/text/TextFormatParser'; import { BoilerplateFormfactorDefinition } from '../formfactors/_boilerplate/BoilerplateFormfactorDefinition'; import { ChatbotFormfactorDefinition } from '../formfactors/chatbot/ChatbotFormfactorDefinition'; import { CompletionFormfactorDefinition } from '../formfactors/completion/CompletionFormfactorDefinition'; import { GeneratorFormfactorDefinition } from '../formfactors/generator/GeneratorFormfactorDefinition'; import { GenericFormfactorDefinition } from '../formfactors/generic/GenericFormfactorDefinition'; import { ImageGeneratorFormfactorDefinition } from '../formfactors/image-generator/ImageGeneratorFormfactorDefinition'; import { FORMFACTOR_DEFINITIONS } from '../formfactors/index'; import { MatcherFormfactorDefinition } from '../formfactors/matcher/MatcherFormfactorDefinition'; import { SheetsFormfactorDefinition } from '../formfactors/sheets/SheetsFormfactorDefinition'; import { TranslatorFormfactorDefinition } from '../formfactors/translator/TranslatorFormfactorDefinition'; import { filterModels } from '../llm-providers/_common/filterModels'; import { $llmToolsMetadataRegister } from '../llm-providers/_common/register/$llmToolsMetadataRegister'; import { $llmToolsRegister } from '../llm-providers/_common/register/$llmToolsRegister'; import { createLlmToolsFromConfiguration } from '../llm-providers/_common/register/createLlmToolsFromConfiguration'; import { cacheLlmTools } from '../llm-providers/_common/utils/cache/cacheLlmTools'; import { countUsage } from '../llm-providers/_common/utils/count-total-usage/countUsage'; import { limitTotalUsage } from '../llm-providers/_common/utils/count-total-usage/limitTotalUsage'; import { joinLlmExecutionTools } from '../llm-providers/_multiple/joinLlmExecutionTools'; import { MultipleLlmExecutionTools } from '../llm-providers/_multiple/MultipleLlmExecutionTools'; import { _AnthropicClaudeMetadataRegistration } from '../llm-providers/anthropic-claude/register-configuration'; import { _AzureOpenAiMetadataRegistration } from '../llm-providers/azure-openai/register-configuration'; import { _DeepseekMetadataRegistration } from '../llm-providers/deepseek/register-configuration'; import { _GoogleMetadataRegistration } from '../llm-providers/google/register-configuration'; import { _OllamaMetadataRegistration } from '../llm-providers/ollama/register-configuration'; import { _OpenAiMetadataRegistration } from '../llm-providers/openai/register-configuration'; import { _OpenAiAssistantMetadataRegistration } from '../llm-providers/openai/register-configuration'; import { _OpenAiCompatibleMetadataRegistration } from '../llm-providers/openai/register-configuration'; import { migratePipeline } from '../migrations/migratePipeline'; import { preparePersona } from '../personas/preparePersona'; import { book } from '../pipeline/book-notation'; import { isValidPipelineString } from '../pipeline/isValidPipelineString'; import { GENERIC_PIPELINE_INTERFACE } from '../pipeline/PipelineInterface/constants'; import { getPipelineInterface } from '../pipeline/PipelineInterface/getPipelineInterface'; import { isPipelineImplementingInterface } from '../pipeline/PipelineInterface/isPipelineImplementingInterface'; import { isPipelineInterfacesEqual } from '../pipeline/PipelineInterface/isPipelineInterfacesEqual'; import { EXPECTATION_UNITS } from '../pipeline/PipelineJson/Expectations'; import { validatePipelineString } from '../pipeline/validatePipelineString'; import { isPipelinePrepared } from '../prepare/isPipelinePrepared'; import { preparePipeline } from '../prepare/preparePipeline'; import { unpreparePipeline } from '../prepare/unpreparePipeline'; import { identificationToPromptbookToken } from '../remote-server/socket-types/_subtypes/identificationToPromptbookToken'; import { promptbookTokenToIdentification } from '../remote-server/socket-types/_subtypes/promptbookTokenToIdentification'; import { _BoilerplateScraperMetadataRegistration } from '../scrapers/_boilerplate/register-metadata'; import { prepareKnowledgePieces } from '../scrapers/_common/prepareKnowledgePieces'; import { $scrapersMetadataRegister } from '../scrapers/_common/register/$scrapersMetadataRegister'; import { $scrapersRegister } from '../scrapers/_common/register/$scrapersRegister'; import { makeKnowledgeSourceHandler } from '../scrapers/_common/utils/makeKnowledgeSourceHandler'; import { promptbookFetch } from '../scrapers/_common/utils/promptbookFetch'; import { _LegacyDocumentScraperMetadataRegistration } from '../scrapers/document-legacy/register-metadata'; import { _DocumentScraperMetadataRegistration } from '../scrapers/document/register-metadata'; import { _MarkdownScraperMetadataRegistration } from '../scrapers/markdown/register-metadata'; import { _MarkitdownScraperMetadataRegistration } from '../scrapers/markitdown/register-metadata'; import { _PdfScraperMetadataRegistration } from '../scrapers/pdf/register-metadata'; import { _WebsiteScraperMetadataRegistration } from '../scrapers/website/register-metadata'; import { BlackholeStorage } from '../storage/blackhole/BlackholeStorage'; import { MemoryStorage } from '../storage/memory/MemoryStorage'; import { PrefixStorage } from '../storage/utils/PrefixStorage'; import { MODEL_VARIANTS } from '../types/ModelVariant'; import { NonTaskSectionTypes } from '../types/SectionType'; import { SectionTypes } from '../types/SectionType'; import { TaskTypes } from '../types/TaskType'; import { REMOTE_SERVER_URLS } from '../../servers'; export { BOOK_LANGUAGE_VERSION, PROMPTBOOK_ENGINE_VERSION }; export { collectionToJson }; export { createCollectionFromJson }; export { createCollectionFromPromise }; export { createCollectionFromUrl }; export { createSubcollection }; export { NAME }; export { ADMIN_EMAIL }; export { ADMIN_GITHUB_NAME }; export { CLAIM }; export { DEFAULT_BOOK_TITLE }; export { DEFAULT_TASK_TITLE }; export { DEFAULT_PROMPT_TASK_TITLE }; export { DEFAULT_BOOK_OUTPUT_PARAMETER_NAME }; export { DEFAULT_MAX_FILE_SIZE }; export { BIG_DATASET_TRESHOLD }; export { FAILED_VALUE_PLACEHOLDER }; export { PENDING_VALUE_PLACEHOLDER }; export { MAX_FILENAME_LENGTH }; export { DEFAULT_INTERMEDIATE_FILES_STRATEGY }; export { DEFAULT_MAX_PARALLEL_COUNT }; export { DEFAULT_MAX_EXECUTION_ATTEMPTS }; export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_DEPTH }; export { DEFAULT_MAX_KNOWLEDGE_SOURCES_SCRAPING_TOTAL }; export { DEFAULT_BOOKS_DIRNAME }; export { DEFAULT_DOWNLOAD_CACHE_DIRNAME }; export { DEFAULT_EXECUTION_CACHE_DIRNAME }; export { DEFAULT_SCRAPE_CACHE_DIRNAME }; export { CLI_APP_ID }; export { PLAYGROUND_APP_ID }; export { DEFAULT_PIPELINE_COLLECTION_BASE_FILENAME }; export { DEFAULT_REMOTE_SERVER_URL }; export { DEFAULT_CSV_SETTINGS }; export { DEFAULT_IS_VERBOSE }; export { SET_IS_VERBOSE }; export { DEFAULT_IS_AUTO_INSTALLED }; export { DEFAULT_GET_PIPELINE_COLLECTION_FUNCTION_NAME }; export { DEFAULT_MAX_REQUESTS_PER_MINUTE }; export { MODEL_TRUST_LEVELS }; export { MODEL_ORDERS }; export { ORDER_OF_PIPELINE_JSON }; export { RESERVED_PARAMETER_NAMES }; export { compilePipeline }; export { parsePipeline }; export { pipelineJsonToString }; export { prettifyPipelineString }; export { extractParameterNamesFromTask }; export { validatePipeline }; export { CallbackInterfaceTools }; export type { CallbackInterfaceToolsOptions }; export { BoilerplateError }; export { PROMPTBOOK_ERRORS }; export { AbstractFormatError }; export { AuthenticationError }; export { CollectionError }; export { EnvironmentMismatchError }; export { ExpectError }; export { KnowledgeScrapeError }; export { LimitReachedError }; export { MissingToolsError }; export { NotFoundError }; export { NotYetImplementedError }; export { ParseError }; export { PipelineExecutionError }; export { PipelineLogicError }; export { PipelineUrlError }; export { PromptbookFetchError }; export { UnexpectedError }; export { WrappedError }; export { createPipelineExecutor }; export { computeCosineSimilarity }; export { embeddingVectorToString }; export { executionReportJsonToString }; export type { ExecutionReportStringOptions }; export { ExecutionReportStringOptionsDefaults }; export { addUsage }; export { isPassingExpectations }; export { ZERO_VALUE }; export { UNCERTAIN_ZERO_VALUE }; export { ZERO_USAGE }; export { UNCERTAIN_USAGE }; export { usageToHuman }; export { usageToWorktime }; export { CsvFormatError }; export { CsvFormatParser }; export { MANDATORY_CSV_SETTINGS }; export { TextFormatParser }; export { BoilerplateFormfactorDefinition }; export { ChatbotFormfactorDefinition }; export { CompletionFormfactorDefinition }; export { GeneratorFormfactorDefinition }; export { GenericFormfactorDefinition }; export { ImageGeneratorFormfactorDefinition }; export { FORMFACTOR_DEFINITIONS }; export { MatcherFormfactorDefinition }; export { SheetsFormfactorDefinition }; export { TranslatorFormfactorDefinition }; export { filterModels }; export { $llmToolsMetadataRegister }; export { $llmToolsRegister }; export { createLlmToolsFromConfiguration }; export { cacheLlmTools }; export { countUsage }; export { limitTotalUsage }; export { joinLlmExecutionTools }; export { MultipleLlmExecutionTools }; export { _AnthropicClaudeMetadataRegistration }; export { _AzureOpenAiMetadataRegistration }; export { _DeepseekMetadataRegistration }; export { _GoogleMetadataRegistration }; export { _OllamaMetadataRegistration }; export { _OpenAiMetadataRegistration }; export { _OpenAiAssistantMetadataRegistration }; export { _OpenAiCompatibleMetadataRegistration }; export { migratePipeline }; export { preparePersona }; export { book }; export { isValidPipelineString }; export { GENERIC_PIPELINE_INTERFACE }; export { getPipelineInterface }; export { isPipelineImplementingInterface }; export { isPipelineInterfacesEqual }; export { EXPECTATION_UNITS }; export { validatePipelineString }; export { isPipelinePrepared }; export { preparePipeline }; export { unpreparePipeline }; export { identificationToPromptbookToken }; export { promptbookTokenToIdentification }; export { _BoilerplateScraperMetadataRegistration }; export { prepareKnowledgePieces }; export { $scrapersMetadataRegister }; export { $scrapersRegister }; export { makeKnowledgeSourceHandler }; export { promptbookFetch }; export { _LegacyDocumentScraperMetadataRegistration }; export { _DocumentScraperMetadataRegistration }; export { _MarkdownScraperMetadataRegistration }; export { _MarkitdownScraperMetadataRegistration }; export { _PdfScraperMetadataRegistration }; export { _WebsiteScraperMetadataRegistration }; export { BlackholeStorage }; export { MemoryStorage }; export { PrefixStorage }; export { MODEL_VARIANTS }; export { NonTaskSectionTypes }; export { SectionTypes }; export { TaskTypes }; export { REMOTE_SERVER_URLS };