fix(gateway): troncamento documenti rerank (RERANK_MAX_DOC_CHARS=800) — evita 500 batch-size e costi oltre il ctx
This commit is contained in:
@@ -145,6 +145,20 @@ def test_normalize_score():
|
||||
assert rerank.normalize_score(-10.0) < 0.01
|
||||
|
||||
|
||||
def test_troncamento_documenti(monkeypatch):
|
||||
_use_chain(monkeypatch)
|
||||
seen: dict = {}
|
||||
|
||||
def handler(request):
|
||||
seen["docs"] = json.loads(request.content)["documents"]
|
||||
return httpx.Response(200, json={"results": [{"index": 0, "relevance_score": 1.0}]})
|
||||
|
||||
_mock_client(handler)
|
||||
asyncio.run(rerank.rerank("q", ["x" * 5000, "corto"]))
|
||||
assert len(seen["docs"][0]) == 800 # default RERANK_MAX_DOC_CHARS
|
||||
assert seen["docs"][1] == "corto"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# integrazione endpoint search
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user