mirror of
https://github.com/VectifyAI/PageIndex.git
synced 2026-10-03 08:08:20 +08:00
Agent surfaces: keyword-only tails so a stale positional doc_id raises
doc_id sat first in the positional list on agent_instructions,
openai_agent_config and claude_agent_config, and second on
anthropic_runner_config and as_claude_mcp. With it removed, a v0.2.15 call
such as openai_agent_config("pi-a") no longer failed: the id landed on
include_management (truthy, so the management tools came along and
targeting silently vanished) or on server_name. A bare * after the
surviving leading positional turns those calls into an immediate
TypeError; every in-repo caller already passes keywords.
Claude-Session: https://claude.ai/code/session_017FumozBm2xbT2SG6WBxjMe
This commit is contained in:
+5
-2
@@ -1613,6 +1613,7 @@ class PageIndexClient:
|
||||
|
||||
def openai_agent_config(
|
||||
self,
|
||||
*,
|
||||
include_management: bool = False,
|
||||
model: Optional[str] = None,
|
||||
model_settings: Optional[Any] = None,
|
||||
@@ -1732,6 +1733,7 @@ class PageIndexClient:
|
||||
def anthropic_runner_config(
|
||||
self,
|
||||
model: str,
|
||||
*,
|
||||
include_management: bool = False,
|
||||
asynchronous: bool = False,
|
||||
max_tokens: Optional[int] = None,
|
||||
@@ -1788,7 +1790,7 @@ class PageIndexClient:
|
||||
"cache_control": {"type": "ephemeral"},
|
||||
}
|
||||
|
||||
def as_claude_mcp(self, include_management: bool = False,
|
||||
def as_claude_mcp(self, include_management: bool = False, *,
|
||||
server_name: str = "pageindex"):
|
||||
"""
|
||||
``mcp_servers`` entry for the Claude Agent SDK.
|
||||
@@ -1826,6 +1828,7 @@ class PageIndexClient:
|
||||
|
||||
def claude_agent_config(
|
||||
self,
|
||||
*,
|
||||
include_management: bool = False,
|
||||
server_name: str = "pageindex",
|
||||
) -> dict[str, Any]:
|
||||
@@ -1859,7 +1862,7 @@ class PageIndexClient:
|
||||
"allowed_tools": [f"mcp__{server_name}"],
|
||||
}
|
||||
|
||||
def agent_instructions(self, include_management: bool = False) -> str:
|
||||
def agent_instructions(self, *, include_management: bool = False) -> str:
|
||||
"""
|
||||
Orchestration guidance for document QA agents — pass as the agent's
|
||||
system prompt (or append to your own).
|
||||
|
||||
@@ -2255,6 +2255,20 @@ def test_document_context(client, store_path):
|
||||
client.document_context(bad)
|
||||
|
||||
|
||||
def test_removed_doc_id_positional_slot_raises(client):
|
||||
"""doc_id sat in the positional list on these; keyword-only tails make a
|
||||
stale positional call raise instead of landing on include_management
|
||||
or server_name."""
|
||||
for stale in (lambda: client.agent_instructions("pi-a"),
|
||||
lambda: client.openai_agent_config("pi-a"),
|
||||
lambda: client.anthropic_runner_config(
|
||||
"claude-sonnet-4-5", "pi-a"),
|
||||
lambda: client.claude_agent_config("pi-a"),
|
||||
lambda: client.as_claude_mcp(False, "pi-a")):
|
||||
with pytest.raises(TypeError):
|
||||
stale()
|
||||
|
||||
|
||||
def test_local_instructions_name_only_local_tools():
|
||||
"""The local instructions are trimmed from the cloud server's; every
|
||||
tool they name must exist in the local registry, or the trim drifted."""
|
||||
|
||||
Reference in New Issue
Block a user