Update application files, fix LLM models, and create new retriever class

This commit is contained in:
Alex
2024-04-09 16:38:42 +01:00
parent 1e26943c3e
commit 19494685ba
6 changed files with 67 additions and 74 deletions

View File

@@ -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

View File

@@ -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)