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
8aa47ea6
"docs/git@developer.sourcefind.cn:OpenDAS/nni.git" did not exist on "571817e2d73112d6af467edbe7ebbcbf93276956"
Commit
8aa47ea6
authored
Apr 27, 2024
by
Timothy J. Baek
Browse files
fix
parent
704f7e36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
39 deletions
+51
-39
CHANGELOG.md
CHANGELOG.md
+2
-0
backend/apps/litellm/main.py
backend/apps/litellm/main.py
+49
-39
No files found.
CHANGELOG.md
View file @
8aa47ea6
...
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
...
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.1.122] - 2024-04-27
## [0.1.122] - 2024-04-27
### Added
-
**🌟 Enhanced RAG Pipeline**
: Now with hybrid searching via 'BM25', reranking powered by 'CrossEncoder', and configurable relevance score thresholds.
-
**🌟 Enhanced RAG Pipeline**
: Now with hybrid searching via 'BM25', reranking powered by 'CrossEncoder', and configurable relevance score thresholds.
-
**🛢️ External Database Support**
: Seamlessly connect to custom SQLite or Postgres databases using the 'DATABASE_URL' environment variable.
-
**🛢️ External Database Support**
: Seamlessly connect to custom SQLite or Postgres databases using the 'DATABASE_URL' environment variable.
-
**🌐 Remote ChromaDB Support**
: Introducing the capability to connect to remote ChromaDB servers.
-
**🌐 Remote ChromaDB Support**
: Introducing the capability to connect to remote ChromaDB servers.
...
...
backend/apps/litellm/main.py
View file @
8aa47ea6
...
@@ -28,6 +28,7 @@ log.setLevel(SRC_LOG_LEVELS["LITELLM"])
...
@@ -28,6 +28,7 @@ log.setLevel(SRC_LOG_LEVELS["LITELLM"])
from
config
import
(
from
config
import
(
ENABLE_LITELLM
,
ENABLE_MODEL_FILTER
,
ENABLE_MODEL_FILTER
,
MODEL_FILTER_LIST
,
MODEL_FILTER_LIST
,
DATA_DIR
,
DATA_DIR
,
...
@@ -59,6 +60,8 @@ LITELLM_CONFIG_DIR = f"{DATA_DIR}/litellm/config.yaml"
...
@@ -59,6 +60,8 @@ LITELLM_CONFIG_DIR = f"{DATA_DIR}/litellm/config.yaml"
with
open
(
LITELLM_CONFIG_DIR
,
"r"
)
as
file
:
with
open
(
LITELLM_CONFIG_DIR
,
"r"
)
as
file
:
litellm_config
=
yaml
.
safe_load
(
file
)
litellm_config
=
yaml
.
safe_load
(
file
)
app
.
state
.
ENABLE
=
ENABLE_LITELLM
app
.
state
.
CONFIG
=
litellm_config
app
.
state
.
CONFIG
=
litellm_config
# Global variable to store the subprocess reference
# Global variable to store the subprocess reference
...
@@ -209,49 +212,56 @@ async def update_config(form_data: LiteLLMConfigForm, user=Depends(get_admin_use
...
@@ -209,49 +212,56 @@ async def update_config(form_data: LiteLLMConfigForm, user=Depends(get_admin_use
@
app
.
get
(
"/models"
)
@
app
.
get
(
"/models"
)
@
app
.
get
(
"/v1/models"
)
@
app
.
get
(
"/v1/models"
)
async
def
get_models
(
user
=
Depends
(
get_current_user
)):
async
def
get_models
(
user
=
Depends
(
get_current_user
)):
while
not
background_process
:
await
asyncio
.
sleep
(
0.1
)
url
=
f
"http://localhost:
{
LITELLM_PROXY_PORT
}
/v1"
r
=
None
try
:
r
=
requests
.
request
(
method
=
"GET"
,
url
=
f
"
{
url
}
/models"
)
r
.
raise_for_status
()
data
=
r
.
json
()
if
app
.
state
.
ENABLE
:
while
not
background_process
:
if
app
.
state
.
ENABLE_MODEL_FILTER
:
await
asyncio
.
sleep
(
0.1
)
if
user
and
user
.
role
==
"user"
:
data
[
"data"
]
=
list
(
url
=
f
"http://localhost:
{
LITELLM_PROXY_PORT
}
/v1"
filter
(
r
=
None
lambda
model
:
model
[
"id"
]
in
app
.
state
.
MODEL_FILTER_LIST
,
try
:
data
[
"data"
],
r
=
requests
.
request
(
method
=
"GET"
,
url
=
f
"
{
url
}
/models"
)
r
.
raise_for_status
()
data
=
r
.
json
()
if
app
.
state
.
ENABLE_MODEL_FILTER
:
if
user
and
user
.
role
==
"user"
:
data
[
"data"
]
=
list
(
filter
(
lambda
model
:
model
[
"id"
]
in
app
.
state
.
MODEL_FILTER_LIST
,
data
[
"data"
],
)
)
)
)
return
data
except
Exception
as
e
:
log
.
exception
(
e
)
error_detail
=
"Open WebUI: Server Connection Error"
if
r
is
not
None
:
try
:
res
=
r
.
json
()
if
"error"
in
res
:
error_detail
=
f
"External:
{
res
[
'error'
]
}
"
except
:
error_detail
=
f
"External:
{
e
}
"
return
data
except
Exception
as
e
:
log
.
exception
(
e
)
error_detail
=
"Open WebUI: Server Connection Error"
if
r
is
not
None
:
try
:
res
=
r
.
json
()
if
"error"
in
res
:
error_detail
=
f
"External:
{
res
[
'error'
]
}
"
except
:
error_detail
=
f
"External:
{
e
}
"
return
{
"data"
:
[
{
"id"
:
model
[
"model_name"
],
"object"
:
"model"
,
"created"
:
int
(
time
.
time
()),
"owned_by"
:
"openai"
,
}
for
model
in
app
.
state
.
CONFIG
[
"model_list"
]
],
"object"
:
"list"
,
}
else
:
return
{
return
{
"data"
:
[
"data"
:
[],
{
"id"
:
model
[
"model_name"
],
"object"
:
"model"
,
"created"
:
int
(
time
.
time
()),
"owned_by"
:
"openai"
,
}
for
model
in
app
.
state
.
CONFIG
[
"model_list"
]
],
"object"
:
"list"
,
"object"
:
"list"
,
}
}
...
...
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