ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

module documentation

Provide http default operations through build_chatgpt_url.

Function _compact_frame Build a compact representation of one traceback frame.
Function _compact_header Build a bounded header for the diagnostic prompt.
Function _compact_prompt Build a compact prompt when the full traceback does not fit.
Function _encode_bounded Encode a bounded UTF-8 prefix or suffix.
Function _encode_field Encode a field and mark any truncation.
Function _frame_parts Yield frame locations and optional source lines.
Function _header_parts Yield the diagnostic request and exception fields.
Function _prompt_parts Yield the diagnostic header and captured frames.
Function _try_prompt Encode a prompt only when all fields fit within the limit.
Function build_chatgpt_url Build a compact, encoded diagnostic link within a local URL budget.
Constant _CHATGPT_URL_PREFIX https://chatgpt.com/?prompt=.
Constant _ESCAPE_WIDTH Escape width value used by assistance.
Constant _FRAME_HEADING Section heading introducing the error traceback frames.
Constant _MIN_FRAME_BUDGET Min frame budget value used by assistance.
Constant _PROMPT_BUDGET Prompt budget used by assistance.
Constant _PROMPT_START Opening instruction included in the bounded error-assistance prompt.
Constant _SOURCE_NOTICE `` [Source snippets omitted to fit the URL limit.]``.
Constant _TRUNCATION_NOTICE `` [Truncated to fit URL: source snippets omitted; {omitted} older frames omitted.]``.
Constant CHATGPT_URL_MAX_LENGTH Apply a conservative application limit to the complete outgoing URL.
def _compact_frame(frame: dict[str, Any], budget: int) -> str: (source)

Build a compact representation of one traceback frame.

Parameters
frame:dict[str, typing.Any]Parsed traceback frame.
budget:intMaximum encoded length assigned to the frame.
Returns
strEncoded compact frame location.
def _compact_header(traceback_data: dict[str, Any], locale: str, request_method: str, request_path: str) -> str: (source)

Build a bounded header for the diagnostic prompt.

Parameters
traceback_data:dict[str, typing.Any]Parsed exception data.
locale:strRequested response locale.
request_method:strHTTP method associated with the request.
request_path:strHTTP path associated with the request.
Returns
strEncoded diagnostic header.
def _compact_prompt(traceback_data: dict[str, Any], locale: str, request_method: str, request_path: str) -> str: (source)

Build a compact prompt when the full traceback does not fit.

Parameters
traceback_data:dict[str, typing.Any]Parsed exception data.
locale:strRequested response locale.
request_method:strHTTP method associated with the request.
request_path:strHTTP path associated with the request.
Returns
strEncoded prompt within the configured URL budget.
def _encode_bounded(value: str, limit: int, *, tail: bool = False) -> tuple[str, bool]: (source)

Encode a bounded UTF-8 prefix or suffix.

Parameters
value:strText to encode.
limit:intMaximum encoded length.
tail:bool, optionalPreserve the suffix instead of the prefix.
Returns
tuple[str, bool]Encoded text and whether the value was shortened.
def _encode_field(value: str, limit: int, *, tail: bool = False) -> str: (source)

Encode a field and mark any truncation.

Parameters
value:strText to encode.
limit:intMaximum encoded length before the truncation marker.
tail:bool, optionalPreserve the suffix instead of the prefix.
Returns
strEncoded text with a truncation marker when necessary.
def _frame_parts(frames: Iterable[dict[str, Any]], *, sources: bool) -> Iterator[str]: (source)

Yield frame locations and optional source lines.

Parameters
frames:collections.abc.Iterable[dict[str, typing.Any]]Traceback frames in most-recent-first order.
sources:boolWhether to include failing source lines.
Returns
collections.abc.Iterator[str]Unencoded frame fields.
def _header_parts(traceback_data: dict[str, Any], locale: str, request_method: str, request_path: str) -> Iterator[str]: (source)

Yield the diagnostic request and exception fields.

Parameters
traceback_data:dict[str, typing.Any]Parsed exception data.
locale:strRequested response locale.
request_method:strHTTP method associated with the request.
request_path:strHTTP path associated with the request.
Returns
collections.abc.Iterator[str]Individual unencoded header fields.
def _prompt_parts(traceback_data: dict[str, Any], locale: str, request_method: str, request_path: str, *, sources: bool) -> Iterator[str]: (source)

Yield the diagnostic header and captured frames.

Parameters
traceback_data:dict[str, typing.Any]Parsed exception data.
locale:strRequested response locale.
request_method:strHTTP method associated with the request.
request_path:strHTTP path associated with the request.
sources:boolWhether to include failing source lines.
Returns
collections.abc.Iterator[str]Unencoded prompt fields in traceback order.
def _try_prompt(parts: Iterable[str], *, notice: str = '', prefix: str = '', limit: int = _PROMPT_BUDGET) -> str | None: (source)

Encode a prompt only when all fields fit within the limit.

Parameters
parts:collections.abc.Iterable[str]Prompt fields to encode.
notice:str, optionalLimit notice appended to the prompt.
prefix:str, optionalAlready encoded prompt prefix.
limit:int, optionalMaximum encoded prompt length.
Returns
str | NoneComplete encoded prompt, or None when a field does not fit.
def build_chatgpt_url(traceback_data: dict[str, Any], locale: str, request_method: str, request_path: str) -> tuple[str, bool]: (source)

Build a compact, encoded diagnostic link within a local URL budget.

Include every captured frame and its failing source line when they fit. Otherwise omit source snippets before shortening fields or dropping the oldest frames. The limit is an application compatibility policy, not a published ChatGPT maximum. No request data is cached or transmitted here.

Parameters
traceback_data:dict[str, typing.Any]ExceptionParser output, including frames in most-recent-first order.
locale:strLocale requested for the diagnostic response.
request_method:strHTTP method associated with the failed request.
request_path:strHTTP path associated with the failed request.
Returns
tuple[str, bool]ASCII URL and whether source, fields, or frames were omitted.
_CHATGPT_URL_PREFIX: str = (source)

https://chatgpt.com/?prompt=.

Value
'https://chatgpt.com/?prompt='
_ESCAPE_WIDTH: int = (source)

Escape width value used by assistance.

Value
3
_FRAME_HEADING: str = (source)

Section heading introducing the error traceback frames.

Value
'''
Frames (most recent first):
'''
_MIN_FRAME_BUDGET: int = (source)

Min frame budget value used by assistance.

Value
48
_PROMPT_BUDGET: int = (source)

Prompt budget used by assistance.

Value
CHATGPT_URL_MAX_LENGTH - len(_CHATGPT_URL_PREFIX)
_PROMPT_START: str = (source)

Opening instruction included in the bounded error-assistance prompt.

Value
'Diagnose this Orionis Framework/Python error and suggest a fix. Respond in the ↵
language of locale '
_SOURCE_NOTICE: str = (source)

`` [Source snippets omitted to fit the URL limit.]``.

Value
'''
[Source snippets omitted to fit the URL limit.]'''
_TRUNCATION_NOTICE: str = (source)

`` [Truncated to fit URL: source snippets omitted; {omitted} older frames omitted.]``.

Value
'''
[Truncated to fit URL: source snippets omitted; {omitted} older frames omitted.]'''
CHATGPT_URL_MAX_LENGTH: int = (source)

Apply a conservative application limit to the complete outgoing URL.

Value
2048