Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface ApiHandler {
countTokens(content: Array<Anthropic.Messages.ContentBlockParam>): Promise<number>
}

export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
export function buildApiHandler(configuration: ProviderSettings): ApiHandler & Partial<SingleCompletionHandler> {
const { apiProvider, ...options } = configuration

switch (apiProvider) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/single-completion-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export async function singleCompletionHandler(apiConfiguration: ProviderSettings
const handler = buildApiHandler(apiConfiguration)

// Check if handler supports single completions
if (!("completePrompt" in handler)) {
if (!handler.completePrompt) {
throw new Error("The selected API provider does not support prompt enhancement")
}

return (handler as SingleCompletionHandler).completePrompt(promptText)
return handler.completePrompt(promptText)
}