data_types
Harbor-compatible data shapes.
The schemas runners consume and dashboards render. Mirrors the production internal types so JSONL files round-trip between this SDK and the internal serving / dashboard stack without conversion.
Two row formats:
ChatMessagesRow- SFT example (messages prefix + supervised target)HarborTask- RL task (instruction + verifier spec)
Verifier specs (the data the runner serializes for HarborTask):
InProcessVerifier- cheap Python fn lookupE2BVerifier- sandboxed code executionLLMJudgeVerifier- judge model + rubricVerifierPayload- discriminated union of the three (use this in type hints).
These are data shapes (Pydantic / dataclasses) describing the verification
plan; the runtime Verifier Protocol in protocols.py is what actually
EXECUTES verification. They are deliberately separate concepts.
Multimodal content: messages can carry text + image blocks in OpenAI or
Anthropic style. Use image_url_block(url) or
image_base64_block(media_type, b64) for convenience.
attributeVerifierPayload= Union[InProcessVerifier, E2BVerifier, LLMJudgeVerifier]Discriminated by .kind ∈ {'in_process', 'e2b', 'llm_judge'}.
attribute__all__= ['TargetFormat', 'ChatMessagesRow', 'HarborTask', 'PromptExample', 'InProcessVerifier', 'E2BVerifier', 'LLMJudgeVerifier', 'VerifierPayload', 'text_block', 'image_url_block', 'image_base64_block', 'block_to_image_src', 'has_images', 'detect_format', 'harbor_task_from_dict', 'chat_messages_row_from_dict', 'prompt_example_from_dict', 'from_dict', 'parse_rows', 'to_dict', 'iter_jsonl']functext_block(text) -> dictStandard text block. Works in either OpenAI or Anthropic shape.
paramtextstrReturns
dictfuncimage_url_block(url, *, detail=None) -> dictOpenAI-style image block. Works for any vision model that follows the OpenAI multimodal content schema (most do).
paramurlstrparamdetailstr | None= NoneReturns
dictfuncimage_base64_block(media_type, b64_data) -> dictAnthropic-style base64 image block.
media_type is the MIME type, e.g. "image/png".
parammedia_typestrparamb64_datastrReturns
dictfuncblock_to_image_src(block) -> str | NoneReturn a renderable image src URL/data-URL for a content block, or None.
Handles OpenAI image_url blocks AND Anthropic image blocks (both
URL and base64 variants). Used by dashboard renderers.
paramblockAnyReturns
str | Nonefunchas_images(row) -> boolTrue iff any message in the row carries at least one image block.
paramrowChatMessagesRowReturns
boolfuncdetect_format(row) -> strReturns 'chat_messages' | 'harbor_task' | 'prompt_dataset' | 'unknown'.
Checked most-specific first: harbor_task and prompt_dataset have
distinctive key pairs; chat_messages is any row carrying messages
(the conversation - supervision is decided by the algorithm, not the row).
paramrowAnyReturns
strfunc_verifier_from_dict(d) -> VerifierPayloadparamddictReturns
evsys_sdk.data_types.VerifierPayloadfuncharbor_task_from_dict(d) -> HarborTaskparamddictReturns
evsys_sdk.data_types.HarborTaskfuncchat_messages_row_from_dict(d) -> ChatMessagesRowparamddictReturns
evsys_sdk.data_types.ChatMessagesRowfuncprompt_example_from_dict(d) -> PromptExampleparamddictReturns
evsys_sdk.data_types.PromptExamplefuncfrom_dict(row) -> Union[ChatMessagesRow, HarborTask, PromptExample]Dispatch on row shape - round-trips the JSONL coming off a runner.
paramrowdictReturns
typing.Union[evsys_sdk.data_types.ChatMessagesRow, evsys_sdk.data_types.HarborTask, evsys_sdk.data_types.PromptExample]funcparse_rows(rows, fmt) -> list[Union[ChatMessagesRow, HarborTask, PromptExample]]Strictly parse raw dicts into typed rows for the given fmt.
This is the standardized boundary between the transform stage and a
StepBuilder/algorithm: raw rows -> transforms -> parse_rows(fmt) -> typed rows. fmt is a :class:TargetFormat (or its string value). Every row
must match fmt per :func:detect_format; a mismatch raises
ValueError naming the offending row - no silent coercion, mirroring the
SDK's extra='forbid' philosophy. Tokenization/rollout stays downstream,
owned by the algorithm.
paramrowsIterable[dict]paramfmtUnion['TargetFormat', str]Returns
list[typing.Union[evsys_sdk.data_types.ChatMessagesRow, evsys_sdk.data_types.HarborTask, evsys_sdk.data_types.PromptExample]]functo_dict(obj) -> dictDataclass → plain dict (JSON-serializable).
paramobjUnion[ChatMessagesRow, HarborTask, PromptExample, VerifierPayload]Returns
dictfunciter_jsonl(path) -> Iterable[Union[ChatMessagesRow, HarborTask, PromptExample]]Iterate a mixed-format JSONL and yield typed rows.
parampathstrReturns
typing.Iterable[typing.Union[evsys_sdk.data_types.ChatMessagesRow, evsys_sdk.data_types.HarborTask, evsys_sdk.data_types.PromptExample]]