mirror of
https://github.com/arc53/DocsGPT.git
synced 2026-02-21 03:41:02 +00:00
Update application files, fix LLM models, and create new retriever class
This commit is contained in:
@@ -205,7 +205,12 @@ def stream():
|
||||
else:
|
||||
source = {}
|
||||
|
||||
retriever = RetrieverCreator.create_retriever("classic", question=question,
|
||||
if source["active_docs"].split("/")[0] == "default" or source["active_docs"].split("/")[0] == "local":
|
||||
retriever_name = "classic"
|
||||
else:
|
||||
retriever_name = source['active_docs']
|
||||
|
||||
retriever = RetrieverCreator.create_retriever(retriever_name, question=question,
|
||||
source=source, chat_history=history, prompt=prompt, chunks=chunks, gpt_model=gpt_model
|
||||
)
|
||||
|
||||
@@ -247,7 +252,12 @@ def api_answer():
|
||||
else:
|
||||
source = {data}
|
||||
|
||||
retriever = RetrieverCreator.create_retriever("classic", question=question,
|
||||
if source["active_docs"].split("/")[0] == "default" or source["active_docs"].split("/")[0] == "local":
|
||||
retriever_name = "classic"
|
||||
else:
|
||||
retriever_name = source['active_docs']
|
||||
|
||||
retriever = RetrieverCreator.create_retriever(retriever_name, question=question,
|
||||
source=source, chat_history=history, prompt=prompt, chunks=chunks, gpt_model=gpt_model
|
||||
)
|
||||
source_log_docs = []
|
||||
@@ -290,9 +300,14 @@ def api_search():
|
||||
else:
|
||||
chunks = 2
|
||||
|
||||
retriever = RetrieverCreator.create_retriever("classic", question=question,
|
||||
source=source, chat_history=[], prompt="default", chunks=chunks, gpt_model=gpt_model
|
||||
)
|
||||
if source["active_docs"].split("/")[0] == "default" or source["active_docs"].split("/")[0] == "local":
|
||||
retriever_name = "classic"
|
||||
else:
|
||||
retriever_name = source['active_docs']
|
||||
|
||||
retriever = RetrieverCreator.create_retriever(retriever_name, question=question,
|
||||
source=source, chat_history=[], prompt="default", chunks=chunks, gpt_model=gpt_model
|
||||
)
|
||||
docs = retriever.search()
|
||||
return docs
|
||||
|
||||
|
||||
@@ -237,6 +237,20 @@ def combined_json():
|
||||
for index in data_remote:
|
||||
index["location"] = "remote"
|
||||
data.append(index)
|
||||
if 'duckduck_search' in settings.RETRIEVERS_ENABLED:
|
||||
data.append(
|
||||
{
|
||||
"name": "DuckDuckGo Search",
|
||||
"language": "en",
|
||||
"version": "",
|
||||
"description": "duckduck_search",
|
||||
"fullName": "DuckDuckGo Search",
|
||||
"date": "duckduck_search",
|
||||
"docLink": "duckduck_search",
|
||||
"model": settings.EMBEDDINGS_NAME,
|
||||
"location": "custom",
|
||||
}
|
||||
)
|
||||
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ class Settings(BaseSettings):
|
||||
TOKENS_MAX_HISTORY: int = 150
|
||||
UPLOAD_FOLDER: str = "inputs"
|
||||
VECTOR_STORE: str = "faiss" # "faiss" or "elasticsearch" or "qdrant"
|
||||
RETRIEVERS_ENABLED: list = ["classic_rag", "duckduck_search"] # also brave_search
|
||||
|
||||
API_URL: str = "http://localhost:7091" # backend url for celery worker
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ boto3==1.34.6
|
||||
celery==5.3.6
|
||||
dataclasses_json==0.6.3
|
||||
docx2txt==0.8
|
||||
duckduckgo-search=5.3.0
|
||||
duckduckgo-search==5.3.0
|
||||
EbookLib==0.18
|
||||
elasticsearch==8.12.0
|
||||
escodegen==1.0.11
|
||||
|
||||
@@ -6,7 +6,7 @@ from application.retriever.duckduck_search import DuckDuckSearch
|
||||
class RetrieverCreator:
|
||||
retievers = {
|
||||
'classic': ClassicRAG,
|
||||
'duckduck': DuckDuckSearch
|
||||
'duckduck_search': DuckDuckSearch
|
||||
}
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user