On this page
One-shot LLM convenience functions, no PG or scheduler involved: ask() sends a single prompt, ask_structured() validates the reply against a JSON schema, sync_ask() wraps it for non-async callers.
#services.src.orxtra.services._ask
#services.src.orxtra.services._ask
#_build_transport
def _build_transport(provider_type: str, api_key: str, *, base_url: str | None=None, max_tokens: int=4096) -> TransportConstruct a Transport from provider parameters.
#ask
async def ask(prompt: str, provider_type: str, model: str, api_key: str, *, system_prompt: str | None=None, base_url: str | None=None, max_tokens: int=4096) -> strSend a prompt to an LLM and get text back.
No PG, no scheduler, no workflows. A one-shot convenience function that constructs a provider, sends a single message, and returns the result text.
#ask_structured
async def ask_structured(prompt: str, provider_type: str, model: str, api_key: str, schema: dict[str, Any], *, system_prompt: str | None=None, base_url: str | None=None, max_tokens: int=4096) -> dict[str, Any]Send a prompt and get a JSON-validated response.
Wraps ask() with a system prompt instructing the LLM to respond with JSON matching the given schema, then parses and validates the response.
#sync_ask
def sync_ask(prompt: str, provider_type: str, model: str, api_key: str, **kwargs: Any) -> strSynchronous wrapper around :func:ask.
Constructs a provider, sends a single message, and returns the result text. Intended for scripts and synchronous consumers that cannot use async/await.