mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-14 06:17: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
@@ -426,6 +426,31 @@ class TestCreateAgent:
|
||||
agents = AgentsRepository(pg_conn).list_for_user(user)
|
||||
assert any(a["name"] == "My Draft Agent" for a in agents)
|
||||
|
||||
def test_agent_created_without_chunks_stores_the_default(self, app, pg_conn):
|
||||
# With two sources, 2 left each one a single chunk, so the answer hung
|
||||
# on which chunk won; 6 is the default now.
|
||||
from docsgpt.api.user.agents.routes import CreateAgent
|
||||
from docsgpt.storage.db.repositories.agents import AgentsRepository
|
||||
|
||||
user = "u-create-default-chunks"
|
||||
|
||||
with _patch_db(pg_conn), app.test_request_context(
|
||||
"/api/create_agent",
|
||||
method="POST",
|
||||
json={
|
||||
"name": "Handbook Bot",
|
||||
"description": "d",
|
||||
"agent_type": "classic",
|
||||
"status": "draft",
|
||||
},
|
||||
):
|
||||
from flask import request
|
||||
request.decoded_token = {"sub": user}
|
||||
response = CreateAgent().post()
|
||||
assert response.status_code == 201
|
||||
(agent,) = AgentsRepository(pg_conn).list_for_user(user)
|
||||
assert agent["chunks"] == 6
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# UpdateAgent — big method with many validation branches
|
||||
|
||||
Reference in new issue
Block a user