-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: misc bug fixes and email format improvements
- Loading branch information
Jamesb
committed
Mar 6, 2024
1 parent
51f529b
commit cf73514
Showing
9 changed files
with
240 additions
and
179 deletions.
There are no files selected for viewing
53 changes: 31 additions & 22 deletions
53
packages/cli/src/recommender/prompts/answersQuestion/answersQuestion.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,39 @@ | ||
import { Prompt } from "prompt-iteration-assistant"; | ||
import { answersQuestionInputSchema } from "./schemas/answersQuestionInputSchema"; | ||
import { | ||
AnswersQuestionInput, | ||
answersQuestionInputSchema, | ||
} from "./schemas/answersQuestionInputSchema"; | ||
import { answersQuestionOutputSchema } from "./schemas/answersQuestionOutputSchema"; | ||
import { answersQuestionPrompt } from "./prompts/answersQuestionPrompt"; | ||
|
||
export const ANSWERS_QUESTION = "Answers Question"; | ||
|
||
export const answersQuestion = () => | ||
new Prompt({ | ||
name: ANSWERS_QUESTION, | ||
description: | ||
"Check whether the text contains the start of an answer to the question", | ||
prompts: [answersQuestionPrompt], | ||
model: "gpt-4", | ||
input: answersQuestionInputSchema, | ||
output: answersQuestionOutputSchema, | ||
}); | ||
|
||
if (require.main === module) { | ||
(async () => { | ||
const res = await answersQuestion().run({ | ||
stream: false, | ||
promptVariables: { | ||
text: "", | ||
question: "How does chain of thought prompting work", | ||
}, | ||
class AnswersQuestion extends Prompt< | ||
typeof answersQuestionInputSchema, | ||
typeof answersQuestionOutputSchema | ||
> { | ||
constructor() { | ||
super({ | ||
name: ANSWERS_QUESTION, | ||
description: | ||
"Check whether the text contains the start of an answer to the question", | ||
prompts: [answersQuestionPrompt], | ||
model: "gpt-4", | ||
input: answersQuestionInputSchema, | ||
output: answersQuestionOutputSchema, | ||
}); | ||
console.log(res); | ||
})(); | ||
} | ||
async execute(args: AnswersQuestionInput) { | ||
try { | ||
return this.run({ | ||
stream: false, | ||
promptVariables: args, | ||
}); | ||
} catch (e) { | ||
console.error(e); | ||
return { answersQuestion: false }; | ||
} | ||
} | ||
} | ||
|
||
export const answersQuestion = () => new AnswersQuestion(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 31 additions & 21 deletions
52
packages/cli/src/recommender/prompts/titleClip/titleClip.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,39 @@ | ||
import { Prompt } from "prompt-iteration-assistant"; | ||
import { titleClipPrompt } from "./prompts/titleClipPrompt"; | ||
import { titleClipInputSchema } from "./schemas/titleClipInputSchema"; | ||
import { | ||
TitleClipInput, | ||
titleClipInputSchema, | ||
} from "./schemas/titleClipInputSchema"; | ||
import { titleClipOutputSchema } from "./schemas/titleClipOutputSchema"; | ||
|
||
export const TITLE_CLIP = "Title Clip"; | ||
|
||
export const titleClip = () => | ||
new Prompt({ | ||
name: TITLE_CLIP, | ||
description: "Give the clip a short title", | ||
prompts: [titleClipPrompt], | ||
model: "gpt-3.5-turbo", | ||
input: titleClipInputSchema, | ||
output: titleClipOutputSchema, | ||
}); | ||
class TitleClip extends Prompt< | ||
typeof titleClipInputSchema, | ||
typeof titleClipOutputSchema | ||
> { | ||
constructor() { | ||
super({ | ||
name: TITLE_CLIP, | ||
description: "Give the clip a short title", | ||
prompts: [titleClipPrompt], | ||
model: "gpt-3.5-turbo", | ||
input: titleClipInputSchema, | ||
output: titleClipOutputSchema, | ||
}); | ||
} | ||
|
||
if (require.main === module) { | ||
(async () => { | ||
// const res = await answersQuestion().run({ | ||
// stream: false, | ||
// // promptVariables: { | ||
// // text: "", | ||
// // question: "How does chain of thought prompting work", | ||
// // }, | ||
// }); | ||
// console.log(res); | ||
})(); | ||
async execute(args: TitleClipInput) { | ||
try { | ||
return this.run({ | ||
stream: false, | ||
promptVariables: args, | ||
}); | ||
} catch (e) { | ||
console.error(e); | ||
return { title: "" }; | ||
} | ||
} | ||
} | ||
|
||
export const titleClip = () => new TitleClip(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.