diff --git a/src/base/index.ts b/src/base/index.ts index 40d0646..09ccfd8 100644 --- a/src/base/index.ts +++ b/src/base/index.ts @@ -129,7 +129,9 @@ export async function renderPrompt

( ? new AnyTokenizer((text, token) => tokenizerMetadata.countTokens(text, token)) : tokenizerMetadata; const renderer = new PromptRenderer(endpoint, ctor, props, tokenizer); - let { messages, tokenCount, references, metadata } = await renderer.render(progress, token); + const renderResult = await renderer.render(progress, token); + const { tokenCount, references, metadata } = renderResult; + let messages: ChatMessage[] | LanguageModelChatMessage[] = renderResult.messages; const usedContext = renderer.getUsedContext(); if (mode === 'vscode') { @@ -209,7 +211,7 @@ export function renderElementJSON

( * @param messages - The array of {@link ChatMessage} objects to convert. * @returns An array of {@link LanguageModelChatMessage VS Code chat messages}. */ -export function toVsCodeChatMessages(messages: ChatMessage[]) { +export function toVsCodeChatMessages(messages: ChatMessage[]): LanguageModelChatMessage[] { const vscode = require('vscode'); return messages.map(m => { switch (m.role) {