Skip to content

Commit

Permalink
Move the bos_token and eos_token to the top level tokens field in the…
Browse files Browse the repository at this point in the history
… manifest
  • Loading branch information
Thomas101 committed Nov 6, 2024
1 parent ddbd5c1 commit fd82494
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/extension/background/APIHandler/AILanguageModelHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ class AILanguageModelHandler {
const template = new Template(promptConfig.template)
const prompt = template.render({
messages: history,
bos_token: promptConfig.bosToken,
eos_token: promptConfig.eosToken
bos_token: manifest.tokens.bosToken,
eos_token: manifest.tokens.eosToken
})

const tokenCount = await AIPrompter.countTokens(prompt, props, {})
Expand Down
4 changes: 2 additions & 2 deletions src/extension/background/APIHandler/AIRewriterHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ class AIRewriterHandler {
shared_context: sharedContext,
context,
input,
bos_token: config.bosToken,
eos_token: config.eosToken
bos_token: manifest.tokens.bosToken,
eos_token: manifest.tokens.eosToken
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/extension/background/APIHandler/AISummarizerHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ class AISummarizerHandler {
shared_context: sharedContext,
context,
input,
bos_token: config.bosToken,
eos_token: config.eosToken
bos_token: manifest.tokens.bosToken,
eos_token: manifest.tokens.eosToken
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/extension/background/APIHandler/AIWriterHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ class AIWriterHandler {
sharedContext,
context,
input,
bos_token: config.bosToken,
eos_token: config.eosToken
bos_token: manifest.tokens.bosToken,
eos_token: manifest.tokens.eosToken
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/shared/AIModelManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export type AIModelManifestConfig = {

export type AIModelPromptConfig = {
template: string
bosToken?: string
eosToken?: string
}

export type AIModelManifest = {
Expand All @@ -37,6 +35,8 @@ export type AIModelManifest = {
max: number
default: number
stop?: string[]
bosToken?: string
eosToken?: string
}
prompts?: {
languageModel?: AIModelPromptConfig
Expand Down

0 comments on commit fd82494

Please sign in to comment.