Skip to content

API Reference parrot.knowledge.pageindex.llm_adapter

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.knowledge.pageindex.llm_adapter

View source

LLM adapter for PageIndex — wraps any AbstractClient for LLM-agnostic calls.

Alias AbstractClient

Re-exported from parrot.clients.base.AbstractClient.

Class PageIndexLLMAdapter

Wraps any AbstractClient for PageIndex-compatible LLM calls.

Provides structured output support via Pydantic models and fallback JSON extraction for providers without native support.

Parameter Type Default Description
client AbstractClient
model Optional[str] None
max_retries int 3
retry_delay float 1.0

Method PageIndexLLMAdapter.ask

Send a prompt and return raw text response.

If structured_output is given, the response will be parsed via the provider's native structured output. Falls back to raw text with manual JSON extraction on failure.

ask(prompt: str, structured_output: Union[type, StructuredOutputConfig, None] = None, temperature: float = 0.0, system_prompt: Optional[str] = None) -> str

Parameter Type Default Description
prompt str
structured_output Union[type, StructuredOutputConfig, None] None
temperature float 0.0
system_prompt Optional[str] None

Returns: str

Method PageIndexLLMAdapter.ask_structured

Send a prompt and return a parsed Pydantic model instance.

Tries native structured output first, falls back to manual JSON extraction and model validation.

ask_structured(prompt: str, output_type: type, temperature: float = 0.0, system_prompt: Optional[str] = None) -> Any

Parameter Type Default Description
prompt str
output_type type
temperature float 0.0
system_prompt Optional[str] None

Returns: Any

Method PageIndexLLMAdapter.ask_with_finish_info

LLM call that returns (text, finish_reason).

finish_reason is 'finished' or 'max_output_reached'.

ask_with_finish_info(prompt: str, temperature: float = 0.0, chat_history: Optional[list[dict[str, str]]] = None, system_prompt: Optional[str] = None) -> tuple[str, str]

Parameter Type Default Description
prompt str
temperature float 0.0
chat_history Optional[list[dict[str, str]]] None
system_prompt Optional[str] None

Returns: tuple[str, str]

Method PageIndexLLMAdapter.ask_json

Send a prompt and return parsed JSON (dict or list).

ask_json(prompt: str, temperature: float = 0.0, system_prompt: Optional[str] = None) -> Any

Parameter Type Default Description
prompt str
temperature float 0.0
system_prompt Optional[str] None

Returns: Any

Alias StructuredOutputConfig

Re-exported from parrot.models.outputs.StructuredOutputConfig.

Alias extract_json

Re-exported from parrot.knowledge.pageindex.utils.extract_json.

Attribute logger

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally