julee.domain.models =================== .. py:module:: julee.domain.models .. autoapi-nested-parse:: 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 ---------- .. toctree:: :maxdepth: 1 /autoapi/julee/domain/models/assembly/index /autoapi/julee/domain/models/assembly_specification/index /autoapi/julee/domain/models/custom_fields/index /autoapi/julee/domain/models/document/index /autoapi/julee/domain/models/knowledge_service_config/index /autoapi/julee/domain/models/policy/index Classes ------- .. autoapisummary:: julee.domain.models.Assembly julee.domain.models.AssemblySpecification julee.domain.models.AssemblySpecificationStatus julee.domain.models.AssemblyStatus julee.domain.models.ContentStream julee.domain.models.Document julee.domain.models.DocumentPolicyValidation julee.domain.models.DocumentStatus julee.domain.models.KnowledgeServiceConfig julee.domain.models.KnowledgeServiceQuery julee.domain.models.Policy julee.domain.models.PolicyStatus Package Contents ---------------- .. py:class:: Assembly(/, **data) Bases: :py:obj:`pydantic.BaseModel` Assembly 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. .. py:method:: assembled_document_id_must_not_be_empty_if_provided(v) :classmethod: .. py:method:: assembly_id_must_not_be_empty(v) :classmethod: .. py:method:: assembly_specification_id_must_not_be_empty(v) :classmethod: .. py:method:: input_document_id_must_not_be_empty(v) :classmethod: .. py:method:: workflow_id_must_not_be_empty(v) :classmethod: .. py:attribute:: assembled_document_id :type: Optional[str] :value: None .. py:attribute:: assembly_id :type: str :value: None .. py:attribute:: assembly_specification_id :type: str :value: None .. py:attribute:: created_at :type: Optional[datetime.datetime] :value: None .. py:attribute:: input_document_id :type: str :value: None .. py:attribute:: status :type: AssemblyStatus .. py:attribute:: updated_at :type: Optional[datetime.datetime] :value: None .. py:attribute:: workflow_id :type: str :value: None .. py:class:: AssemblySpecification(/, **data) Bases: :py:obj:`pydantic.BaseModel` Assembly 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. .. py:method:: applicability_must_not_be_empty(v) :classmethod: .. py:method:: assembly_specification_id_must_not_be_empty(v) :classmethod: .. py:method:: jsonschema_must_be_valid(v) :classmethod: .. py:method:: knowledge_service_queries_must_be_valid(v, info) :classmethod: .. py:method:: name_must_not_be_empty(v) :classmethod: .. py:method:: version_must_not_be_empty(v) :classmethod: .. py:attribute:: applicability :type: str :value: None .. py:attribute:: assembly_specification_id :type: str :value: None .. py:attribute:: created_at :type: Optional[datetime.datetime] :value: None .. py:attribute:: jsonschema :type: Dict[str, Any] :value: None .. py:attribute:: knowledge_service_queries :type: Dict[str, str] :value: None .. py:attribute:: name :type: str :value: None .. py:attribute:: status :type: AssemblySpecificationStatus .. py:attribute:: updated_at :type: Optional[datetime.datetime] :value: None .. py:attribute:: version :type: str :value: None .. py:class:: AssemblySpecificationStatus Bases: :py:obj:`str`, :py:obj:`enum.Enum` Status of an assembly specification configuration. .. py:attribute:: ACTIVE :value: 'active' .. py:attribute:: DEPRECATED :value: 'deprecated' .. py:attribute:: DRAFT :value: 'draft' .. py:attribute:: INACTIVE :value: 'inactive' .. py:class:: AssemblyStatus Bases: :py:obj:`str`, :py:obj:`enum.Enum` Status of an assembly process. .. py:attribute:: CANCELLED :value: 'cancelled' .. py:attribute:: COMPLETED :value: 'completed' .. py:attribute:: FAILED :value: 'failed' .. py:attribute:: IN_PROGRESS :value: 'in_progress' .. py:attribute:: PENDING :value: 'pending' .. py:class:: ContentStream(stream) 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. .. py:method:: read(size = -1) Read from the underlying stream. .. py:method:: seek(offset, whence = 0) Seek in the underlying stream. .. py:method:: tell() Get current position in stream. .. py:property:: stream :type: io.IOBase Access the underlying stream. .. py:class:: Document(/, **data) Bases: :py:obj:`pydantic.BaseModel` Complete 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. .. py:method:: content_multihash_must_not_be_empty(v) :classmethod: .. py:method:: content_type_must_not_be_empty(v) :classmethod: .. py:method:: document_id_must_not_be_empty(v) :classmethod: .. py:method:: filename_must_not_be_empty(v) :classmethod: .. py:method:: validate_content_fields(info) Ensure document has either content or content_string, not both. .. py:attribute:: additional_metadata :type: Dict[str, Any] :value: None .. py:attribute:: assembly_types :type: List[str] :value: None .. py:attribute:: content :type: Optional[julee.domain.models.custom_fields.content_stream.ContentStream] :value: None .. py:attribute:: content_multihash :type: str :value: None .. py:attribute:: content_string :type: Optional[str] :value: None .. py:attribute:: content_type :type: str .. py:attribute:: created_at :type: Optional[datetime.datetime] :value: None .. py:attribute:: document_id :type: str .. py:attribute:: knowledge_service_id :type: Optional[str] :value: None .. py:attribute:: original_filename :type: str .. py:attribute:: size_bytes :type: int :value: None .. py:attribute:: status :type: DocumentStatus .. py:attribute:: updated_at :type: Optional[datetime.datetime] :value: None .. py:class:: DocumentPolicyValidation(/, **data) Bases: :py:obj:`pydantic.BaseModel` Represents the validation of a document against a policy configuration. A DocumentPolicyValidation tracks the complete lifecycle of validating a document against policy criteria. It includes: 1. Initial validation: Document is scored against policy validation queries 2. Optional transformation: If policy includes transformation queries and initial validation fails, transformations are applied 3. Re-validation: Transformed document is re-scored against policy criteria 4. 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. .. py:method:: error_message_must_be_valid(v) :classmethod: .. py:method:: input_document_id_must_not_be_empty(v) :classmethod: .. py:method:: policy_id_must_not_be_empty(v) :classmethod: .. py:method:: post_transform_scores_must_be_valid(v) :classmethod: .. py:method:: transformed_document_id_must_be_valid(v) :classmethod: .. py:method:: validation_scores_must_be_valid(v) :classmethod: .. py:attribute:: completed_at :type: Optional[datetime.datetime] :value: None .. py:attribute:: error_message :type: Optional[str] :value: None .. py:attribute:: input_document_id :type: str :value: None .. py:attribute:: passed :type: Optional[bool] :value: None .. py:attribute:: policy_id :type: str :value: None .. py:attribute:: post_transform_validation_scores :type: Optional[List[Tuple[str, int]]] :value: None .. py:attribute:: started_at :type: Optional[datetime.datetime] :value: None .. py:attribute:: status :type: DocumentPolicyValidationStatus .. py:attribute:: transformed_document_id :type: Optional[str] :value: None .. py:attribute:: validation_id :type: str :value: None .. py:attribute:: validation_scores :type: List[Tuple[str, int]] :value: None .. py:class:: DocumentStatus Bases: :py:obj:`str`, :py:obj:`enum.Enum` Status of a document through the Capture, Extract, Assemble, Publish pipeline. .. py:attribute:: ASSEMBLED :value: 'assembled' .. py:attribute:: ASSEMBLY_SPECIFICATION_IDENTIFIED :value: 'assembly_specification_identified' .. py:attribute:: CAPTURED :value: 'captured' .. py:attribute:: EXTRACTED :value: 'extracted' .. py:attribute:: FAILED :value: 'failed' .. py:attribute:: PUBLISHED :value: 'published' .. py:attribute:: REGISTERED :value: 'registered' .. py:class:: KnowledgeServiceConfig(/, **data) Bases: :py:obj:`pydantic.BaseModel` Knowledge 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. .. py:method:: description_must_not_be_empty(v) :classmethod: .. py:method:: knowledge_service_id_must_not_be_empty(v) :classmethod: .. py:method:: name_must_not_be_empty(v) :classmethod: .. py:method:: service_api_must_be_valid(v) :classmethod: .. py:attribute:: created_at :type: Optional[datetime.datetime] :value: None .. py:attribute:: description :type: str :value: None .. py:attribute:: knowledge_service_id :type: str :value: None .. py:attribute:: name :type: str :value: None .. py:attribute:: service_api :type: ServiceApi :value: None .. py:attribute:: updated_at :type: Optional[datetime.datetime] :value: None .. py:class:: KnowledgeServiceQuery(/, **data) Bases: :py:obj:`pydantic.BaseModel` Knowledge 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-20250514", "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 } .. py:method:: knowledge_service_id_must_not_be_empty(v) :classmethod: .. py:method:: name_must_not_be_empty(v) :classmethod: .. py:method:: prompt_must_not_be_empty(v) :classmethod: .. py:method:: query_id_must_not_be_empty(v) :classmethod: .. py:attribute:: assistant_prompt :type: Optional[str] :value: None .. py:attribute:: created_at :type: Optional[datetime.datetime] :value: None .. py:attribute:: knowledge_service_id :type: str :value: None .. py:attribute:: name :type: str :value: None .. py:attribute:: prompt :type: str :value: None .. py:attribute:: query_id :type: str :value: None .. py:attribute:: query_metadata :type: Optional[Dict[str, Any]] :value: None .. py:attribute:: updated_at :type: Optional[datetime.datetime] :value: None .. py:class:: Policy(/, **data) Bases: :py:obj:`pydantic.BaseModel` Policy 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: 1. Validation-only: Calculates scores and passes/fails based on criteria 2. Validation with transformation: Calculates scores, applies transformations, then re-calculates scores for final pass/fail .. py:method:: description_must_not_be_empty(v) :classmethod: .. py:method:: policy_id_must_not_be_empty(v) :classmethod: .. py:method:: title_must_not_be_empty(v) :classmethod: .. py:method:: transformation_queries_must_be_valid(v) :classmethod: .. py:method:: validation_scores_must_be_valid(v) :classmethod: .. py:method:: version_must_not_be_empty(v) :classmethod: .. py:attribute:: created_at :type: Optional[datetime.datetime] :value: None .. py:attribute:: description :type: str :value: None .. py:property:: has_transformations :type: bool Check if this policy includes transformation queries. Returns True if transformation queries are defined and non-empty. .. py:property:: is_validation_only :type: 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. .. py:attribute:: policy_id :type: str :value: None .. py:attribute:: status :type: PolicyStatus .. py:attribute:: title :type: str :value: None .. py:attribute:: transformation_queries :type: Optional[List[str]] :value: None .. py:attribute:: updated_at :type: Optional[datetime.datetime] :value: None .. py:attribute:: validation_scores :type: List[Tuple[str, int]] :value: None .. py:attribute:: version :type: str :value: None .. py:class:: PolicyStatus Bases: :py:obj:`str`, :py:obj:`enum.Enum` Status of a policy configuration. .. py:attribute:: ACTIVE :value: 'active' .. py:attribute:: DEPRECATED :value: 'deprecated' .. py:attribute:: DRAFT :value: 'draft' .. py:attribute:: INACTIVE :value: 'inactive'