@prompt-foundry/typescript-sdk
Advanced tools
Comparing version 1.0.17 to 1.0.19
import { ChatCompletionCreateParamsNonStreaming } from 'openai/resources'; | ||
import { Evaluation, EvaluationBody, EvaluationGroup, EvaluationGroupBody, PromptConfiguration, PromptConfigurationBody, PromptTool, PromptToolBody } from './types'; | ||
import { Evaluation, EvaluationBody, EvaluationGroup, EvaluationGroupBody, PromptConfiguration, PromptConfigurationBody, PromptMessage, PromptTool, PromptToolBody } from './types'; | ||
export default class PromptFoundry { | ||
@@ -12,9 +12,15 @@ private client; | ||
}): Promise<PromptConfiguration>; | ||
getPrompt({ id, variables }: { | ||
getPrompt({ id, variables, appendMessages, overrideMessages }: { | ||
id: string; | ||
variables: Record<string, string>; | ||
appendMessages?: PromptMessage[]; | ||
overrideMessages?: PromptMessage[]; | ||
userId?: string; | ||
}): Promise<PromptConfiguration>; | ||
getOpenAiPrompt({ id, variables }: { | ||
getOpenAiPrompt({ id, variables, user, appendMessages, overrideMessages }: { | ||
id: string; | ||
variables: Record<string, string>; | ||
appendMessages?: PromptMessage[]; | ||
overrideMessages?: PromptMessage[]; | ||
user?: string; | ||
}): Promise<ChatCompletionCreateParamsNonStreaming>; | ||
@@ -21,0 +27,0 @@ createPrompt(data: PromptConfigurationBody): Promise<PromptConfiguration>; |
@@ -18,3 +18,3 @@ "use strict"; | ||
} | ||
async getPrompt({ id, variables }) { | ||
async getPrompt({ id, variables, appendMessages, overrideMessages }) { | ||
const result = await this.getRawPrompt({ id }); | ||
@@ -25,7 +25,16 @@ if (!(0, helpers_1.validatePromptVariables)(result, variables)) { | ||
} | ||
return (0, helpers_1.renderPromptWithVariables)(result, variables); | ||
const updatedWithVariables = (0, helpers_1.renderPromptWithVariables)(result, variables); | ||
if (overrideMessages) { | ||
return (0, helpers_1.addOverrideMessages)(updatedWithVariables, overrideMessages); | ||
} | ||
if (appendMessages) { | ||
return (0, helpers_1.addAppendedMessages)(updatedWithVariables, appendMessages); | ||
} | ||
return updatedWithVariables; | ||
} | ||
async getOpenAiPrompt({ id, variables }) { | ||
const updatedWithVariables = await this.getPrompt({ id, variables }); | ||
return (0, openAi_1.mapPromptToOpenAIConfig)(updatedWithVariables); | ||
async getOpenAiPrompt({ id, variables, user, appendMessages, overrideMessages }) { | ||
const updatedWithVariables = await this.getPrompt({ id, variables, appendMessages, overrideMessages }); | ||
return (0, openAi_1.mapPromptToOpenAIConfig)(updatedWithVariables, { | ||
user | ||
}); | ||
} | ||
@@ -175,2 +184,2 @@ createPrompt(data) { | ||
exports.default = PromptFoundry; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2xpZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL0NsaWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUVBLHVDQUF5RztBQUN6Ryw2Q0FBMEQ7QUFDMUQsNkNBQXVEO0FBWXZELE1BQXFCLGFBQWE7SUFLaEMsWUFBWSxFQUFFLE1BQU0sRUFBc0I7UUFDeEMscUVBQXFFO1FBQ3JFLElBQUksTUFBTSxLQUFLLEVBQUUsSUFBSSxNQUFNLEtBQUssU0FBUyxJQUFJLE1BQU0sS0FBSyxJQUFJLElBQUksTUFBTSxLQUFLLENBQUMsRUFBRSxDQUFDO1lBQzdFLE1BQU0sSUFBSSxLQUFLLENBQUMscUNBQXFDLENBQUMsQ0FBQTtRQUN4RCxDQUFDO1FBRUQsSUFBSSxDQUFDLE1BQU0sR0FBRyxNQUFNLENBQUE7UUFFcEIsSUFBSSxDQUFDLE1BQU0sR0FBRyxJQUFBLHdCQUFlLEVBQUMscUNBQXFDLENBQUMsQ0FBQTtJQUN0RSxDQUFDO0lBRU0sS0FBSyxDQUFDLFlBQVksQ0FBQyxFQUFFLEVBQUUsRUFBa0I7UUFDOUMsT0FBTyxJQUFJLENBQUMsTUFBTSxDQUFDLFNBQVMsQ0FBQyxFQUFFLE1BQU0sRUFBRSxFQ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kFBZ0IsQ0FBQyxFQUFFLEVBQUUsRUFBa0I7UUFDbEQsTUFBTSxJQUFJLENBQUMsTUFBTSxDQUFDLGdCQUFnQixDQUFDLFNBQVMsRUFBRTtZQUM1QyxNQUFNLEVBQUUsRUFBRSxZQUFZLEVBQUUsRUFBRSxFQUFFO1lBQzVCLE9BQU8sRUFBRTtnQkFDUCxXQUFXLEVBQUUsSUFBSSxDQUFDLE1BQU07YUFDekI7U0FDRixDQUFDLENBQUE7UUFFRixPQUFPLElBQUksQ0FBQTtJQUNiLENBQUM7SUFFTSxhQUFhLENBQUMsRUFBRSxFQUFFLEVBQWtCO1FBQ3pDLE9BQU8sSUFBSSxDQUFDLE1BQU0sQ0FBQyxhQUFhLENBQUM7WUFDL0IsTUFBTSxFQUFFLEVBQUUsWUFBWSxFQUFFLEVBQUUsRUFBRTtZQUM1QixPQUFPLEVBQUU7Z0JBQ1AsV0FBVyxFQUFFLElBQUksQ0FBQyxNQUFNO2FBQ3pCO1NBQ0YsQ0FBQyxDQUFBO0lBQ0osQ0FBQztJQUVNLGNBQWM7UUFDbkIsT0FBTyxJQUFJLENBQUMsTUFBTSxDQUFDLGNBQWMsQ0FBQztZQUNoQyxPQUFPLEVBQUU7Z0JBQ1AsV0FBVyxFQUFFLElBQUksQ0FBQyxNQUFNO2FBQ3pCO1NBQ0YsQ0FBQyxDQUFBO0lBQ0osQ0FBQztDQUNGO0FBMU9ELGdDQTBPQyJ9 |
@@ -5,2 +5,4 @@ import { ChatCompletionCreateParamsNonStreaming, ChatCompletionMessageParam, ChatCompletionToolChoiceOption } from 'openai/resources'; | ||
export declare const mapToolChoiceToOpenAI: (tools: PromptTool[], toolChoice?: string | null) => ChatCompletionToolChoiceOption | undefined; | ||
export declare const mapPromptToOpenAIConfig: (promptConfig: PromptConfiguration) => ChatCompletionCreateParamsNonStreaming; | ||
export declare const mapPromptToOpenAIConfig: (promptConfig: PromptConfiguration, { user }?: { | ||
user?: string; | ||
}) => ChatCompletionCreateParamsNonStreaming; |
@@ -98,3 +98,3 @@ "use strict"; | ||
}; | ||
const mapPromptToOpenAIConfig = (promptConfig) => { | ||
const mapPromptToOpenAIConfig = (promptConfig, { user } = {}) => { | ||
const { messages: promptMessages, parameters, tools } = promptConfig; | ||
@@ -115,6 +115,7 @@ const messages = (0, exports.mapMessagesToOpenAI)(promptMessages); | ||
}, | ||
tools: getTools(tools) | ||
tools: getTools(tools), | ||
user | ||
}; | ||
}; | ||
exports.mapPromptToOpenAIConfig = mapPromptToOpenAIConfig; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3BlbkFpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2hlbHBlcnMvb3BlbkFpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQVdPLE1BQU0sbUJBQW1CLEdBQUcsQ0FBQyxRQUF5QixFQUFnQyxFQUFFO0lBQzdGLE9BQU8sUUFBUSxDQUFDLEdBQUcsQ0FBQyxDQUFDLE9BQU8sRUFBOEIsRUFBRTs7UUFDMUQsTUFBTSxJQUFJLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxXQUFXLEVBQXdCLENBQUE7UUFDN0QsSUFBSSxJQUFJLEtBQUssTUFBTSxFQUFFLENBQUM7WUFDcEIsSUFBSSxDQUFDLE9BQU8sQ0FBQyxVQUFVLEVBQUUsQ0FBQztnQkFDeEIsTUFBTSxJQUFJLEtBQUssQ0FBQyxnQ0FBZ0MsQ0FBQyxDQUFBO1lBQ25ELENBQUM7WUFFRCxJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sRUFBRSxDQUFDO2dCQUNyQixNQUFNLElBQUksS0FBSyxDQUFDLDhCQUE4QixDQUFDLENBQUE7WUFDakQsQ0FBQztZQUVELE9BQU87Z0JBQ0wsSUFBSTtnQkFDSixPQUFPLEVBQUUsT0FBTyxDQUFDLE9BQU87Z0JBQ3hCL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XBELE9BQU87UUFDTCxRQUFRO1FBQ1IsS0FBSyxFQUFFLFVBQVUsQ0FBQyxTQUFTO1FBQzNCLEtBQUssRUFBRSxVQUFVLENBQUMsSUFBSTtRQUN0QixVQUFVLEVBQUUsVUFBVSxDQUFDLFNBQVM7UUFDaEMsV0FBVyxFQUFFLFVBQVUsQ0FBQyxXQUFXO1FBQ25DLElBQUksRUFBRSxVQUFVLENBQUMsSUFBSTtRQUNyQixnQkFBZ0IsRUFBRSxVQUFVLENBQUMsZUFBZTtRQUM1QyxpQkFBaUIsRUFBRSxVQUFVLENBQUMsZ0JBQWdCO1FBQzlDLFdBQVcsRUFBRSxJQUFBLDZCQUFxQixFQUFDLEtBQUssRUFBRSxVQUFVLENBQUMsVUFBVSxDQUFDO1FBQ2hFLGVBQWUsRUFBRTtZQUNmLElBQUksRUFBRSxVQUFVLENBQUMsY0FBYyxLQUFLLE1BQU0sQ0FBQyxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQyxNQUFNO1NBQ3BFO1FBQ0QsS0FBSyxFQUFFLFFBQVEsQ0FBQyxLQUFLLENBQUM7UUFDdEIsSUFBSTtLQUNMLENBQUE7QUFDSCxDQUFDLENBQUE7QUF4QlksUUFBQSx1QkFBdUIsMkJBd0JuQyJ9 |
@@ -7,3 +7,5 @@ import { PromptConfiguration, PromptMessage } from '../types'; | ||
export declare function renderPromptWithVariables(prompt: PromptConfiguration, variables: Record<string, string>): PromptConfiguration; | ||
export declare function addAppendedMessages(prompt: PromptConfiguration, messages: PromptMessage[]): PromptConfiguration; | ||
export declare function addOverrideMessages(prompt: PromptConfiguration, messages: PromptMessage[]): PromptConfiguration; | ||
export declare function getMissingPromptVariables(prompt: PromptConfiguration, variables: Record<string, string>): string[]; | ||
export declare function validatePromptVariables(prompt: PromptConfiguration, variables: Record<string, string>): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validatePromptVariables = exports.getMissingPromptVariables = exports.renderPromptWithVariables = exports.renderMessagesWithVariabels = exports.renderTemplate = exports.extractVariablesFromMessages = exports.extractVariables = void 0; | ||
exports.validatePromptVariables = exports.getMissingPromptVariables = exports.addOverrideMessages = exports.addAppendedMessages = exports.renderPromptWithVariables = exports.renderMessagesWithVariabels = exports.renderTemplate = exports.extractVariablesFromMessages = exports.extractVariables = void 0; | ||
function extractVariables(template) { | ||
@@ -44,2 +44,10 @@ if (!template) { | ||
exports.renderPromptWithVariables = renderPromptWithVariables; | ||
function addAppendedMessages(prompt, messages) { | ||
return Object.assign(Object.assign({}, prompt), { messages: [...prompt.messages, ...messages] }); | ||
} | ||
exports.addAppendedMessages = addAppendedMessages; | ||
function addOverrideMessages(prompt, messages) { | ||
return Object.assign(Object.assign({}, prompt), { messages }); | ||
} | ||
exports.addOverrideMessages = addOverrideMessages; | ||
function getMissingPromptVariables(prompt, variables) { | ||
@@ -59,2 +67,2 @@ const variablesInPrompt = extractVariablesFromMessages(prompt.messages); | ||
exports.validatePromptVariables = validatePromptVariables; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVtcGxhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvaGVscGVycy90ZW1wbGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQSxTQUFnQixnQkFBZ0IsQ0FBQyxRQUF1QjtJQUN0RCxJQUFJLENBQUMsUUFBUSxFQUFFLENBQUM7UUFDZCxPQUFPLEVBQUUsQ0FBQTtJQUNYLENBQUM7SUFDRCxNQUFNLEtBQUssR0FBRyxtQkFBbUIsQ0FBQTtJQUNqQyxNQUFNLFNBQVMsR0FBRyxJQUFJLEdBQUcsRUFBVSxDQUFBO0lBQ25DLElBQUksS0FBNkIsQ0FBQTtJQUVqQyx3RkFBd0Y7SUFDeEYsS0FBSyxHQUFHLEtBQUssQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFD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QixtQkFBbUIsQ0FBQyxNQUEyQixFQUFFLFFBQXlCO0lBQ3hGLHVDQUNLLE1BQU0sS0FDVCxRQUFRLEVBQUUsQ0FBQyxHQUFHLE1BQU0sQ0FBQyxRQUFRLEVBQUUsR0FBRyxRQUFRLENBQUMsSUFDNUM7QUFDSCxDQUFDO0FBTEQsa0RBS0M7QUFFRCxTQUFnQixtQkFBbUIsQ0FBQyxNQUEyQixFQUFFLFFBQXlCO0lBQ3hGLHVDQUNLLE1BQU0sS0FDVCxRQUFRLElBQ1Q7QUFDSCxDQUFDO0FBTEQsa0RBS0M7QUFFRCxTQUFnQix5QkFBeUIsQ0FBQyxNQUEyQixFQUFFLFNBQWlDO0lBQ3RHLE1BQU0saUJBQWlCLEdBQUcsNEJBQTRCLENBQUMsTUFBTSxDQUFDLFFBQVEsQ0FBQyxDQUFBO0lBRXZFLE1BQU0sZ0JBQWdCLEdBQUcsaUJBQWlCLENBQUMsTUFBTSxDQUFDLENBQUMsUUFBUSxFQUFFLEVBQUUsQ0FBQyxDQUFDLFNBQVMsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFBO0lBRXJGLE9BQU8sZ0JBQWdCLENBQUE7QUFDekIsQ0FBQztBQU5ELDhEQU1DO0FBRUQsU0FBZ0IsdUJBQXVCLENBQUMsTUFBMkIsRUFBRSxTQUFpQztJQUNwRyxNQUFNLGdCQUFnQixHQUFHLHlCQUF5QixDQUFDLE1BQU0sRUFBRSxTQUFTLENBQUMsQ0FBQTtJQUVyRSxJQUFJLGdCQUFnQixDQUFDLE1BQU0sR0FBRyxDQUFDLEVBQUUsQ0FBQztRQUNoQyxPQUFPLEtBQUssQ0FBQTtJQUNkLENBQUM7SUFFRCxPQUFPLElBQUksQ0FBQTtBQUNiLENBQUM7QUFSRCwwREFRQyJ9 |
import { ChatCompletionCreateParamsNonStreaming } from 'openai/resources'; | ||
import { Evaluation, EvaluationBody, EvaluationGroup, EvaluationGroupBody, PromptConfiguration, PromptConfigurationBody, PromptTool, PromptToolBody } from './types'; | ||
import { Evaluation, EvaluationBody, EvaluationGroup, EvaluationGroupBody, PromptConfiguration, PromptConfigurationBody, PromptMessage, PromptTool, PromptToolBody } from './types'; | ||
export default class PromptFoundry { | ||
@@ -12,9 +12,15 @@ private client; | ||
}): Promise<PromptConfiguration>; | ||
getPrompt({ id, variables }: { | ||
getPrompt({ id, variables, appendMessages, overrideMessages }: { | ||
id: string; | ||
variables: Record<string, string>; | ||
appendMessages?: PromptMessage[]; | ||
overrideMessages?: PromptMessage[]; | ||
userId?: string; | ||
}): Promise<PromptConfiguration>; | ||
getOpenAiPrompt({ id, variables }: { | ||
getOpenAiPrompt({ id, variables, user, appendMessages, overrideMessages }: { | ||
id: string; | ||
variables: Record<string, string>; | ||
appendMessages?: PromptMessage[]; | ||
overrideMessages?: PromptMessage[]; | ||
user?: string; | ||
}): Promise<ChatCompletionCreateParamsNonStreaming>; | ||
@@ -21,0 +27,0 @@ createPrompt(data: PromptConfigurationBody): Promise<PromptConfiguration>; |
@@ -1,2 +0,2 @@ | ||
import { getMissingPromptVariables, renderPromptWithVariables, validatePromptVariables } from './helpers'; | ||
import { addAppendedMessages, addOverrideMessages, getMissingPromptVariables, renderPromptWithVariables, validatePromptVariables } from './helpers'; | ||
import { mapPromptToOpenAIConfig } from './helpers/openAi'; | ||
@@ -18,3 +18,3 @@ import { createApiClient } from './openapi/client'; | ||
} | ||
async getPrompt({ id, variables }) { | ||
async getPrompt({ id, variables, appendMessages, overrideMessages }) { | ||
const result = await this.getRawPrompt({ id }); | ||
@@ -25,7 +25,16 @@ if (!validatePromptVariables(result, variables)) { | ||
} | ||
return renderPromptWithVariables(result, variables); | ||
const updatedWithVariables = renderPromptWithVariables(result, variables); | ||
if (overrideMessages) { | ||
return addOverrideMessages(updatedWithVariables, overrideMessages); | ||
} | ||
if (appendMessages) { | ||
return addAppendedMessages(updatedWithVariables, appendMessages); | ||
} | ||
return updatedWithVariables; | ||
} | ||
async getOpenAiPrompt({ id, variables }) { | ||
const updatedWithVariables = await this.getPrompt({ id, variables }); | ||
return mapPromptToOpenAIConfig(updatedWithVariables); | ||
async getOpenAiPrompt({ id, variables, user, appendMessages, overrideMessages }) { | ||
const updatedWithVariables = await this.getPrompt({ id, variables, appendMessages, overrideMessages }); | ||
return mapPromptToOpenAIConfig(updatedWithVariables, { | ||
user | ||
}); | ||
} | ||
@@ -174,2 +183,2 @@ createPrompt(data) { | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2xpZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL0NsaWVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEVBQUUseUJBQXlCLEVBQUUseUJBQXlCLEVBQUUsdUJBQXVCLEVBQUUsTUFBTSxXQUFXLENBQUE7QUFDekcsT0FBTyxFQUFFLHVCQUF1QixFQUFFLE1BQU0sa0JBQWtCLENBQUE7QUFDMUQsT0FBTyxFQUFPLGVBQWUsRUFBRSxNQUFNLGtCQUFrQixDQUFBO0FBWXZELE1BQU0sQ0FBQyxPQUFPLE9BQU8sYUFBYTtJQUN4QixNQUFNLENBQVk7SUFFbEIsTUFBTSxDQUFRO0lBRXRCLFlBQVksRUFBRSxNQUFNLEVBQXNCO1FBQ3hDLHFFQUFxRTtRQUNyRSxJQUFJLE1BQU0sS0FBSyxFQUFFLElBQUksTUFBTSxLQUFLLFNBQVMsSUFBSSxNQUFNLEtBQUssSUFBSSxJQUFJLE1BQU0sS0FBSyxDQUFDLEVBQUUsQ0FBQztZQUM3RSxNQUFNLElBQUksS0FBSyxDQUFDLHFDQUFxQyxDQUFDLENBQUE7UUFDeEQsQ0FBQztRQUVELElBQUksQ0FBQyxNQUFNLEdBQUcsTUFBTSxDQUFBO1FBRXBCLElBQUksQ0FBQyxNQUFNLEdBQUcsZUFBZSxDQUFDLHFDQUFxQyxDQUFDLENBQUE7SU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FQUFFLFlBQVksRUFBRSxFQUFFLEVBQUU7WUFDNUIsT0FBTyxFQUFFO2dCQUNQLFdBQVcsRUFBRSxJQUFJLENBQUMsTUFBTTthQUN6QjtTQUNGLENBQUMsQ0FBQTtJQUNKLENBQUM7SUFFTSxLQUFLLENBQUMsZ0JBQWdCLENBQUMsRUFBRSxFQUFFLEVBQWtCO1FBQ2xELE1BQU0sSUFBSSxDQUFDLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQyxTQUFTLEVBQUU7WUFDNUMsTUFBTSxFQUFFLEVBQUUsWUFBWSxFQUFFLEVBQUUsRUFBRTtZQUM1QixPQUFPLEVBQUU7Z0JBQ1AsV0FBVyxFQUFFLElBQUksQ0FBQyxNQUFNO2FBQ3pCO1NBQ0YsQ0FBQyxDQUFBO1FBRUYsT0FBTyxJQUFJLENBQUE7SUFDYixDQUFDO0lBRU0sYUFBYSxDQUFDLEVBQUUsRUFBRSxFQUFrQjtRQUN6QyxPQUFPLElBQUksQ0FBQyxNQUFNLENBQUMsYUFBYSxDQUFDO1lBQy9CLE1BQU0sRUFBRSxFQUFFLFlBQVksRUFBRSxFQUFFLEVBQUU7WUFDNUIsT0FBTyxFQUFFO2dCQUNQLFdBQVcsRUFBRSxJQUFJLENBQUMsTUFBTTthQUN6QjtTQUNGLENBQUMsQ0FBQTtJQUNKLENBQUM7SUFFTSxjQUFjO1FBQ25CLE9BQU8sSUFBSSxDQUFDLE1BQU0sQ0FBQyxjQUFjLENBQUM7WUFDaEMsT0FBTyxFQUFFO2dCQUNQLFdBQVcsRUFBRSxJQUFJLENBQUMsTUFBTTthQUN6QjtTQUNGLENBQUMsQ0FBQTtJQUNKLENBQUM7Q0FDRiJ9 |
@@ -5,2 +5,4 @@ import { ChatCompletionCreateParamsNonStreaming, ChatCompletionMessageParam, ChatCompletionToolChoiceOption } from 'openai/resources'; | ||
export declare const mapToolChoiceToOpenAI: (tools: PromptTool[], toolChoice?: string | null) => ChatCompletionToolChoiceOption | undefined; | ||
export declare const mapPromptToOpenAIConfig: (promptConfig: PromptConfiguration) => ChatCompletionCreateParamsNonStreaming; | ||
export declare const mapPromptToOpenAIConfig: (promptConfig: PromptConfiguration, { user }?: { | ||
user?: string; | ||
}) => ChatCompletionCreateParamsNonStreaming; |
@@ -92,3 +92,3 @@ export const mapMessagesToOpenAI = (messages) => { | ||
}; | ||
export const mapPromptToOpenAIConfig = (promptConfig) => { | ||
export const mapPromptToOpenAIConfig = (promptConfig, { user } = {}) => { | ||
const { messages: promptMessages, parameters, tools } = promptConfig; | ||
@@ -109,5 +109,6 @@ const messages = mapMessagesToOpenAI(promptMessages); | ||
}, | ||
tools: getTools(tools) | ||
tools: getTools(tools), | ||
user | ||
}; | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3BlbkFpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2hlbHBlcnMvb3BlbkFpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQVdBLE1BQU0sQ0FBQyxNQUFNLG1CQUFtQixHQUFHLENBQUMsUUFBeUIsRUFBZ0MsRUFBRTtJQUM3RixPQUFPLFFBQVEsQ0FBQyxHQUFHLENBQUMsQ0FBQyxPQUFPLEVBQThCLEVBQUU7UUFDMUQsTUFBTSxJQUFJLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxXQUFXLEVBQXdCLENBQUE7UUFDN0QsSUFBSSxJQUFJLEtBQUssTUFBTSxFQUFFLENBQUM7WUFDcEIsSUFBSSxDQUFDLE9BQU8sQ0FBQyxVQUFVLEVBQUUsQ0FBQztnQkFDeEIsTUFBTSxJQUFJLEtBQUssQ0FBQyxnQ0FBZ0MsQ0FBQyxDQUFBO1lBQ25ELENBQUM7WUFFRCxJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sRUFBRSxDQUFDO2dCQUNyQixNQUFNLElBQUksS0FBSyxDQUFD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UUsVUFBVSxDQUFDLFNBQVM7UUFDM0IsS0FBSyxFQUFFLFVBQVUsQ0FBQyxJQUFJO1FBQ3RCLFVBQVUsRUFBRSxVQUFVLENBQUMsU0FBUztRQUNoQyxXQUFXLEVBQUUsVUFBVSxDQUFDLFdBQVc7UUFDbkMsSUFBSSxFQUFFLFVBQVUsQ0FBQyxJQUFJO1FBQ3JCLGdCQUFnQixFQUFFLFVBQVUsQ0FBQyxlQUFlO1FBQzVDLGlCQUFpQixFQUFFLFVBQVUsQ0FBQyxnQkFBZ0I7UUFDOUMsV0FBVyxFQUFFLHFCQUFxQixDQUFDLEtBQUssRUFBRSxVQUFVLENBQUMsVUFBVSxDQUFDO1FBQ2hFLGVBQWUsRUFBRTtZQUNmLElBQUksRUFBRSxVQUFVLENBQUMsY0FBYyxLQUFLLE1BQU0sQ0FBQyxDQUFDLENBQUMsYUFBYSxDQUFDLENBQUMsQ0FBQyxNQUFNO1NBQ3BFO1FBQ0QsS0FBSyxFQUFFLFFBQVEsQ0FBQyxLQUFLLENBQUM7UUFDdEIsSUFBSTtLQUNMLENBQUE7QUFDSCxDQUFDLENBQUEifQ== |
@@ -7,3 +7,5 @@ import { PromptConfiguration, PromptMessage } from '../types'; | ||
export declare function renderPromptWithVariables(prompt: PromptConfiguration, variables: Record<string, string>): PromptConfiguration; | ||
export declare function addAppendedMessages(prompt: PromptConfiguration, messages: PromptMessage[]): PromptConfiguration; | ||
export declare function addOverrideMessages(prompt: PromptConfiguration, messages: PromptMessage[]): PromptConfiguration; | ||
export declare function getMissingPromptVariables(prompt: PromptConfiguration, variables: Record<string, string>): string[]; | ||
export declare function validatePromptVariables(prompt: PromptConfiguration, variables: Record<string, string>): boolean; |
@@ -42,2 +42,14 @@ export function extractVariables(template) { | ||
} | ||
export function addAppendedMessages(prompt, messages) { | ||
return { | ||
...prompt, | ||
messages: [...prompt.messages, ...messages] | ||
}; | ||
} | ||
export function addOverrideMessages(prompt, messages) { | ||
return { | ||
...prompt, | ||
messages | ||
}; | ||
} | ||
export function getMissingPromptVariables(prompt, variables) { | ||
@@ -55,2 +67,2 @@ const variablesInPrompt = extractVariablesFromMessages(prompt.messages); | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVtcGxhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvaGVscGVycy90ZW1wbGF0ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxNQUFNLFVBQVUsZ0JBQWdCLENBQUMsUUFBdUI7SUFDdEQsSUFBSSxDQUFDLFFBQVEsRUFBRSxDQUFDO1FBQ2QsT0FBTyxFQUFFLENBQUE7SUFDWCxDQUFDO0lBQ0QsTUFBTSxLQUFLLEdBQUcsbUJBQW1CLENBQUE7SUFDakMsTUFBTSxTQUFTLEdBQUcsSUFBSSxHQUFHLEVBQVUsQ0FBQTtJQUNuQyxJQUFJLEtBQTZCLENBQUE7SUFFakMsd0ZBQXdGO0lBQ3hGLEtBQUssR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxDQUFBO0lBQzVCLE9BQU8sS0FBSyxFQUFFLENBQUM7UUFDYixTQUFTLENBQUMsR0FBRyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQyxJQUFJLEVBQUUsQ0FBQyxDQUFBLENBQUMsaUVBQWlFO1FBQ2hHLEtBQUssR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxDQUFBLENBQUMsd0NBQXdDO0lBQ3ZFLENBQUM7SUFFRCxPQUFPLEtBQUssQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUE7QUFDOUIsQ0FBQztBQUVELE1BQU0sVUFBVSw0QkFBNEIsQ0FBQyxRQUF5QjtJQUNwRSxNQUFNLFNBQVMsR0FBRyxRQUFRLENBQUMsR0FBRyxDQUFDLENBQUMsT0FBTyx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BTSxDQUFDLENBQUMsUUFBUSxFQUFFLEVBQUUsQ0FBQyxDQUFDLFNBQVMsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFBO0lBRXJGLE9BQU8sZ0JBQWdCLENBQUE7QUFDekIsQ0FBQztBQUVELE1BQU0sVUFBVSx1QkFBdUIsQ0FBQyxNQUEyQixFQUFFLFNBQWlDO0lBQ3BHLE1BQU0sZ0JBQWdCLEdBQUcseUJBQXlCLENBQUMsTUFBTSxFQUFFLFNBQVMsQ0FBQyxDQUFBO0lBRXJFLElBQUksZ0JBQWdCLENBQUMsTUFBTSxHQUFHLENBQUMsRUFBRSxDQUFDO1FBQ2hDLE9BQU8sS0FBSyxDQUFBO0lBQ2QsQ0FBQztJQUVELE9BQU8sSUFBSSxDQUFBO0FBQ2IsQ0FBQyJ9 |
@@ -5,2 +5,2 @@ # Changelog | ||
### [1.0.17](https://github.com/prompt-foundry/typescript-sdk/compare/v1.0.16...v1.0.17) (2024-06-07) | ||
### [1.0.19](https://github.com/prompt-foundry/typescript-sdk/compare/v1.0.18...v1.0.19) (2024-06-07) |
{ | ||
"name": "@prompt-foundry/typescript-sdk", | ||
"version": "1.0.17", | ||
"version": "1.0.19", | ||
"description": "The Typescript SDK for the prompt engineering, prompt management, and prompt testing tool Prompt Foundry.", | ||
@@ -5,0 +5,0 @@ "main": "build/main/index.js", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1654444
33499
0