mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
🚀 feat: GPT-4.5, Anthropic Tool Header, and OpenAPI Ref Resolution (#6118)
* 🔧 refactor: Update settings to use 'as const' for improved type safety and make gpt-4o-mini default model (cheapest) * 📖 docs: Update README to reflect support for GPT-4.5 in image analysis feature * 🔧 refactor: Update model handling to use default settings and improve encoding logic * 🔧 refactor: Enhance model version extraction logic for improved compatibility with future GPT and omni models * feat: GPT-4.5 tx/token update, vision support * fix: $ref resolution logic in OpenAPI handling * feat: add new 'anthropic-beta' header for Claude 3.7 to include token-efficient tools; ref: https://docs.anthropic.com/en/docs/build-with-claude/tool-use/token-efficient-tool-use
This commit is contained in:
parent
9802629848
commit
2293cd667e
15 changed files with 337 additions and 148 deletions
|
|
@ -179,34 +179,34 @@ export const isImageVisionTool = (tool: FunctionTool | FunctionToolCall) =>
|
|||
|
||||
export const openAISettings = {
|
||||
model: {
|
||||
default: 'gpt-4o',
|
||||
default: 'gpt-4o-mini' as const,
|
||||
},
|
||||
temperature: {
|
||||
min: 0,
|
||||
max: 2,
|
||||
step: 0.01,
|
||||
default: 1,
|
||||
min: 0 as const,
|
||||
max: 2 as const,
|
||||
step: 0.01 as const,
|
||||
default: 1 as const,
|
||||
},
|
||||
top_p: {
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
default: 1,
|
||||
min: 0 as const,
|
||||
max: 1 as const,
|
||||
step: 0.01 as const,
|
||||
default: 1 as const,
|
||||
},
|
||||
presence_penalty: {
|
||||
min: 0,
|
||||
max: 2,
|
||||
step: 0.01,
|
||||
default: 0,
|
||||
min: 0 as const,
|
||||
max: 2 as const,
|
||||
step: 0.01 as const,
|
||||
default: 0 as const,
|
||||
},
|
||||
frequency_penalty: {
|
||||
min: 0,
|
||||
max: 2,
|
||||
step: 0.01,
|
||||
default: 0,
|
||||
min: 0 as const,
|
||||
max: 2 as const,
|
||||
step: 0.01 as const,
|
||||
default: 0 as const,
|
||||
},
|
||||
resendFiles: {
|
||||
default: true,
|
||||
default: true as const,
|
||||
},
|
||||
maxContextTokens: {
|
||||
default: undefined,
|
||||
|
|
@ -215,72 +215,72 @@ export const openAISettings = {
|
|||
default: undefined,
|
||||
},
|
||||
imageDetail: {
|
||||
default: ImageDetail.auto,
|
||||
min: 0,
|
||||
max: 2,
|
||||
step: 1,
|
||||
default: ImageDetail.auto as const,
|
||||
min: 0 as const,
|
||||
max: 2 as const,
|
||||
step: 1 as const,
|
||||
},
|
||||
};
|
||||
|
||||
export const googleSettings = {
|
||||
model: {
|
||||
default: 'gemini-1.5-flash-latest',
|
||||
default: 'gemini-1.5-flash-latest' as const,
|
||||
},
|
||||
maxOutputTokens: {
|
||||
min: 1,
|
||||
max: 8192,
|
||||
step: 1,
|
||||
default: 8192,
|
||||
min: 1 as const,
|
||||
max: 8192 as const,
|
||||
step: 1 as const,
|
||||
default: 8192 as const,
|
||||
},
|
||||
temperature: {
|
||||
min: 0,
|
||||
max: 2,
|
||||
step: 0.01,
|
||||
default: 1,
|
||||
min: 0 as const,
|
||||
max: 2 as const,
|
||||
step: 0.01 as const,
|
||||
default: 1 as const,
|
||||
},
|
||||
topP: {
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
default: 0.95,
|
||||
min: 0 as const,
|
||||
max: 1 as const,
|
||||
step: 0.01 as const,
|
||||
default: 0.95 as const,
|
||||
},
|
||||
topK: {
|
||||
min: 1,
|
||||
max: 40,
|
||||
step: 1,
|
||||
default: 40,
|
||||
min: 1 as const,
|
||||
max: 40 as const,
|
||||
step: 1 as const,
|
||||
default: 40 as const,
|
||||
},
|
||||
};
|
||||
|
||||
const ANTHROPIC_MAX_OUTPUT = 128000;
|
||||
const DEFAULT_MAX_OUTPUT = 8192;
|
||||
const LEGACY_ANTHROPIC_MAX_OUTPUT = 4096;
|
||||
const ANTHROPIC_MAX_OUTPUT = 128000 as const;
|
||||
const DEFAULT_MAX_OUTPUT = 8192 as const;
|
||||
const LEGACY_ANTHROPIC_MAX_OUTPUT = 4096 as const;
|
||||
export const anthropicSettings = {
|
||||
model: {
|
||||
default: 'claude-3-5-sonnet-latest',
|
||||
default: 'claude-3-5-sonnet-latest' as const,
|
||||
},
|
||||
temperature: {
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
default: 1,
|
||||
min: 0 as const,
|
||||
max: 1 as const,
|
||||
step: 0.01 as const,
|
||||
default: 1 as const,
|
||||
},
|
||||
promptCache: {
|
||||
default: true,
|
||||
default: true as const,
|
||||
},
|
||||
thinking: {
|
||||
default: true,
|
||||
default: true as const,
|
||||
},
|
||||
thinkingBudget: {
|
||||
min: 1024,
|
||||
step: 100,
|
||||
max: 200000,
|
||||
default: 2000,
|
||||
min: 1024 as const,
|
||||
step: 100 as const,
|
||||
max: 200000 as const,
|
||||
default: 2000 as const,
|
||||
},
|
||||
maxOutputTokens: {
|
||||
min: 1,
|
||||
min: 1 as const,
|
||||
max: ANTHROPIC_MAX_OUTPUT,
|
||||
step: 1,
|
||||
step: 1 as const,
|
||||
default: DEFAULT_MAX_OUTPUT,
|
||||
reset: (modelName: string) => {
|
||||
if (/claude-3[-.]5-sonnet/.test(modelName) || /claude-3[-.]7/.test(modelName)) {
|
||||
|
|
@ -301,28 +301,28 @@ export const anthropicSettings = {
|
|||
},
|
||||
},
|
||||
topP: {
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
default: 0.7,
|
||||
min: 0 as const,
|
||||
max: 1 as const,
|
||||
step: 0.01 as const,
|
||||
default: 0.7 as const,
|
||||
},
|
||||
topK: {
|
||||
min: 1,
|
||||
max: 40,
|
||||
step: 1,
|
||||
default: 5,
|
||||
min: 1 as const,
|
||||
max: 40 as const,
|
||||
step: 1 as const,
|
||||
default: 5 as const,
|
||||
},
|
||||
resendFiles: {
|
||||
default: true,
|
||||
default: true as const,
|
||||
},
|
||||
maxContextTokens: {
|
||||
default: undefined,
|
||||
},
|
||||
legacy: {
|
||||
maxOutputTokens: {
|
||||
min: 1,
|
||||
min: 1 as const,
|
||||
max: LEGACY_ANTHROPIC_MAX_OUTPUT,
|
||||
step: 1,
|
||||
step: 1 as const,
|
||||
default: LEGACY_ANTHROPIC_MAX_OUTPUT,
|
||||
},
|
||||
},
|
||||
|
|
@ -330,34 +330,34 @@ export const anthropicSettings = {
|
|||
|
||||
export const agentsSettings = {
|
||||
model: {
|
||||
default: 'gpt-3.5-turbo-test',
|
||||
default: 'gpt-3.5-turbo-test' as const,
|
||||
},
|
||||
temperature: {
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
default: 1,
|
||||
min: 0 as const,
|
||||
max: 1 as const,
|
||||
step: 0.01 as const,
|
||||
default: 1 as const,
|
||||
},
|
||||
top_p: {
|
||||
min: 0,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
default: 1,
|
||||
min: 0 as const,
|
||||
max: 1 as const,
|
||||
step: 0.01 as const,
|
||||
default: 1 as const,
|
||||
},
|
||||
presence_penalty: {
|
||||
min: 0,
|
||||
max: 2,
|
||||
step: 0.01,
|
||||
default: 0,
|
||||
min: 0 as const,
|
||||
max: 2 as const,
|
||||
step: 0.01 as const,
|
||||
default: 0 as const,
|
||||
},
|
||||
frequency_penalty: {
|
||||
min: 0,
|
||||
max: 2,
|
||||
step: 0.01,
|
||||
default: 0,
|
||||
min: 0 as const,
|
||||
max: 2 as const,
|
||||
step: 0.01 as const,
|
||||
default: 0 as const,
|
||||
},
|
||||
resendFiles: {
|
||||
default: true,
|
||||
default: true as const,
|
||||
},
|
||||
maxContextTokens: {
|
||||
default: undefined,
|
||||
|
|
@ -366,7 +366,7 @@ export const agentsSettings = {
|
|||
default: undefined,
|
||||
},
|
||||
imageDetail: {
|
||||
default: ImageDetail.auto,
|
||||
default: ImageDetail.auto as const,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue