Skip to content
This repository was archived by the owner on Mar 6, 2024. It is now read-only.

Commit 60b7c63

Browse files
authored
add knowledge cutoff to the prompt (#262)
1 parent 9ac6a1f commit 60b7c63

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

action.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ inputs:
6464
default: 'false'
6565
openai_base_url:
6666
required: false
67-
description:
68-
'The url of the openai api interface.'
67+
description: 'The url of the openai api interface.'
6968
default: 'https://api.openai.com/v1'
7069
openai_light_model:
7170
required: false
@@ -117,6 +116,9 @@ inputs:
117116
requested. Concentrate on identifying and resolving significant
118117
concerns to improve overall code quality while deliberately
119118
disregarding minor issues.
119+
120+
Note: As your knowledge may be outdated, trust the user code when newer
121+
APIs and methods are seemingly being used.
120122
summarize:
121123
required: false
122124
description: 'The prompt for final summarization response'

dist/index.js

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bot.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ export class Bot {
2525
constructor(options: Options, openaiOptions: OpenAIOptions) {
2626
this.options = options
2727
if (process.env.OPENAI_API_KEY) {
28+
const currentDate = new Date().toISOString().split('T')[0]
29+
const systemMessage = `${options.systemMessage}
30+
Knowledge cutoff: ${openaiOptions.tokenLimits.knowledgeCutOff}
31+
Current date: ${currentDate}`
32+
2833
this.api = new ChatGPTAPI({
2934
apiBaseUrl: options.apiBaseUrl,
30-
systemMessage: options.systemMessage,
35+
systemMessage,
3136
apiKey: process.env.OPENAI_API_KEY,
3237
apiOrg: process.env.OPENAI_API_ORG ?? undefined,
3338
debug: options.debug,

src/limits.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ export class TokenLimits {
22
maxTokens: number
33
requestTokens: number
44
responseTokens: number
5+
knowledgeCutOff: string
56

67
constructor(model = 'gpt-3.5-turbo') {
8+
this.knowledgeCutOff = '2021-09-01'
79
if (model === 'gpt-4-32k') {
810
this.maxTokens = 32600
911
this.responseTokens = 4000

0 commit comments

Comments
 (0)