Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
9a83bde7
Commit
9a83bde7
authored
Mar 08, 2024
by
Timothy J. Baek
Browse files
feat: max token option for litellm models
parent
2b84af87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
src/lib/apis/litellm/index.ts
src/lib/apis/litellm/index.ts
+3
-1
src/lib/components/chat/Settings/Models.svelte
src/lib/components/chat/Settings/Models.svelte
+19
-1
No files found.
src/lib/apis/litellm/index.ts
View file @
9a83bde7
...
@@ -77,6 +77,7 @@ type AddLiteLLMModelForm = {
...
@@ -77,6 +77,7 @@ type AddLiteLLMModelForm = {
api_base
:
string
;
api_base
:
string
;
api_key
:
string
;
api_key
:
string
;
rpm
:
string
;
rpm
:
string
;
max_tokens
:
string
;
};
};
export
const
addLiteLLMModel
=
async
(
token
:
string
=
''
,
payload
:
AddLiteLLMModelForm
)
=>
{
export
const
addLiteLLMModel
=
async
(
token
:
string
=
''
,
payload
:
AddLiteLLMModelForm
)
=>
{
...
@@ -95,7 +96,8 @@ export const addLiteLLMModel = async (token: string = '', payload: AddLiteLLMMod
...
@@ -95,7 +96,8 @@ export const addLiteLLMModel = async (token: string = '', payload: AddLiteLLMMod
model
:
payload
.
model
,
model
:
payload
.
model
,
...(
payload
.
api_base
===
''
?
{}
:
{
api_base
:
payload
.
api_base
}),
...(
payload
.
api_base
===
''
?
{}
:
{
api_base
:
payload
.
api_base
}),
...(
payload
.
api_key
===
''
?
{}
:
{
api_key
:
payload
.
api_key
}),
...(
payload
.
api_key
===
''
?
{}
:
{
api_key
:
payload
.
api_key
}),
...(
isNaN
(
parseInt
(
payload
.
rpm
))
?
{}
:
{
rpm
:
parseInt
(
payload
.
rpm
)
})
...(
isNaN
(
parseInt
(
payload
.
rpm
))
?
{}
:
{
rpm
:
parseInt
(
payload
.
rpm
)
}),
...(
payload
.
max_tokens
===
''
?
{}
:
{
max_tokens
:
payload
.
max_tokens
})
}
}
})
})
})
})
...
...
src/lib/components/chat/Settings/Models.svelte
View file @
9a83bde7
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
let liteLLMAPIBase = '';
let liteLLMAPIBase = '';
let liteLLMAPIKey = '';
let liteLLMAPIKey = '';
let liteLLMRPM = '';
let liteLLMRPM = '';
let liteLLMMaxTokens = '';
let deleteLiteLLMModelId = '';
let deleteLiteLLMModelId = '';
...
@@ -326,7 +327,8 @@
...
@@ -326,7 +327,8 @@
model: liteLLMModel,
model: liteLLMModel,
api_base: liteLLMAPIBase,
api_base: liteLLMAPIBase,
api_key: liteLLMAPIKey,
api_key: liteLLMAPIKey,
rpm: liteLLMRPM
rpm: liteLLMRPM,
max_tokens: liteLLMMaxTokens
}).catch((error) => {
}).catch((error) => {
toast.error(error);
toast.error(error);
return null;
return null;
...
@@ -821,6 +823,22 @@
...
@@ -821,6 +823,22 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="mb-1.5 text-sm font-medium">Max Tokens</div>
<div class="flex w-full">
<div class="flex-1">
<input
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
placeholder="Enter Max Tokens (litellm_params.max_tokens)"
bind:value={liteLLMMaxTokens}
type="number"
min="1"
autocomplete="off"
/>
</div>
</div>
</div>
{/if}
{/if}
</div>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment