mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-13 02:14:23 +00:00
Default retrieval to 6 chunks instead of 2
chunks is a total per request, split across the attached sources, so an agent with two sources and the default of 2 got a single chunk from each, and its answers changed with whichever chunk won. 6 gives three per source for about 4-5k more input tokens per retrieval turn. Every literal default moves from 2 to 6: the request default, the retrievers, the internal search tool, workflow agent nodes, scheduled and headless runs, agent create/update/import, the source retrieval config and the frontend forms. Existing agents and sources keep what they store; a source saved with chunks=2 now counts as configured at 2, which is pinned by a test. Headless runs also read chunks=0 as unset (`or 2`), so an agent with retrieval switched off retrieved anyway on scheduled runs; 0 now stays 0.
This commit is contained in:
1 parent
1c19ed8ce2
commit
ab3dbfa1be
33 files changed
+187
-46
No files matched your search
@@ -473,7 +473,7 @@ class TestConfigureRetriever:
|
||||
sp = StreamProcessor({}, {"sub": "u"})
|
||||
sp._configure_retriever()
|
||||
assert sp.retriever_config["retriever_name"] == "classic"
|
||||
assert sp.retriever_config["chunks"] == 2
|
||||
assert sp.retriever_config["chunks"] == 6
|
||||
|
||||
def test_agent_overrides(self):
|
||||
from docsgpt.api.answer.services.stream_processor import (
|
||||
@@ -519,7 +519,7 @@ class TestConfigureRetriever:
|
||||
sp._agent_data = {}
|
||||
sp._configure_retriever()
|
||||
assert sp.retriever_config["retriever_name"] == "classic"
|
||||
assert sp.retriever_config["chunks"] == 2
|
||||
assert sp.retriever_config["chunks"] == 6
|
||||
|
||||
def test_invalid_agent_chunks_falls_back(self):
|
||||
from docsgpt.api.answer.services.stream_processor import (
|
||||
@@ -528,7 +528,7 @@ class TestConfigureRetriever:
|
||||
sp = StreamProcessor({}, {"sub": "u"})
|
||||
sp._agent_data = {"chunks": "not-a-number"}
|
||||
sp._configure_retriever()
|
||||
assert sp.retriever_config["chunks"] == 2
|
||||
assert sp.retriever_config["chunks"] == 6
|
||||
|
||||
def test_invalid_request_chunks_falls_back(self):
|
||||
from docsgpt.api.answer.services.stream_processor import (
|
||||
@@ -536,7 +536,7 @@ class TestConfigureRetriever:
|
||||
)
|
||||
sp = StreamProcessor({"chunks": "abc"}, {"sub": "u"})
|
||||
sp._configure_retriever()
|
||||
assert sp.retriever_config["chunks"] == 2
|
||||
assert sp.retriever_config["chunks"] == 6
|
||||
|
||||
def test_isnonedoc_without_api_key_sets_chunks_to_0(self):
|
||||
from docsgpt.api.answer.services.stream_processor import (
|
||||
|
||||
Reference in new issue
Block a user