Skip to content

POC: Added creator prompt #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
7 changes: 5 additions & 2 deletions src/api/providers/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ export class AnthropicHandler extends BaseProvider implements SingleCompletionHa
case "claude-3-haiku-20240307":
betas.push("prompt-caching-2024-07-31")
return {
headers: { "anthropic-beta": betas.join(",") },
authorization: `Bearer ${this.options.apiKey}`,
headers: {
"anthropic-beta": betas.join(","),
authorization: `Bearer ${this.options.apiKey}`,
"creator-mode": String(this.options.creatorMode),
},
}
default:
return undefined
Expand Down
10 changes: 10 additions & 0 deletions src/api/providers/pearai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,19 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl
throw new Error("PearAI API key not found. Please login to PearAI.")
}

if (!options.creatorMode) {
// TODO: REMOVE, TESTING
options.creatorMode = true
// options.creatorMode = false
}

// Initialize with a default handler synchronously
this.handler = new AnthropicHandler({
...options,
apiKey: options.pearaiApiKey,
anthropicBaseUrl: PEARAI_URL,
apiModelId: "claude-3-5-sonnet-20241022",
creatorMode: options.creatorMode,
})

// Then try to initialize the correct handler asynchronously
Expand All @@ -68,6 +75,7 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl
deepSeekApiKey: options.pearaiApiKey,
deepSeekBaseUrl: PEARAI_URL,
apiModelId: underlyingModel,
creatorMode: options.creatorMode,
})
} else {
// Default to Claude
Expand All @@ -76,6 +84,7 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl
apiKey: options.pearaiApiKey,
anthropicBaseUrl: PEARAI_URL,
apiModelId: underlyingModel,
creatorMode: options.creatorMode,
})
}
} catch (error) {
Expand All @@ -86,6 +95,7 @@ export class PearAiHandler extends BaseProvider implements SingleCompletionHandl
apiKey: options.pearaiApiKey,
anthropicBaseUrl: PEARAI_URL,
apiModelId: "claude-3-5-sonnet-20241022",
creatorMode: options.creatorMode,
})
}
} else if (modelId.startsWith("claude")) {
Expand Down
5 changes: 3 additions & 2 deletions src/shared/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type ApiProvider =

export interface ApiHandlerOptions {
apiModelId?: string
creatorMode?: boolean
apiKey?: string // anthropic
anthropicBaseUrl?: string
vsCodeLmModelSelector?: vscode.LanguageModelChatSelector
Expand Down Expand Up @@ -1043,9 +1044,9 @@ export const unboundDefaultModelInfo: ModelInfo = {
}
// CHANGE AS NEEDED FOR TESTING
// PROD:
export const PEARAI_URL = "https://stingray-app-gb2an.ondigitalocean.app/pearai-server-api2/integrations/cline"
// export const PEARAI_URL = "https://stingray-app-gb2an.ondigitalocean.app/pearai-server-api2/integrations/cline"
// DEV:
// export const PEARAI_URL = "http://localhost:8000/integrations/cline"
export const PEARAI_URL = "http://localhost:8000/integrations/cline"

// PearAI
export type PearAiModelId = keyof typeof pearAiModels
Expand Down
Loading