MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / singleCompletionHandler

Function singleCompletionHandler

src/utils/single-completion-handler.ts:9–25  ·  view source on GitHub ↗
(apiConfiguration: ProviderSettings, promptText: string)

Source from the content-addressed store, hash-verified

7 * This is a lightweight alternative that only uses the API's completion functionality.
8 */
9export async function singleCompletionHandler(apiConfiguration: ProviderSettings, promptText: string): Promise<string> {
10 if (!promptText) {
11 throw new Error("No prompt text provided")
12 }
13 if (!apiConfiguration || !apiConfiguration.apiProvider) {
14 throw new Error("No valid API configuration provided")
15 }
16
17 const handler = buildApiHandler(apiConfiguration)
18
19 // Check if handler supports single completions
20 if (!("completePrompt" in handler)) {
21 throw new Error("The selected API provider does not support prompt enhancement")
22 }
23
24 return (handler as SingleCompletionHandler).completePrompt(promptText)
25}

Callers 2

enhanceMessageMethod · 0.90

Calls 2

buildApiHandlerFunction · 0.90
completePromptMethod · 0.65

Tested by

no test coverage detected