Add support for gpt-4-turbo 128K model ()

resolves 
Add support for gpt-4-turbo 128K model
This commit is contained in:
Timothy Carambat 2023-11-06 14:22:19 -08:00 committed by GitHub
parent 5673dc522b
commit d34ec68702
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 13 deletions
README.md
frontend/src/components/LLMSelection
AzureAiOptions
OpenAiOptions
server/utils/AiProviders/openAi

View file

@ -73,7 +73,7 @@ This monorepo consists of three main sections:
### Requirements
- `yarn` and `node` on your machine
- `python` 3.9+ for running scripts in `collector/`.
- access to an LLM like `GPT-3.5`, `GPT-4`.
- access to an LLM like `GPT-3.5`, `GPT-4`, etc.
- (optional) a vector database like Pinecone, qDrant, Weaviate, or Chroma*.
*AnythingLLM by default uses a built-in vector db called LanceDB.

View file

@ -63,6 +63,7 @@ export default function AzureAiOptions({ settings }) {
<option value={16384}>16,384 (gpt-3.5-16k)</option>
<option value={8192}>8,192 (gpt-4)</option>
<option value={32768}>32,768 (gpt-4-32k)</option>
<option value={128000}>128,000 (gpt-4-turbo)</option>
</select>
</div>

View file

@ -84,17 +84,19 @@ function OpenAIModelSelection({ apiKey, settings }) {
className="bg-zinc-900 border border-gray-500 text-white text-sm rounded-lg block w-full p-2.5"
>
<optgroup label="General LLM models">
{["gpt-3.5-turbo", "gpt-4"].map((model) => {
return (
<option
key={model}
value={model}
selected={settings.OpenAiModelPref === model}
>
{model}
</option>
);
})}
{["gpt-3.5-turbo", "gpt-4", "gpt-4-1106-preview", "gpt-4-32k"].map(
(model) => {
return (
<option
key={model}
value={model}
selected={settings.OpenAiModelPref === model}
>
{model}
</option>
);
}
)}
</optgroup>
{customModels.length > 0 && (
<optgroup label="Your fine-tuned models">

View file

@ -25,13 +25,22 @@ class OpenAiLLM extends OpenAiEmbedder {
return 4096;
case "gpt-4":
return 8192;
case "gpt-4-1106-preview":
return 128000;
case "gpt-4-32k":
return 32000;
default:
return 4096; // assume a fine-tune 3.5
}
}
async isValidChatCompletionModel(modelName = "") {
const validModels = ["gpt-4", "gpt-3.5-turbo"];
const validModels = [
"gpt-4",
"gpt-3.5-turbo",
"gpt-4-1106-preview",
"gpt-4-32k",
];
const isPreset = validModels.some((model) => modelName === model);
if (isPreset) return true;