julee.domain.models¶
Domain models for julee.
This package contains all the domain entities and value objects following Clean Architecture principles. These models are framework-independent and contain only business logic.
- Re-exports commonly used models for convenient importing:
from julee.domain.models import Document, Assembly, Policy
Submodules¶
Classes¶
Assembly process that links a specification with input document and |
|
Assembly specification configuration that defines how to assemble |
|
Status of an assembly specification configuration. |
|
Status of an assembly process. |
|
Wrapper for IO streams that provides proper Pydantic validation. |
|
Complete document entity including content and metadata. |
|
Represents the validation of a document against a policy configuration. |
|
Status of a document through the Capture, Extract, Assemble, Publish |
|
Knowledge service configuration that defines how to interact with |
|
Knowledge service query configuration for extracting specific data. |
|
Policy configuration that defines validation and |
|
Status of a policy configuration. |
Package Contents¶
- class julee.domain.models.Assembly(/, **data)[source]¶
Bases:
pydantic.BaseModelAssembly process that links a specification with input document and produces an assembled document.
An Assembly represents a specific instance of the document assembly process. It connects an AssemblySpecification (which defines how to assemble) with an input Document (what to assemble from) and produces a single assembled document as output.
- assembled_document_id: str | None = None¶
- assembly_id: str = None¶
- assembly_specification_id: str = None¶
- created_at: datetime.datetime | None = None¶
- input_document_id: str = None¶
- status: AssemblyStatus¶
- updated_at: datetime.datetime | None = None¶
- workflow_id: str = None¶
- class julee.domain.models.AssemblySpecification(/, **data)[source]¶
Bases:
pydantic.BaseModelAssembly specification configuration that defines how to assemble documents of a specific type.
An AssemblySpecification represents a type of document output (like “meeting minutes”, “project report”, etc.) and defines which extractors should be used to collect the necessary data from source documents.
The AssemblySpecification does not contain the template itself - templates will be handled separately during the assembly rendering (or publishing?) phase. This separation allows the same AssemblySpecification definition to be used with different templates over time.
- applicability: str = None¶
- assembly_specification_id: str = None¶
- created_at: datetime.datetime | None = None¶
- jsonschema: dict[str, Any] = None¶
- knowledge_service_queries: dict[str, str] = None¶
- name: str = None¶
- status: AssemblySpecificationStatus¶
- updated_at: datetime.datetime | None = None¶
- version: str = None¶
- class julee.domain.models.AssemblySpecificationStatus[source]¶
Bases:
str,enum.EnumStatus of an assembly specification configuration.
- ACTIVE = 'active'¶
- DEPRECATED = 'deprecated'¶
- DRAFT = 'draft'¶
- INACTIVE = 'inactive'¶
- class julee.domain.models.AssemblyStatus[source]¶
Bases:
str,enum.EnumStatus of an assembly process.
- CANCELLED = 'cancelled'¶
- COMPLETED = 'completed'¶
- FAILED = 'failed'¶
- IN_PROGRESS = 'in_progress'¶
- PENDING = 'pending'¶
- class julee.domain.models.ContentStream(stream)[source]¶
Wrapper for IO streams that provides proper Pydantic validation.
This class wraps io.IOBase instances to provide proper Pydantic validation without requiring arbitrary_types_allowed. It ensures that only valid stream objects are accepted while providing a clean interface for stream operations.
- property stream: io.IOBase¶
Access the underlying stream.
- class julee.domain.models.Document(/, **data)[source]¶
Bases:
pydantic.BaseModelComplete document entity including content and metadata.
This is the primary domain model that represents a complete document in the CEAP workflow system. Content is provided as a ContentStream for efficient handling of both small and large documents.
The content stream is excluded from JSON serialization - use separate content endpoints for streaming binary data over HTTP.
- additional_metadata: dict[str, Any] = None¶
- assembly_types: list[str] = None¶
- content: julee.domain.models.custom_fields.content_stream.ContentStream | None = None¶
- content_bytes: bytes | None = None¶
- content_multihash: str = None¶
- content_type: str¶
- created_at: datetime.datetime | None = None¶
- document_id: str¶
- knowledge_service_id: str | None = None¶
- original_filename: str¶
- size_bytes: int = None¶
- status: DocumentStatus¶
- updated_at: datetime.datetime | None = None¶
- class julee.domain.models.DocumentPolicyValidation(/, **data)[source]¶
Bases:
pydantic.BaseModelRepresents the validation of a document against a policy configuration.
A DocumentPolicyValidation tracks the complete lifecycle of validating a document against policy criteria. It includes:
Initial validation: Document is scored against policy validation queries
Optional transformation: If policy includes transformation queries and initial validation fails, transformations are applied
Re-validation: Transformed document is re-scored against policy criteria
Final determination: Pass/fail based on final validation scores
The validation process supports both validation-only policies and policies that include transformations for document quality improvement.
- completed_at: datetime.datetime | None = None¶
- error_message: str | None = None¶
- input_document_id: str = None¶
- passed: bool | None = None¶
- policy_id: str = None¶
- post_transform_validation_scores: list[tuple[str, int]] | None = None¶
- started_at: datetime.datetime | None = None¶
- status: DocumentPolicyValidationStatus¶
- transformed_document_id: str | None = None¶
- validation_id: str = None¶
- validation_scores: list[tuple[str, int]] = None¶
- class julee.domain.models.DocumentStatus[source]¶
Bases:
str,enum.EnumStatus of a document through the Capture, Extract, Assemble, Publish pipeline.
- ASSEMBLED = 'assembled'¶
- ASSEMBLY_SPECIFICATION_IDENTIFIED = 'assembly_specification_identified'¶
- CAPTURED = 'captured'¶
- EXTRACTED = 'extracted'¶
- FAILED = 'failed'¶
- PUBLISHED = 'published'¶
- REGISTERED = 'registered'¶
- class julee.domain.models.KnowledgeServiceConfig(/, **data)[source]¶
Bases:
pydantic.BaseModelKnowledge service configuration that defines how to interact with an external knowledge/AI service.
A KnowledgeServiceConfig represents a service endpoint that can store documents and execute queries against them. This could be an AI service, vector database, search engine, or any other service that can analyze documents and answer questions about them.
- created_at: datetime.datetime | None = None¶
- description: str = None¶
- knowledge_service_id: str = None¶
- name: str = None¶
- service_api: ServiceApi = None¶
- updated_at: datetime.datetime | None = None¶
- class julee.domain.models.KnowledgeServiceQuery(/, **data)[source]¶
Bases:
pydantic.BaseModelKnowledge service query configuration for extracting specific data.
A KnowledgeServiceQuery represents a specific extraction operation that can be performed against a knowledge service. It defines which knowledge service to use and what prompt to send for data extraction.
When executed, the relevant section of the AssemblySpecification’s JSON schema will be passed along with the prompt to ensure the knowledge service response conforms to the expected structure and validation requirements.
The mapping between queries and schema sections is handled by the AssemblySpecification’s knowledge_service_queries field.
Examples of query_metadata usage:
For Anthropic services:
query_metadata = { "model": "claude-sonnet-4-5", "max_tokens": 4000, "temperature": 0.1 }
For OpenAI services:
query_metadata = { "model": "gpt-4", "temperature": 0.2, "top_p": 0.9 }
For custom services:
query_metadata = { "endpoint": "custom-model-v2", "timeout": 30, "retries": 3 }
- assistant_prompt: str | None = None¶
- created_at: datetime.datetime | None = None¶
- knowledge_service_id: str = None¶
- name: str = None¶
- prompt: str = None¶
- query_id: str = None¶
- query_metadata: dict[str, Any] | None = None¶
- updated_at: datetime.datetime | None = None¶
- class julee.domain.models.Policy(/, **data)[source]¶
Bases:
pydantic.BaseModelPolicy configuration that defines validation and transformation criteria for documents.
A Policy represents a set of quality criteria that documents must meet. It includes validation scores that are calculated using knowledge service queries, and optional transformation queries that can be applied to improve document quality before re-validation.
The policy operates in two modes:
Validation-only: Calculates scores and passes/fails based on criteria
Validation with transformation: Calculates scores, applies transformations, then re-calculates scores for final pass/fail
- created_at: datetime.datetime | None = None¶
- description: str = None¶
- property has_transformations: bool¶
Check if this policy includes transformation queries.
Returns True if transformation queries are defined and non-empty.
- property is_validation_only: bool¶
Check if this policy operates in validation-only mode.
Returns True if no transformation queries are defined or if the transformation queries list is empty.
- policy_id: str = None¶
- status: PolicyStatus¶
- title: str = None¶
- transformation_queries: list[str] | None = None¶
- updated_at: datetime.datetime | None = None¶
- validation_scores: list[tuple[str, int]] = None¶
- version: str = None¶