Skip to content

Commit

Permalink
feat: 🎸 tokens (#1678)
Browse files Browse the repository at this point in the history
increased default value to 1000

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
  • Loading branch information
StanGirard authored Nov 22, 2023
1 parent f65e2f0 commit 1a4c6c8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 20 deletions.
2 changes: 1 addition & 1 deletion backend/llm/api_brain_qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async def make_completion(
content = chunk.choices[0].delta.content
yield content
else: # pragma: no cover
yield "**Response too long, truncating...**"
yield "**...**"
break

async def generate_stream(self, chat_id: UUID, question: ChatQuestion):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const AddBrainConfig = ({
const {
isShareModalOpen,
setIsShareModalOpen,
temperature,
maxTokens,
model,
isPending,
Expand Down Expand Up @@ -134,20 +133,7 @@ export const AddBrainConfig = ({
</select>
</fieldset>

<fieldset className="w-full flex mt-4">
<label className="flex-1" htmlFor="temp">
{t("temperature", { ns: "config" })}: {temperature}
</label>
<input
id="temp"
type="range"
min="0"
max="1"
step="0.01"
value={temperature}
{...register("temperature")}
/>
</fieldset>

<fieldset className="w-full flex mt-4">
<label className="flex-1" htmlFor="tokens">
{t("maxTokens", { ns: "config" })}: {maxTokens}
Expand Down
4 changes: 2 additions & 2 deletions frontend/lib/config/defaultBrainConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { BrainConfig } from "../types/brainConfig";
export const addBrainDefaultValues: CreateBrainInput = {
model: "gpt-3.5-turbo",
temperature: 0,
max_tokens: 500,
max_tokens: 1000,
prompt_id: undefined,
status: "private",
name: "",
Expand All @@ -15,7 +15,7 @@ export const addBrainDefaultValues: CreateBrainInput = {
export const defaultBrainConfig: BrainConfig = {
model: "gpt-3.5-turbo",
temperature: 0,
maxTokens: 500,
maxTokens: 1000,
keepLocal: true,
anthropicKey: undefined,
backendUrl: undefined,
Expand Down
4 changes: 3 additions & 1 deletion frontend/lib/helpers/defineMaxTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ export const defineMaxTokens = (
switch (model) {
case "gpt-3.5-turbo":
return 1000;
case "gpt-3.5-turbo-1106":
return 1000;
case "gpt-3.5-turbo-16k":
return 4000;
case "gpt-4":
return 4000;
default:
return 500;
return 1000;
}
};
2 changes: 1 addition & 1 deletion frontend/lib/types/brainConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type BrainConfigContextType = {
config: BrainConfig;
};

export const openAiFreeModels = ["gpt-3.5-turbo", "gpt-3.5-turbo-16k"] as const;
export const openAiFreeModels = ["gpt-3.5-turbo","gpt-3.5-turbo-1106", "gpt-3.5-turbo-16k"] as const;

export const openAiPaidModels = [...openAiFreeModels, "gpt-4"] as const;

Expand Down

0 comments on commit 1a4c6c8

Please sign in to comment.