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
b1d83fc4
"examples/community/gluegen.py" did not exist on "2a97067b8483db0cd832511a1d7df9b870a3e500"
Commit
b1d83fc4
authored
Jun 17, 2024
by
Timothy J. Baek
Browse files
chore: format
parent
20f052eb
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
13 deletions
+36
-13
backend/apps/rag/main.py
backend/apps/rag/main.py
+10
-6
backend/apps/rag/search/brave.py
backend/apps/rag/search/brave.py
+4
-2
backend/apps/rag/search/duckduckgo.py
backend/apps/rag/search/duckduckgo.py
+3
-1
backend/apps/rag/search/google_pse.py
backend/apps/rag/search/google_pse.py
+5
-1
backend/apps/rag/search/main.py
backend/apps/rag/search/main.py
+1
-0
backend/apps/rag/search/searxng.py
backend/apps/rag/search/searxng.py
+5
-1
backend/apps/rag/search/serper.py
backend/apps/rag/search/serper.py
+3
-1
backend/apps/rag/search/serpstack.py
backend/apps/rag/search/serpstack.py
+5
-1
No files found.
backend/apps/rag/main.py
View file @
b1d83fc4
...
...
@@ -777,7 +777,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
app
.
state
.
config
.
SEARXNG_QUERY_URL
,
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
,
)
else
:
raise
Exception
(
"No SEARXNG_QUERY_URL found in environment variables"
)
...
...
@@ -791,7 +791,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
app
.
state
.
config
.
GOOGLE_PSE_ENGINE_ID
,
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
,
)
else
:
raise
Exception
(
...
...
@@ -803,7 +803,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
app
.
state
.
config
.
BRAVE_SEARCH_API_KEY
,
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
,
)
else
:
raise
Exception
(
"No BRAVE_SEARCH_API_KEY found in environment variables"
)
...
...
@@ -824,7 +824,7 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
app
.
state
.
config
.
SERPER_API_KEY
,
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
,
)
else
:
raise
Exception
(
"No SERPER_API_KEY found in environment variables"
)
...
...
@@ -834,12 +834,16 @@ def search_web(engine: str, query: str) -> list[SearchResult]:
app
.
state
.
config
.
SERPLY_API_KEY
,
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
,
)
else
:
raise
Exception
(
"No SERPLY_API_KEY found in environment variables"
)
elif
engine
==
"duckduckgo"
:
return
search_duckduckgo
(
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
)
return
search_duckduckgo
(
query
,
app
.
state
.
config
.
RAG_WEB_SEARCH_RESULT_COUNT
,
app
.
state
.
config
.
RAG_WEB_SEARCH_DOMAIN_FILTER_LIST
,
)
elif
engine
==
"tavily"
:
if
app
.
state
.
config
.
TAVILY_API_KEY
:
return
search_tavily
(
...
...
backend/apps/rag/search/brave.py
View file @
b1d83fc4
...
...
@@ -9,7 +9,9 @@ log = logging.getLogger(__name__)
log
.
setLevel
(
SRC_LOG_LEVELS
[
"RAG"
])
def
search_brave
(
api_key
:
str
,
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
)
->
list
[
SearchResult
]:
def
search_brave
(
api_key
:
str
,
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
)
->
list
[
SearchResult
]:
"""Search using Brave's Search API and return the results as a list of SearchResult objects.
Args:
...
...
backend/apps/rag/search/duckduckgo.py
View file @
b1d83fc4
...
...
@@ -8,7 +8,9 @@ log = logging.getLogger(__name__)
log
.
setLevel
(
SRC_LOG_LEVELS
[
"RAG"
])
def
search_duckduckgo
(
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
)
->
list
[
SearchResult
]:
def
search_duckduckgo
(
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
)
->
list
[
SearchResult
]:
"""
Search using DuckDuckGo's Search API and return the results as a list of SearchResult objects.
Args:
...
...
backend/apps/rag/search/google_pse.py
View file @
b1d83fc4
...
...
@@ -11,7 +11,11 @@ log.setLevel(SRC_LOG_LEVELS["RAG"])
def
search_google_pse
(
api_key
:
str
,
search_engine_id
:
str
,
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
api_key
:
str
,
search_engine_id
:
str
,
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
,
)
->
list
[
SearchResult
]:
"""Search using Google's Programmable Search Engine API and return the results as a list of SearchResult objects.
...
...
backend/apps/rag/search/main.py
View file @
b1d83fc4
...
...
@@ -13,6 +13,7 @@ def get_filtered_results(results, filter_list):
filtered_results
.
append
(
result
)
return
filtered_results
class
SearchResult
(
BaseModel
):
link
:
str
title
:
Optional
[
str
]
...
...
backend/apps/rag/search/searxng.py
View file @
b1d83fc4
...
...
@@ -11,7 +11,11 @@ log.setLevel(SRC_LOG_LEVELS["RAG"])
def
search_searxng
(
query_url
:
str
,
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
,
**
kwargs
query_url
:
str
,
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
,
**
kwargs
,
)
->
List
[
SearchResult
]:
"""
Search a SearXNG instance for a given query and return the results as a list of SearchResult objects.
...
...
backend/apps/rag/search/serper.py
View file @
b1d83fc4
...
...
@@ -10,7 +10,9 @@ log = logging.getLogger(__name__)
log
.
setLevel
(
SRC_LOG_LEVELS
[
"RAG"
])
def
search_serper
(
api_key
:
str
,
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
)
->
list
[
SearchResult
]:
def
search_serper
(
api_key
:
str
,
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
)
->
list
[
SearchResult
]:
"""Search using serper.dev's API and return the results as a list of SearchResult objects.
Args:
...
...
backend/apps/rag/search/serpstack.py
View file @
b1d83fc4
...
...
@@ -11,7 +11,11 @@ log.setLevel(SRC_LOG_LEVELS["RAG"])
def
search_serpstack
(
api_key
:
str
,
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
,
https_enabled
:
bool
=
True
api_key
:
str
,
query
:
str
,
count
:
int
,
filter_list
:
Optional
[
List
[
str
]]
=
None
,
https_enabled
:
bool
=
True
,
)
->
list
[
SearchResult
]:
"""Search using serpstack.com's and return the results as a list of SearchResult objects.
...
...
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