Skip to content
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

Adds definePrompts helper #250

Merged
merged 1 commit into from
Oct 19, 2023
Merged
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Transcend Inc.",
"name": "@transcend-io/cli",
"description": "Small package containing useful typescript utilities.",
"version": "4.110.1",
"version": "4.111.0",
"homepage": "https://github.com/transcend-io/cli",
"repository": {
"type": "git",
Expand Down
13 changes: 13 additions & 0 deletions src/ai/TranscendPromptManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ export function createRegexForTag(tagName: string): RegExp {
return new RegExp(`<${tagName}>([\\s\\S]+?)<\\/${tagName}>`);
}

/**
* Helper function to declare prompts
*
* @param prompts - Prompt config
* @returns Prompts as identity function - but type enforced
*/
export function defineTranscendPrompts<
TPromptNames extends string,
TPrompts extends { [k in TPromptNames]: TranscendPrompt<t.Any, t.Any> },
>(prompts: TPrompts): TPrompts {
return prompts;
}

/**
* A class that is capable of loading and insert variables into prompts from
* Transcend's Prompt Manager
Expand Down
Loading