mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-07-24 21:41:04 +02:00
fix: default SDK retrieve_model to gpt-5.4 instead of following model
The local SDK path builds IndexConfig directly (not from config.yaml), so retrieve_model defaulting to None made agentic QA silently follow the cheaper indexing model (gpt-4o) instead of the stronger gpt-5.4 the packaged config and CLI use. Set the IndexConfig field default to gpt-5.4; retrieve_model=None still follows model as an explicit escape hatch. Cloud path and the index-only CLI are unaffected.
This commit is contained in:
parent
6f200927cb
commit
1054132756
5 changed files with 24 additions and 5 deletions
|
|
@ -35,7 +35,7 @@ class PageIndexClient:
|
|||
api_key: PageIndex cloud API key. When provided, cloud mode is used
|
||||
and local-only params (model, storage_path, index_config, …) are ignored.
|
||||
model: LLM model for indexing (local mode only, default: gpt-4o-2024-11-20).
|
||||
retrieve_model: LLM model for agent QA (local mode only, default: same as model).
|
||||
retrieve_model: LLM model for agent QA (local mode only, default: gpt-5.4).
|
||||
storage_path: Directory for SQLite DB and files (local mode only, default: ./.pageindex).
|
||||
storage: Custom StorageEngine instance (local mode only).
|
||||
index_config: Advanced indexing parameters (local mode only, optional).
|
||||
|
|
@ -312,7 +312,7 @@ class LocalClient(PageIndexClient):
|
|||
|
||||
Args:
|
||||
model: LLM model for indexing (default: gpt-4o-2024-11-20)
|
||||
retrieve_model: LLM model for agent QA (default: same as model)
|
||||
retrieve_model: LLM model for agent QA (default: gpt-5.4)
|
||||
storage_path: Directory for SQLite DB and files (default: ./.pageindex)
|
||||
storage: Custom StorageEngine instance (default: SQLiteStorage)
|
||||
index_config: Advanced indexing parameters. Pass an IndexConfig instance
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class IndexConfig(BaseModel):
|
|||
model_config = {"extra": "forbid"}
|
||||
|
||||
model: str = "gpt-4o-2024-11-20"
|
||||
retrieve_model: str | None = None
|
||||
retrieve_model: str | None = "gpt-5.4" # None = follow `model`
|
||||
toc_check_page_num: int = 20
|
||||
max_page_num_each_node: int = 10
|
||||
max_token_num_each_node: int = 20000
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
model: "gpt-4o-2024-11-20"
|
||||
# model: "anthropic/claude-sonnet-4-6"
|
||||
retrieve_model: "gpt-5.4" # defaults to `model` if not set
|
||||
retrieve_model: "gpt-5.4" # set to null to follow `model`
|
||||
toc_check_page_num: 20
|
||||
max_page_num_each_node: 10
|
||||
max_token_num_each_node: 20000
|
||||
|
|
|
|||
|
|
@ -69,6 +69,25 @@ def test_delete_collection(tmp_path):
|
|||
assert "papers" not in client.list_collections()
|
||||
|
||||
|
||||
def test_retrieve_model_defaults_to_strong_reasoner(tmp_path):
|
||||
"""Retrieval must not silently follow the (cheaper) indexing model."""
|
||||
client = LocalClient(model="gpt-4o", storage_path=str(tmp_path / "pi"))
|
||||
assert client._backend.get_retrieve_model() == "gpt-5.4"
|
||||
|
||||
|
||||
def test_explicit_retrieve_model_wins(tmp_path):
|
||||
client = LocalClient(model="gpt-4o", retrieve_model="ollama/llama3",
|
||||
storage_path=str(tmp_path / "pi"))
|
||||
assert client._backend.get_retrieve_model() == "litellm/ollama/llama3"
|
||||
|
||||
|
||||
def test_retrieve_model_none_follows_model(tmp_path):
|
||||
from pageindex.config import IndexConfig
|
||||
client = LocalClient(model="gpt-4o", storage_path=str(tmp_path / "pi"),
|
||||
index_config=IndexConfig(retrieve_model=None))
|
||||
assert client._backend.get_retrieve_model() == "gpt-4o"
|
||||
|
||||
|
||||
def test_register_parser(tmp_path):
|
||||
client = LocalClient(model="gpt-4o", storage_path=str(tmp_path / "pi"))
|
||||
class FakeParser:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ from pageindex.config import IndexConfig
|
|||
def test_defaults():
|
||||
config = IndexConfig()
|
||||
assert config.model == "gpt-4o-2024-11-20"
|
||||
assert config.retrieve_model is None
|
||||
assert config.retrieve_model == "gpt-5.4"
|
||||
assert config.toc_check_page_num == 20
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue