Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

refactor/rename domain in domain_code (#532)

Thomas Hebrard39e740912c57
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 901d42f53..e0661cd4b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -83,6 +83,7 @@
- `ConceptFactory.make_from_blueprint` method now correctly handles native concepts
- The output (and inputs) of a pipe is now a `StuffSpec` object instead, that holds the concept and the multiplicity.
+- Renamed `domain` into `domain_code` when relevant.
## [v0.17.3] - 2025-12-01
diff --git a/docs/home/6-build-reliable-ai-workflows/domain.md b/docs/home/6-build-reliable-ai-workflows/domain.md
index d2b1486c7..18ba8250d 100644
--- a/docs/home/6-build-reliable-ai-workflows/domain.md
+++ b/docs/home/6-build-reliable-ai-workflows/domain.md
@@ -143,8 +143,8 @@ Always use the full identifier when referencing concepts in code:
```python
from pipelex.core.stuffs.stuff_factory import StuffFactory
-invoice_stuff = StuffFactory.make_from_concept_string(
- concept_string="finance.Invoice", # domain_code.ConceptName
+invoice_stuff = StuffFactory.make_from_concept_ref(
+ concept_ref="finance.Invoice", # domain_code.ConceptName
name="invoice_123",
content=invoice_data
)
diff --git a/docs/home/6-build-reliable-ai-workflows/pipelex-bundle-specification.md b/docs/home/6-build-reliable-ai-workflows/pipelex-bundle-specification.md
index f57263f18..4cbe5115f 100644
--- a/docs/home/6-build-reliable-ai-workflows/pipelex-bundle-specification.md
+++ b/docs/home/6-build-reliable-ai-workflows/pipelex-bundle-specification.md
@@ -22,7 +22,7 @@ Every Pipelex bundle follows this structure:
```plx
# 1. Domain Declaration (MANDATORY)
-domain = "domain_name"
+domain = "domain_code"
description = "Description of what this domain handles"
# 2. Optional: Main Pipe Declaration
@@ -119,13 +119,13 @@ LineItem = "An individual item or service listed in an invoice"
**Concept Naming:**
-Within a bundle, you reference concepts by their simple name (`Invoice`). However, their **full identifier** includes the domain:
+Within a bundle, you reference concepts by their simple name (`Invoice`). However, their **full identifier** includes the domain code:
```
-domain_name.ConceptName
+domain_code.ConceptName
```
-For example, if your domain is `invoice_processing`, the concept `Invoice` has the full identifier:
+For example, if your domain_code is `invoice_processing`, the concept `Invoice` has the full identifier:
```
invoice_processing.Invoice
@@ -146,13 +146,13 @@ output = "Page"
```
See more about designing pipes in [Designing Pipelines](./pipes/index.md).
-## Referencing Concepts: When to Use Domain Prefixes
+## Referencing Concepts: When to Use Domain code prefixes
-Understanding when to use domain prefixes is crucial for writing clean, maintainable bundles.
+Understanding when to use domain code prefixes is crucial for writing clean, maintainable bundles.
### Same-Bundle References (No Prefix Needed)
-When a pipe in a bundle references a concept **defined in the same bundle**, you don't need the domain prefix:
+When a pipe in a bundle references a concept **defined in the same bundle**, you don't need the domain code prefix:
```plx
domain = "invoice_processing"
@@ -173,7 +173,7 @@ This is the most common case and keeps your code clean.
### Cross-Bundle References (Prefix Required)
-When a pipe references a concept **from another bundle/domain**, you must use the full domain prefix:
+When a pipe references a concept **from another bundle/domain**, you must use the full domain code prefix:
```plx
domain = "accounting"
diff --git a/docs/home/6-build-reliable-ai-workflows/pipes/provide-inputs.md b/docs/home/6-build-reliable-ai-workflows/pipes/provide-inputs.md
index bbc55eaf1..6bf2c2ee7 100644
--- a/docs/home/6-build-reliable-ai-workflows/pipes/provide-inputs.md
+++ b/docs/home/6-build-reliable-ai-workflows/pipes/provide-inputs.md
@@ -128,7 +128,7 @@ inputs = {
**Concept Resolution:**
- The system searches all available domains for a concept matching the class name
-- If multiple concepts with the same name exist in different domains → **Error**: Must specify domain
+- If multiple concepts with the same name exist in different domains → **Error**: Must specify domain code
- If no concept is found → **Error**
### 1.4: List of StuffContent Objects
@@ -272,15 +272,15 @@ inputs = {
}
```
-**Concept Resolution with Search Domains:**
+**Concept Resolution with Search Domain Codes:**
-When you specify a concept name without a domain prefix:
+When you specify a concept name without a domain code prefix:
- ✅ If the concept exists in only one domain → Automatically found
-- ❌ If the concept exists in multiple domains → **Error**: "Multiple concepts found. Please specify domain as 'domain.Concept'"
+- ❌ If the concept exists in multiple domains → **Error**: "Multiple concepts found. Please specify domain code as 'domain_code.Concept'"
- ❌ If the concept doesn't exist → **Error**: "Concept not found"
-**Using Domain Prefix:**
+**Using Domain code prefix:**
```json
{
@@ -339,7 +339,7 @@ Provide structured data as a dictionary:
The system will:
-1. Find the concept structure (with domain resolution as explained above)
+1. Find the concept structure (with domain code resolution as explained above)
2. Validate the dictionary against the concept's structure
3. Create the appropriate content object
@@ -431,7 +431,7 @@ When you reference a concept by name (like `"Invoice"` or `"PersonInfo"`), Pipel
### Explicit Domain Specification
-To avoid ambiguity, specify the domain explicitly:
+To avoid ambiguity, specify the domain code explicitly:
```json
{
@@ -439,7 +439,7 @@ To avoid ambiguity, specify the domain explicitly:
}
```
-**Format:** `"domain_name.ConceptName"`
+**Format:** `"domain_code.ConceptName"`
This tells Pipelex exactly which concept to use, bypassing the search.
@@ -618,7 +618,7 @@ inputs = {
### Error: "Ambiguous concept"
-When a concept name exists in multiple domains, specify the domain:
+When a concept name exists in multiple domains, specify the domain code:
```python
# ❌ Ambiguous if "Invoice" exists in multiple domains
@@ -629,7 +629,7 @@ inputs = {
}
}
-# ✅ Specify the domain
+# ✅ Specify the domain code
inputs = {
"invoice": {
"concept": "accounting.Invoice",
diff --git a/docs/home/7-configuration/config-technical/library-config.md b/docs/home/7-configuration/config-technical/library-config.md
index d11641427..de2ac8f28 100644
--- a/docs/home/7-configuration/config-technical/library-config.md
+++ b/docs/home/7-configuration/config-technical/library-config.md
@@ -214,7 +214,7 @@ pipelex show pipe YOUR_PIPE_CODE
### 1. Organization
- Keep related concepts and pipes in the same `.plx` file
-- Use meaningful domain names that reflect functionality
+- Use meaningful domain codes that reflect functionality
- Match Python file names with PLX file names (`finance.plx` → `finance.py`)
- Group complex pipelines using subdirectories
@@ -238,7 +238,7 @@ pipelex show pipe YOUR_PIPE_CODE
### 4. Validation
- Run `pipelex validate all` after making changes
-- Check for domain consistency
+- Check for domain code consistency
- Verify concept relationships
- Test pipes individually before composing them
diff --git a/docs/home/9-tools/cli/run.md b/docs/home/9-tools/cli/run.md
index c68610ce4..26a404137 100644
--- a/docs/home/9-tools/cli/run.md
+++ b/docs/home/9-tools/cli/run.md
@@ -53,7 +53,7 @@ The input JSON file should contain a dictionary where keys are input variable na
{
"input_variable": "simple string value",
"another_input": {
- "concept": "domain.ConceptName",
+ "concept": "domain_code.ConceptName",
"content": { "field": "value" }
}
}
diff --git a/pipelex/builder/builder.py b/pipelex/builder/builder.py
index 8e196988f..ee97ddc26 100644
--- a/pipelex/builder/builder.py
+++ b/pipelex/builder/builder.py
@@ -109,7 +109,7 @@ def assemble_pipelex_bundle_spec(working_memory: WorkingMemory) -> PipelexBundle
raise PipeBuilderError(msg) from exc
return PipelexBundleSpec(
- domain=bundle_header_spec.domain,
+ domain=bundle_header_spec.domain_code,
description=bundle_header_spec.description,
system_prompt=bundle_header_spec.system_prompt,
main_pipe=bundle_header_spec.main_pipe,
diff --git a/pipelex/builder/bundle_header_spec.py b/pipelex/builder/bundle_header_spec.py
index 92c391eb0..6c243d2ab 100644
--- a/pipelex/builder/bundle_header_spec.py
+++ b/pipelex/builder/bundle_header_spec.py
@@ -8,7 +8,7 @@ from pipelex.tools.misc.pretty import PrettyPrintable
class BundleHeaderSpec(StructuredContent):
- domain: str = Field(description="Name of the domain of the knowledge work.")
+ domain_code: str = Field(description="Name of the domain of the knowledge work.")
description: str = Field(description="Definition of the domain of the knowledge work.")
system_prompt: str | None = Field(description="System prompt for the domain.")
main_pipe: str = Field(description="The main pipe of the domain.")
@@ -18,7 +18,7 @@ class BundleHeaderSpec(StructuredContent):
bundle_group = Group()
if title:
bundle_group.renderables.append(Text(title, style="bold"))
- bundle_group.renderables.append(Text.from_markup(f"Domain: [yellow]{self.domain}[/yellow]\n", style="bold"))
+ bundle_group.renderables.append(Text.from_markup(f"Domain: [yellow]{self.domain_code}[/yellow]\n", style="bold"))
bundle_group.renderables.append(Text.from_markup(f"Description: [yellow italic]{self.description}[/yellow italic]\n"))
bundle_group.renderables.append(Text.from_markup(f"Main Pipe: [red]{self.main_pipe}[/red]\n"))
if self.system_prompt:
diff --git a/pipelex/builder/bundle_spec.py b/pipelex/builder/bundle_spec.py
index 5c983f2e2..43e30c3cd 100644
--- a/pipelex/builder/bundle_spec.py
+++ b/pipelex/builder/bundle_spec.py
@@ -60,13 +60,13 @@ class PipelexBundleSpec(StructuredContent):
@field_validator("domain", mode="before")
@classmethod
- def validate_domain_syntax(cls, domain: str) -> str:
+ def validate_domain_syntax(cls, domain_code: str) -> str:
try:
- validate_domain_code(code=domain)
+ validate_domain_code(code=domain_code)
except DomainCodeError as exc:
- msg = f"Error when trying to validate pipelex bundle spec: domain '{domain}' is not a valid domain code: {exc}"
+ msg = f"Error when trying to validate pipelex bundle spec: domain '{domain_code}' is not a valid domain code: {exc}"
raise ValueError(msg) from exc
- return domain
+ return domain_code
@model_validator(mode="after")
def validate_main_pipe(self) -> "PipelexBundleSpec":
diff --git a/pipelex/builder/concept/concept_spec.py b/pipelex/builder/concept/concept_spec.py
index 0ebfb827e..d63fdd806 100644
--- a/pipelex/builder/concept/concept_spec.py
+++ b/pipelex/builder/concept/concept_spec.py
@@ -180,7 +180,7 @@ class ConceptSpec(StructuredContent):
@classmethod
def validate_refines(cls, refines: str | None = None) -> str | None:
if refines is not None:
- if not NativeConceptCode.get_validated_native_concept_string(concept_string_or_code=refines):
+ if not NativeConceptCode.get_validated_native_concept_ref(concept_ref_or_code=refines):
msg = f"Forbidden to refine a non-native concept: '{refines}'. Refining non-native concepts will come soon."
raise ValueError(msg)
return refines
diff --git a/pipelex/builder/flow.py b/pipelex/builder/flow.py
index 1cccb94ab..ae1bd22ae 100644
--- a/pipelex/builder/flow.py
+++ b/pipelex/builder/flow.py
@@ -49,6 +49,6 @@ class Flow(StructuredContent):
model_config = ConfigDict(extra="forbid")
- domain: str
+ domain_code: str
description: str | None = None
flow_elements: dict[str, FlowElement] = Field(default_factory=dict)
diff --git a/pipelex/builder/flow_factory.py b/pipelex/builder/flow_factory.py
index 7fb16a37f..40d024559 100644
--- a/pipelex/builder/flow_factory.py
+++ b/pipelex/builder/flow_factory.py
@@ -76,7 +76,7 @@ class FlowFactory:
)
log.verbose(signature_from_blueprint, title="Signature from blueprint")
return Flow(
- domain=bundle_blueprint.domain,
+ domain_code=bundle_blueprint.domain,
description=bundle_blueprint.description,
flow_elements=flow_elements,
)
diff --git a/pipelex/builder/pipe/pipe_parallel_spec.py b/pipelex/builder/pipe/pipe_parallel_spec.py
index 235b541fd..0cd71f188 100644
--- a/pipelex/builder/pipe/pipe_parallel_spec.py
+++ b/pipelex/builder/pipe/pipe_parallel_spec.py
@@ -8,7 +8,7 @@ from typing_extensions import override
from pipelex.builder.pipe.pipe_spec import PipeSpec
from pipelex.builder.pipe.sub_pipe_spec import SubPipeSpec
-from pipelex.core.concepts.validation import validate_concept_string_or_code
+from pipelex.core.concepts.validation import validate_concept_ref_or_code
from pipelex.pipe_controllers.parallel.pipe_parallel_blueprint import PipeParallelBlueprint
from pipelex.tools.misc.pretty import PrettyPrintable
from pipelex.types import Self
@@ -39,7 +39,7 @@ class PipeParallelSpec(PipeSpec):
@classmethod
def validate_combined_output(cls, combined_output: str) -> str:
if combined_output:
- validate_concept_string_or_code(concept_string_or_code=combined_output)
+ validate_concept_ref_or_code(concept_ref_or_code=combined_output)
return combined_output
@model_validator(mode="after")
diff --git a/pipelex/builder/pipe/pipe_spec.py b/pipelex/builder/pipe/pipe_spec.py
index 70787256f..3da0ffbcd 100644
--- a/pipelex/builder/pipe/pipe_spec.py
+++ b/pipelex/builder/pipe/pipe_spec.py
@@ -8,7 +8,7 @@ from rich.text import Text
from typing_extensions import override
from pipelex import log
-from pipelex.core.concepts.validation import validate_concept_string_or_code
+from pipelex.core.concepts.validation import validate_concept_ref_or_code
from pipelex.core.pipes.pipe_blueprint import PipeBlueprint, PipeCategory, PipeType
from pipelex.core.pipes.variable_multiplicity import MUTLIPLICITY_PATTERN, parse_concept_with_multiplicity
from pipelex.core.stuffs.structured_content import StructuredContent
@@ -79,7 +79,7 @@ class PipeSpec(StructuredContent):
def validate_output(cls, output: str) -> str:
# Extract concept without multiplicity for validation
parse_result = parse_concept_with_multiplicity(output)
- validate_concept_string_or_code(concept_string_or_code=parse_result.concept)
+ validate_concept_ref_or_code(concept_ref_or_code=parse_result.concept)
return output # Return original with brackets intact
@field_validator("inputs", mode="after")
@@ -104,8 +104,8 @@ class PipeSpec(StructuredContent):
raise ValueError(msg)
# Extract the concept part (without multiplicity) and validate it
- concept_string_or_code = match.group(1)
- validate_concept_string_or_code(concept_string_or_code=concept_string_or_code)
+ concept_ref_or_code = match.group(1)
+ validate_concept_ref_or_code(concept_ref_or_code=concept_ref_or_code)
return inputs
diff --git a/pipelex/builder/runner_code.py b/pipelex/builder/runner_code.py
index eb7d49cc0..8b9390f27 100644
--- a/pipelex/builder/runner_code.py
+++ b/pipelex/builder/runner_code.py
@@ -27,13 +27,13 @@ class CustomClassInfo:
"""Information about a custom structure class for import generation."""
class_name: str
- domain: str
+ domain_code: str
concept_code: str
@property
def module_name(self) -> str:
"""Get the module name (filename without .py) for this class."""
- return f"{self.domain}_{self.concept_code}"
+ return f"{self.domain_code}_{self.concept_code}"
@property
def import_statement(self) -> str:
@@ -106,14 +106,14 @@ def _collect_concept_info(concept: Concept) -> CustomClassInfo | None:
Returns:
CustomClassInfo if it's a custom concept, None if native
"""
- if SpecialDomain.is_native(concept.domain):
+ if SpecialDomain.is_native(concept.domain_code):
return None
# For custom concepts, use the concept code as the class name
# The structure class name should match the concept code
return CustomClassInfo(
class_name=concept.structure_class_name,
- domain=concept.domain,
+ domain_code=concept.domain_code,
concept_code=concept.code,
)
@@ -136,7 +136,7 @@ def _collect_imports_for_inputs(inputs: InputStuffSpecs) -> tuple[set[str], dict
# Get imports from the representation generator
generator = ConceptRepresentationGenerator(ConceptRepresentationFormat.PYTHON)
- generator.generate_representation(concept.concept_string, structure_class)
+ generator.generate_representation(concept.concept_ref, structure_class)
for class_name in generator.imports_needed:
if NativeConceptCode.is_native_structure_class(class_name):
diff --git a/pipelex/cli/error_handlers.py b/pipelex/cli/error_handlers.py
index b4c66ba14..ef807be0e 100644
--- a/pipelex/cli/error_handlers.py
+++ b/pipelex/cli/error_handlers.py
@@ -144,8 +144,8 @@ def handle_validate_bundle_error(exc: ValidateBundleError, bundle_path: str | No
console.print(f" [cyan]Pipe:[/cyan] [yellow]{pipe_error.pipe_code}[/yellow]")
if pipe_error.concept_code:
console.print(f" [cyan]Concept:[/cyan] [yellow]{pipe_error.concept_code}[/yellow]")
- if pipe_error.domain:
- console.print(f" [cyan]Domain:[/cyan] [green]{pipe_error.domain}[/green]")
+ if pipe_error.domain_code:
+ console.print(f" [cyan]Domain:[/cyan] [green]{pipe_error.domain_code}[/green]")
# Field name if present
if pipe_error.field_name:
diff --git a/pipelex/client/pipeline_response_factory.py b/pipelex/client/pipeline_response_factory.py
index 7215184cf..a8c8174e3 100644
--- a/pipelex/client/pipeline_response_factory.py
+++ b/pipelex/client/pipeline_response_factory.py
@@ -26,7 +26,7 @@ class PipelineResponseFactory:
# Convert each Stuff → DictStuff by dumping only the content
for stuff_name, stuff in working_memory.root.items():
dict_stuff = DictStuff(
- concept=stuff.concept.concept_string,
+ concept=stuff.concept.concept_ref,
content=stuff.content.model_dump(serialize_as_any=True),
)
dict_stuffs_root[stuff_name] = dict_stuff
diff --git a/pipelex/core/bundles/pipelex_bundle_blueprint.py b/pipelex/core/bundles/pipelex_bundle_blueprint.py
index b35e3b735..c77281170 100644
--- a/pipelex/core/bundles/pipelex_bundle_blueprint.py
+++ b/pipelex/core/bundles/pipelex_bundle_blueprint.py
@@ -47,13 +47,13 @@ class PipelexBundleBlueprint(BaseModel):
@field_validator("domain", mode="before")
@classmethod
- def validate_domain_syntax(cls, domain: str) -> str:
+ def validate_domain_syntax(cls, domain_code: str) -> str:
try:
- validate_domain_code(code=domain)
+ validate_domain_code(code=domain_code)
except DomainCodeError as exc:
- msg = f"Error when trying to validate the pipelex bundle at domain '{domain}': {exc}"
+ msg = f"Error when trying to validate the pipelex bundle at domain '{domain_code}': {exc}"
raise ValueError(msg) from exc
- return domain
+ return domain_code
@field_validator("concept", mode="before")
@classmethod
diff --git a/pipelex/core/concepts/concept.py b/pipelex/core/concepts/concept.py
index 5d6143263..21ee5eda6 100644
--- a/pipelex/core/concepts/concept.py
+++ b/pipelex/core/concepts/concept.py
@@ -25,7 +25,7 @@ class Concept(BaseModel):
model_config = ConfigDict(extra="forbid", strict=True)
code: str
- domain: str
+ domain_code: str
description: str
structure_class_name: str
# TODO: rethink this refines field here.
@@ -37,41 +37,41 @@ class Concept(BaseModel):
try:
validate_concept_code(concept_code=code)
except ConceptCodeError as exc:
- msg = f"Concept code '{code}' is not a valid concept code for concept '{cls.concept_string}'"
+ msg = f"Concept code '{code}' is not a valid concept code for concept '{cls.concept_ref}'"
raise ConceptValueError(msg) from exc
return code
- @field_validator("domain")
+ @field_validator("domain_code")
@classmethod
- def validate_domain(cls, domain: str) -> str:
+ def validate_domain(cls, domain_code: str) -> str:
try:
- validate_domain_code(code=domain)
+ validate_domain_code(code=domain_code)
except DomainCodeError as exc:
- msg = f"Domain code '{domain}' is not a valid domain code for concept '{cls.concept_string}'"
+ msg = f"Domain code '{domain_code}' is not a valid domain code for concept '{cls.concept_ref}'"
raise ConceptValueError(msg) from exc
- return domain
+ return domain_code
@field_validator("refines", mode="before")
@classmethod
def validate_refines(cls, refines: str | None) -> str | None:
if refines is None:
return None
- if not NativeConceptCode.is_valid_native_concept_string(concept_string=refines):
- valid_native_concepts = ", ".join(native.concept_string for native in NativeConceptCode.values_list())
+ if not NativeConceptCode.is_valid_native_concept_ref(concept_ref=refines):
+ valid_native_concepts = ", ".join(native.concept_ref for native in NativeConceptCode.values_list())
msg = f"Refines '{refines}' is not a valid native concept string. Valid options are: {valid_native_concepts}"
raise ConceptValueError(msg)
return refines
@property
- def concept_string(self) -> str:
- return f"{self.domain}.{self.code}"
+ def concept_ref(self) -> str:
+ return f"{self.domain_code}.{self.code}"
@property
- def simple_concept_string(self) -> str:
- if SpecialDomain.is_native(domain=self.domain):
+ def simple_concept_ref(self) -> str:
+ if SpecialDomain.is_native(domain_code=self.domain_code):
return self.code
else:
- return self.concept_string
+ return self.concept_ref
@classmethod
def sentence_from_concept(cls, concept: "Concept") -> str:
@@ -79,7 +79,7 @@ class Concept(BaseModel):
@classmethod
def is_native_concept(cls, concept: "Concept") -> bool:
- return NativeConceptCode.is_native_concept_string_or_code(concept_string_or_code=concept.concept_string)
+ return NativeConceptCode.is_native_concept_ref_or_code(concept_ref_or_code=concept.concept_ref)
@classmethod
def are_concept_compatible(cls, concept_1: "Concept", concept_2: "Concept", strict: bool = False) -> bool:
@@ -87,13 +87,13 @@ class Concept(BaseModel):
return True
if NativeConceptCode.is_dynamic_concept(concept_code=concept_2.code):
return True
- if concept_1.concept_string == concept_2.concept_string:
+ if concept_1.concept_ref == concept_2.concept_ref:
return True
if concept_1.structure_class_name == concept_2.structure_class_name:
return True
# If concept_1 refines concept_2 by string, they are strictly compatible
- if concept_1.refines is not None and concept_1.refines == concept_2.concept_string:
+ if concept_1.refines is not None and concept_1.refines == concept_2.concept_ref:
return True
# If both concepts refine the same concept, they are compatible
@@ -180,7 +180,7 @@ class Concept(BaseModel):
generator = ConceptRepresentationGenerator(output_format)
# For inputs, we only want required fields (not optional ones)
- result = generator.generate_representation(self.concept_string, structure_class, include_optional=False)
+ result = generator.generate_representation(self.concept_ref, structure_class, include_optional=False)
# If multiple and JSON format, wrap content in a list
# For Python format, the caller handles wrapping since content is a string
diff --git a/pipelex/core/concepts/concept_blueprint.py b/pipelex/core/concepts/concept_blueprint.py
index f2753b6f9..e38bda0fc 100644
--- a/pipelex/core/concepts/concept_blueprint.py
+++ b/pipelex/core/concepts/concept_blueprint.py
@@ -24,7 +24,7 @@ class ConceptBlueprint(BaseModel):
def validate_refines(cls, refines: str | None = None) -> str | None:
if refines is not None:
try:
- NativeConceptCode.validate_native_concept_string_or_code(concept_string_or_code=refines)
+ NativeConceptCode.validate_native_concept_ref_or_code(concept_ref_or_code=refines)
except NativeConceptDefinitionError as exc:
msg = f"Could not validate refine '{refines}': {exc}"
raise ValueError(msg) from exc
diff --git a/pipelex/core/concepts/concept_factory.py b/pipelex/core/concepts/concept_factory.py
index 521c9e1af..bcf00b1e7 100644
--- a/pipelex/core/concepts/concept_factory.py
+++ b/pipelex/core/concepts/concept_factory.py
@@ -14,7 +14,7 @@ from pipelex.core.concepts.helpers import normalize_structure_blueprint
from pipelex.core.concepts.native.concept_native import NativeConceptCode
from pipelex.core.concepts.structure_generation.exceptions import ConceptStructureGeneratorError
from pipelex.core.concepts.structure_generation.generator import StructureGenerator
-from pipelex.core.concepts.validation import validate_concept_string_or_code
+from pipelex.core.concepts.validation import validate_concept_ref_or_code
from pipelex.core.domains.domain import SpecialDomain
from pipelex.core.stuffs.text_content import TextContent
from pipelex.types import StrEnum
@@ -65,16 +65,16 @@ class ConceptDeclarationType(StrEnum):
class DomainAndConceptCode(BaseModel):
"""Small model to represent domain and concept code pair."""
- domain: str
+ domain_code: str
concept_code: str
class ConceptFactory:
@classmethod
- def make(cls, concept_code: str, domain: str, description: str, structure_class_name: str, refines: str | None = None) -> Concept:
+ def make(cls, concept_code: str, domain_code: str, description: str, structure_class_name: str, refines: str | None = None) -> Concept:
return Concept(
code=concept_code,
- domain=domain,
+ domain_code=domain_code,
description=description,
structure_class_name=structure_class_name,
refines=refines,
@@ -87,115 +87,115 @@ class ConceptFactory:
case NativeConceptCode.DYNAMIC:
return Concept(
code=native_concept_code,
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="A dynamic concept",
structure_class_name=structure_class_name,
)
case NativeConceptCode.TEXT:
return Concept(
code=native_concept_code,
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="A text",
structure_class_name=structure_class_name,
)
case NativeConceptCode.IMAGE:
return Concept(
code=native_concept_code,
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="An image",
structure_class_name=structure_class_name,
)
case NativeConceptCode.PDF:
return Concept(
code=native_concept_code,
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="A PDF",
structure_class_name=structure_class_name,
)
case NativeConceptCode.TEXT_AND_IMAGES:
return Concept(
code=native_concept_code,
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="A text and an image",
structure_class_name=structure_class_name,
)
case NativeConceptCode.NUMBER:
return Concept(
code=native_concept_code,
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="A number",
structure_class_name=structure_class_name,
)
case NativeConceptCode.IMG_GEN_PROMPT:
return Concept(
code=native_concept_code,
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="A prompt for an image generator",
structure_class_name=NativeConceptCode.TEXT.structure_class_name,
)
case NativeConceptCode.PAGE:
return Concept(
code=native_concept_code,
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="The content of a page of a document, comprising text and linked images and an optional page view image",
structure_class_name=structure_class_name,
)
case NativeConceptCode.ANYTHING:
return Concept(
code=native_concept_code,
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="Anything",
structure_class_name=structure_class_name,
)
case NativeConceptCode.JSON:
return Concept(
code=native_concept_code,
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="A JSON object",
structure_class_name=structure_class_name,
)
@classmethod
- def make_domain_and_concept_code_from_concept_string_or_code(
+ def make_domain_and_concept_code_from_concept_ref_or_code(
cls,
- concept_string_or_code: str,
- domain: str | None = None,
+ concept_ref_or_code: str,
+ domain_code: str | None = None,
) -> DomainAndConceptCode:
- if "." not in concept_string_or_code and not domain:
- msg = f"Not enough information to make a domain and concept code from '{concept_string_or_code}'"
+ if "." not in concept_ref_or_code and not domain_code:
+ msg = f"Not enough information to make a domain and concept code from '{concept_ref_or_code}'"
raise ConceptFactoryError(msg)
try:
- validate_concept_string_or_code(concept_string_or_code=concept_string_or_code)
+ validate_concept_ref_or_code(concept_ref_or_code=concept_ref_or_code)
except ConceptStringError as exc:
- msg = f"Concept string or code '{concept_string_or_code}' is not a valid concept string or code"
+ msg = f"Concept string or code '{concept_ref_or_code}' is not a valid concept string or code"
raise ConceptFactoryError(msg) from exc
- if NativeConceptCode.is_native_concept_string_or_code(concept_string_or_code=concept_string_or_code):
- natice_concept_string = NativeConceptCode.get_validated_native_concept_string(concept_string_or_code=concept_string_or_code)
- return DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code=natice_concept_string.split(".")[1])
+ if NativeConceptCode.is_native_concept_ref_or_code(concept_ref_or_code=concept_ref_or_code):
+ natice_concept_ref = NativeConceptCode.get_validated_native_concept_ref(concept_ref_or_code=concept_ref_or_code)
+ return DomainAndConceptCode(domain_code=SpecialDomain.NATIVE, concept_code=natice_concept_ref.split(".")[1])
- if "." in concept_string_or_code:
- domain_code, concept_code = concept_string_or_code.rsplit(".")
- return DomainAndConceptCode(domain=domain_code, concept_code=concept_code)
- elif domain:
- return DomainAndConceptCode(domain=domain, concept_code=concept_string_or_code)
+ if "." in concept_ref_or_code:
+ domain_code, concept_code = concept_ref_or_code.rsplit(".")
+ return DomainAndConceptCode(domain_code=domain_code, concept_code=concept_code)
+ elif domain_code:
+ return DomainAndConceptCode(domain_code=domain_code, concept_code=concept_ref_or_code)
else:
- msg = f"Not enough information to make a domain and concept code from '{concept_string_or_code}'"
+ msg = f"Not enough information to make a domain and concept code from '{concept_ref_or_code}'"
raise ConceptFactoryError(msg)
@classmethod
- def make_concept_string_with_domain(cls, domain: str, concept_code: str) -> str:
- return f"{domain}.{concept_code}"
+ def make_concept_ref_with_domain(cls, domain_code: str, concept_code: str) -> str:
+ return f"{domain_code}.{concept_code}"
@classmethod
- def make_concept_string_with_domain_from_concept_string_or_code(cls, domain: str, concept_sring_or_code: str) -> str:
- input_domain_and_code = cls.make_domain_and_concept_code_from_concept_string_or_code(
- concept_string_or_code=concept_sring_or_code,
- domain=domain,
+ def make_concept_ref_with_domain_from_concept_ref_or_code(cls, domain_code: str, concept_sring_or_code: str) -> str:
+ input_domain_and_code = cls.make_domain_and_concept_code_from_concept_ref_or_code(
+ concept_ref_or_code=concept_sring_or_code,
+ domain_code=domain_code,
)
- return cls.make_concept_string_with_domain(
- domain=input_domain_and_code.domain,
+ return cls.make_concept_ref_with_domain(
+ domain_code=input_domain_and_code.domain_code,
concept_code=input_domain_and_code.concept_code,
)
@@ -216,14 +216,14 @@ class ConceptFactory:
ConceptFactoryError: If the refine is invalid
"""
- return NativeConceptCode.get_validated_native_concept_string(concept_string_or_code=refine)
+ return NativeConceptCode.get_validated_native_concept_ref(concept_ref_or_code=refine)
@classmethod
def _handle_structure_with_classname(
cls,
blueprint: ConceptBlueprint,
concept_code: str,
- domain: str,
+ domain_code: str,
) -> str:
"""Handle STRUCTURE_WITH_CLASSNAME declaration type.
@@ -238,7 +238,7 @@ class ConceptFactory:
raise ConceptFactoryError(msg)
if not Concept.is_valid_structure_class(structure_class_name=structure_class_name):
msg = (
- f"Structure class '{structure_class_name}' set for concept '{concept_code}' in domain '{domain}' "
+ f"Structure class '{structure_class_name}' set for concept '{concept_code}' in domain '{domain_code}' "
"is not a registered subclass of StuffContent, or was not found in the library."
)
raise ConceptFactoryError(msg)
@@ -249,7 +249,7 @@ class ConceptFactory:
cls,
blueprint: ConceptBlueprint,
concept_code: str,
- domain: str,
+ domain_code: str,
) -> str:
"""Handle BLUEPRINT_WITH_STRUCTURE declaration type.
@@ -272,7 +272,7 @@ class ConceptFactory:
structure_blueprint=normalized_structure,
)
except ConceptStructureGeneratorError as exc:
- msg = f"Error generating python code for structure class of concept '{concept_code}' in domain '{domain}': {exc}"
+ msg = f"Error generating python code for structure class of concept '{concept_code}' in domain '{domain_code}': {exc}"
raise ConceptFactoryError(msg) from exc
# Register the generated class
@@ -284,7 +284,7 @@ class ConceptFactory:
def _handle_basic_blueprint(
cls,
concept_code: str,
- domain: str,
+ domain_code: str,
) -> tuple[str, str | None]:
"""Handle BASIC_BLUEPRINT declaration type.
@@ -298,7 +298,7 @@ class ConceptFactory:
# Because native concepts have structure class names diffrent than other (with "Content")
if concept_code in NativeConceptCode.values_list():
- return NativeConceptCode.TEXT.structure_class_name, NativeConceptCode.TEXT.concept_string
+ return NativeConceptCode.TEXT.structure_class_name, NativeConceptCode.TEXT.concept_ref
try:
_, the_generated_class = StructureGenerator().generate_from_structure_blueprint(
@@ -307,19 +307,19 @@ class ConceptFactory:
base_class_name=TextContent.__name__,
)
except ConceptStructureGeneratorError as exc:
- msg = f"Error generating structure class for concept '{concept_code}' in domain '{domain}': {exc}"
+ msg = f"Error generating structure class for concept '{concept_code}' in domain '{domain_code}': {exc}"
raise ConceptFactoryError(msg) from exc
# Register the generated class
KajsonManager.get_class_registry().register_class(the_generated_class)
- return concept_code, NativeConceptCode.TEXT.concept_string
+ return concept_code, NativeConceptCode.TEXT.concept_ref
@classmethod
def _handle_refines(
cls,
blueprint: ConceptBlueprint,
concept_code: str,
- domain: str,
+ domain_code: str,
) -> tuple[str, str]:
"""Handle REFINES declaration type.
@@ -336,7 +336,7 @@ class ConceptFactory:
try:
current_refine = cls.make_refine(refine=blueprint.refines)
except ConceptRefineError as exc:
- msg = f"Could not validate refine '{blueprint.refines}' for concept '{concept_code}' in domain '{domain}': {exc}"
+ msg = f"Could not validate refine '{blueprint.refines}' for concept '{concept_code}' in domain '{domain_code}': {exc}"
raise ConceptFactoryError(msg) from exc
# Get the refined concept's structure class name
@@ -352,7 +352,8 @@ class ConceptFactory:
)
except ConceptStructureGeneratorError as exc:
msg = (
- f"Error generating structure class for concept '{concept_code}' refining '{refined_structure_class_name}' in domain '{domain}': {exc}"
+ f"Error generating structure class for concept '{concept_code}' refining '{refined_structure_class_name}' "
+ f"in domain '{domain_code}': {exc}"
)
raise ConceptFactoryError(msg) from exc
@@ -364,7 +365,7 @@ class ConceptFactory:
@classmethod
def make_from_blueprint(
cls,
- domain: str,
+ domain_code: str,
concept_code: str,
blueprint_or_string_description: ConceptBlueprint | str,
) -> Concept:
@@ -382,19 +383,19 @@ class ConceptFactory:
else:
declaration_type = ConceptDeclarationType.BASIC_BLUEPRINT
- domain_and_concept_code = cls.make_domain_and_concept_code_from_concept_string_or_code(
- concept_string_or_code=concept_code,
- domain=domain,
+ domain_and_concept_code = cls.make_domain_and_concept_code_from_concept_ref_or_code(
+ concept_ref_or_code=concept_code,
+ domain_code=domain_code,
)
match declaration_type:
case ConceptDeclarationType.STRING:
structure_class_name, _ = cls._handle_basic_blueprint(
concept_code=concept_code,
- domain=domain,
+ domain_code=domain_code,
)
return Concept(
- domain=domain_and_concept_code.domain,
+ domain_code=domain_and_concept_code.domain_code,
code=domain_and_concept_code.concept_code,
description=cast("str", blueprint_or_string_description),
structure_class_name=structure_class_name,
@@ -403,10 +404,10 @@ class ConceptFactory:
case ConceptDeclarationType.BASIC_BLUEPRINT:
structure_class_name, refines = cls._handle_basic_blueprint(
concept_code=concept_code,
- domain=domain,
+ domain_code=domain_code,
)
return Concept(
- domain=domain_and_concept_code.domain,
+ domain_code=domain_and_concept_code.domain_code,
code=domain_and_concept_code.concept_code,
description=cast("ConceptBlueprint", blueprint_or_string_description).description,
structure_class_name=structure_class_name,
@@ -416,13 +417,13 @@ class ConceptFactory:
case ConceptDeclarationType.STRUCTURE_WITH_CLASSNAME:
blueprint = cast("ConceptBlueprint", blueprint_or_string_description)
return Concept(
- domain=domain_and_concept_code.domain,
+ domain_code=domain_and_concept_code.domain_code,
code=domain_and_concept_code.concept_code,
description=blueprint.description,
structure_class_name=cls._handle_structure_with_classname(
blueprint=blueprint,
concept_code=concept_code,
- domain=domain,
+ domain_code=domain_code,
),
refines=None,
)
@@ -430,13 +431,13 @@ class ConceptFactory:
case ConceptDeclarationType.BLUEPRINT_WITH_STRUCTURE:
blueprint = cast("ConceptBlueprint", blueprint_or_string_description)
return Concept(
- domain=domain_and_concept_code.domain,
+ domain_code=domain_and_concept_code.domain_code,
code=domain_and_concept_code.concept_code,
description=blueprint.description,
structure_class_name=cls._handle_blueprint_with_structure(
blueprint=blueprint,
concept_code=concept_code,
- domain=domain,
+ domain_code=domain_code,
),
refines=None,
)
@@ -446,10 +447,10 @@ class ConceptFactory:
structure_class_name, current_refine = cls._handle_refines(
blueprint=blueprint,
concept_code=concept_code,
- domain=domain,
+ domain_code=domain_code,
)
return Concept(
- domain=domain_and_concept_code.domain,
+ domain_code=domain_and_concept_code.domain_code,
code=domain_and_concept_code.concept_code,
description=blueprint.description,
structure_class_name=structure_class_name,
diff --git a/pipelex/core/concepts/concept_representation_generator.py b/pipelex/core/concepts/concept_representation_generator.py
index 857ec6a6e..a9493bed8 100644
--- a/pipelex/core/concepts/concept_representation_generator.py
+++ b/pipelex/core/concepts/concept_representation_generator.py
@@ -44,7 +44,7 @@ class ConceptRepresentationGenerator:
def generate_representation(
self,
- concept_string: str,
+ concept_ref: str,
structure_class: type[StuffContent],
include_optional: bool = True,
) -> dict[str, Any]:
@@ -53,7 +53,7 @@ class ConceptRepresentationGenerator:
This is the main entry point. It wraps the generated content with concept.
Args:
- concept_string: The concept string (e.g., "domain.ConceptCode")
+ concept_ref: The concept string (e.g., "domain.ConceptCode")
structure_class: The StuffContent class to generate representation for
include_optional: If False, exclude fields with default values (optional fields)
@@ -64,7 +64,7 @@ class ConceptRepresentationGenerator:
content = self.generate_class_representation(structure_class, include_optional=include_optional)
- return {"concept": concept_string, "content": content}
+ return {"concept": concept_ref, "content": content}
def generate_class_representation(
self,
@@ -345,35 +345,35 @@ class ConceptRepresentationGenerator:
def generate_json_representation(
- concept_string: str,
+ concept_ref: str,
structure_class: type[StuffContent],
) -> dict[str, Any]:
"""Convenience function to generate a JSON format representation.
Args:
- concept_string: The concept string (e.g., "domain.ConceptCode")
+ concept_ref: The concept string (e.g., "domain.ConceptCode")
structure_class: The StuffContent class
Returns:
Dict with concept and content
"""
generator = ConceptRepresentationGenerator(ConceptRepresentationFormat.JSON)
- return generator.generate_representation(concept_string, structure_class)
+ return generator.generate_representation(concept_ref, structure_class)
def generate_python_representation(
- concept_string: str,
+ concept_ref: str,
structure_class: type[StuffContent],
) -> tuple[dict[str, Any], set[str]]:
"""Convenience function to generate a Python format representation.
Args:
- concept_string: The concept string (e.g., "domain.ConceptCode")
+ concept_ref: The concept string (e.g., "domain.ConceptCode")
structure_class: The StuffContent class
Returns:
Tuple of (representation dict, imports_needed set)
"""
generator = ConceptRepresentationGenerator(ConceptRepresentationFormat.PYTHON)
- representation = generator.generate_representation(concept_string, structure_class)
+ representation = generator.generate_representation(concept_ref, structure_class)
return representation, generator.imports_needed
diff --git a/pipelex/core/concepts/helpers.py b/pipelex/core/concepts/helpers.py
index a7f48a0ef..d94aa4d6d 100644
--- a/pipelex/core/concepts/helpers.py
+++ b/pipelex/core/concepts/helpers.py
@@ -1,18 +1,18 @@
from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBlueprint, ConceptStructureBlueprintFieldType
-def strip_multiplicity_from_concept_string_or_code(concept_string_or_code: str) -> str:
+def strip_multiplicity_from_concept_ref_or_code(concept_ref_or_code: str) -> str:
"""Strip multiplicity from a concept string or code.
Args:
- concept_string_or_code: The concept string or code to strip multiplicity from
+ concept_ref_or_code: The concept string or code to strip multiplicity from
Returns:
The concept string or code without multiplicity
"""
- if "[" in concept_string_or_code:
- return concept_string_or_code.split("[", maxsplit=1)[0]
- return concept_string_or_code
+ if "[" in concept_ref_or_code:
+ return concept_ref_or_code.split("[", maxsplit=1)[0]
+ return concept_ref_or_code
def normalize_structure_blueprint(structure_dict: dict[str, str | ConceptStructureBlueprint]) -> dict[str, ConceptStructureBlueprint]:
diff --git a/pipelex/core/concepts/native/concept_native.py b/pipelex/core/concepts/native/concept_native.py
index 960af642e..b13b7c40e 100644
--- a/pipelex/core/concepts/native/concept_native.py
+++ b/pipelex/core/concepts/native/concept_native.py
@@ -1,5 +1,5 @@
from pipelex.core.concepts.native.exceptions import NativeConceptDefinitionError
-from pipelex.core.concepts.validation import is_concept_string_or_code_valid
+from pipelex.core.concepts.validation import is_concept_ref_or_code_valid
from pipelex.core.domains.domain import SpecialDomain
from pipelex.core.stuffs.dynamic_content import DynamicContent
from pipelex.core.stuffs.image_content import ImageContent
@@ -29,7 +29,7 @@ class NativeConceptCode(StrEnum):
return f"{self.value}[]"
@property
- def concept_string(self) -> str:
+ def concept_ref(self) -> str:
return f"{SpecialDomain.NATIVE}.{self.value}"
@property
@@ -149,43 +149,43 @@ class NativeConceptCode(StrEnum):
return [native_concept.structure_class_name for native_concept in cls]
@classmethod
- def is_native_concept_string_or_code(cls, concept_string_or_code: str) -> bool:
- if not is_concept_string_or_code_valid(concept_string_or_code=concept_string_or_code):
+ def is_native_concept_ref_or_code(cls, concept_ref_or_code: str) -> bool:
+ if not is_concept_ref_or_code_valid(concept_ref_or_code=concept_ref_or_code):
return False
- if "." in concept_string_or_code:
- domain_code, concept_code = concept_string_or_code.split(".", 1)
- return SpecialDomain.is_native(domain=domain_code) and concept_code in cls.values_list()
- return concept_string_or_code in cls.values_list()
+ if "." in concept_ref_or_code:
+ domain_code, concept_code = concept_ref_or_code.split(".", 1)
+ return SpecialDomain.is_native(domain_code=domain_code) and concept_code in cls.values_list()
+ return concept_ref_or_code in cls.values_list()
@classmethod
- def is_valid_native_concept_string(cls, concept_string: str) -> bool:
+ def is_valid_native_concept_ref(cls, concept_ref: str) -> bool:
"""Check if the string is a valid native concept string (e.g., native.Text, native.Image).
- Unlike is_native_concept_string_or_code, this method requires the full concept string
+ Unlike is_native_concept_ref_or_code, this method requires the full concept string
with the native domain prefix (e.g., "native.Text" is valid, but "Text" alone is not).
Args:
- concept_string: The concept string to validate
+ concept_ref: The concept string to validate
Returns:
True if the string is a valid native concept string with domain prefix
"""
- if "." not in concept_string:
+ if "." not in concept_ref:
return False
- domain_code, concept_code = concept_string.split(".", 1)
- return SpecialDomain.is_native(domain=domain_code) and concept_code in cls.values_list()
+ domain_code, concept_code = concept_ref.split(".", 1)
+ return SpecialDomain.is_native(domain_code=domain_code) and concept_code in cls.values_list()
@classmethod
- def validate_native_concept_string_or_code(cls, concept_string_or_code: str) -> None:
- if not cls.is_native_concept_string_or_code(concept_string_or_code=concept_string_or_code):
- msg = f"Concept string or code '{concept_string_or_code}' is not a valid native concept string or code"
+ def validate_native_concept_ref_or_code(cls, concept_ref_or_code: str) -> None:
+ if not cls.is_native_concept_ref_or_code(concept_ref_or_code=concept_ref_or_code):
+ msg = f"Concept string or code '{concept_ref_or_code}' is not a valid native concept string or code"
raise NativeConceptDefinitionError(msg)
@classmethod
- def get_validated_native_concept_string(cls, concept_string_or_code: str) -> str:
- cls.validate_native_concept_string_or_code(concept_string_or_code=concept_string_or_code)
- if "." in concept_string_or_code:
- return concept_string_or_code
+ def get_validated_native_concept_ref(cls, concept_ref_or_code: str) -> str:
+ cls.validate_native_concept_ref_or_code(concept_ref_or_code=concept_ref_or_code)
+ if "." in concept_ref_or_code:
+ return concept_ref_or_code
else:
- return f"{SpecialDomain.NATIVE}.{concept_string_or_code}"
+ return f"{SpecialDomain.NATIVE}.{concept_ref_or_code}"
diff --git a/pipelex/core/concepts/validation.py b/pipelex/core/concepts/validation.py
index edbccdd63..f8176f3df 100644
--- a/pipelex/core/concepts/validation.py
+++ b/pipelex/core/concepts/validation.py
@@ -13,8 +13,8 @@ def validate_concept_code(concept_code: str) -> None:
raise ConceptCodeError(msg)
-def is_concept_string_valid(concept_string: str) -> bool:
- domain, concept_code = concept_string.split(".", 1)
+def is_concept_ref_valid(concept_ref: str) -> bool:
+ domain, concept_code = concept_ref.split(".", 1)
# Validate domain
if not is_domain_code_valid(code=domain):
@@ -24,27 +24,27 @@ def is_concept_string_valid(concept_string: str) -> bool:
return is_concept_code_valid(concept_code=concept_code)
-def validate_concept_string(concept_string: str) -> None:
- if not is_concept_string_valid(concept_string=concept_string):
+def validate_concept_ref(concept_ref: str) -> None:
+ if not is_concept_ref_valid(concept_ref=concept_ref):
msg = (
- f"Concept string '{concept_string}' is not a valid concept string. It must be in the format 'domain.ConceptCode': "
+ f"Concept string '{concept_ref}' is not a valid concept string. It must be in the format 'domain.ConceptCode': "
" - domain: a valid domain code (snake_case), "
" - ConceptCode: a valid concept code (PascalCase)"
)
raise ConceptStringError(msg)
-def is_concept_string_or_code_valid(concept_string_or_code: str) -> bool:
- if concept_string_or_code.count(".") > 1:
+def is_concept_ref_or_code_valid(concept_ref_or_code: str) -> bool:
+ if concept_ref_or_code.count(".") > 1:
return False
- if concept_string_or_code.count(".") == 1:
- return is_concept_string_valid(concept_string=concept_string_or_code)
+ if concept_ref_or_code.count(".") == 1:
+ return is_concept_ref_valid(concept_ref=concept_ref_or_code)
else:
- return is_concept_code_valid(concept_code=concept_string_or_code)
+ return is_concept_code_valid(concept_code=concept_ref_or_code)
-def validate_concept_string_or_code(concept_string_or_code: str) -> None:
- if not is_concept_string_or_code_valid(concept_string_or_code=concept_string_or_code):
- msg = f"Concept string or code '{concept_string_or_code}' is not a valid concept string or code."
+def validate_concept_ref_or_code(concept_ref_or_code: str) -> None:
+ if not is_concept_ref_or_code_valid(concept_ref_or_code=concept_ref_or_code):
+ msg = f"Concept string or code '{concept_ref_or_code}' is not a valid concept string or code."
raise ConceptStringError(msg)
diff --git a/pipelex/core/domains/domain.py b/pipelex/core/domains/domain.py
index 116da1c2f..7a395bf84 100644
--- a/pipelex/core/domains/domain.py
+++ b/pipelex/core/domains/domain.py
@@ -7,9 +7,9 @@ class SpecialDomain(StrEnum):
NATIVE = "native"
@classmethod
- def is_native(cls, domain: str) -> bool:
+ def is_native(cls, domain_code: str) -> bool:
try:
- enum_value = SpecialDomain(domain)
+ enum_value = SpecialDomain(domain_code)
except ValueError:
return False
diff --git a/pipelex/core/exceptions.py b/pipelex/core/exceptions.py
index 51a1af338..fc9341cc3 100644
--- a/pipelex/core/exceptions.py
+++ b/pipelex/core/exceptions.py
@@ -16,7 +16,7 @@ class PipeFactoryErrorData(BaseModel):
)
# === Source Context ===
- domain: str | None = Field(None, description="Domain where error occurred")
+ domain_code: str | None = Field(None, description="Domain where error occurred")
# === Entity Context (what failed) ===
pipe_code: str | None = Field(None, description="Pipe code that failed to be created")
@@ -39,7 +39,7 @@ class PipesAndConceptValidationErrorData(BaseModel):
"""
# === Source Context ===
- domain: str | None = Field(None, description="Domain where error occurred")
+ domain_code: str | None = Field(None, description="Domain where error occurred")
source: str | None = Field(None, description="Source file path")
# === Entity Context (what failed) ===
diff --git a/pipelex/core/memory/working_memory_factory.py b/pipelex/core/memory/working_memory_factory.py
index e2294e492..320dccf24 100644
--- a/pipelex/core/memory/working_memory_factory.py
+++ b/pipelex/core/memory/working_memory_factory.py
@@ -55,13 +55,13 @@ class WorkingMemoryFactory(BaseModel):
def make_from_pipeline_inputs(
cls,
pipeline_inputs: PipelineInputs,
- search_domains: list[str] | None = None,
+ search_domain_codes: list[str] | None = None,
) -> WorkingMemory:
"""Create a WorkingMemory from a pipeline inputs dictionary.
Args:
pipeline_inputs: Dictionary in the format from API serialization
- search_domains: List of domains to search for concepts
+ search_domain_codes: List of domain codes to search for concepts
Returns:
WorkingMemory object reconstructed from the implicit format
@@ -73,7 +73,7 @@ class WorkingMemoryFactory(BaseModel):
stuff = StuffFactory.make_stuff_from_stuff_content_or_data(
name=stuff_key,
stuff_content_or_data=stuff_content_or_data,
- search_domains=search_domains,
+ search_domain_codes=search_domain_codes,
)
working_memory.add_new_stuff(name=stuff_key, stuff=stuff)
return working_memory
diff --git a/pipelex/core/pipes/exceptions.py b/pipelex/core/pipes/exceptions.py
index b4d31a593..8cedad74e 100644
--- a/pipelex/core/pipes/exceptions.py
+++ b/pipelex/core/pipes/exceptions.py
@@ -42,13 +42,13 @@ class PipeFactoryError(PipelexError):
message: str,
error_type: PipeFactoryErrorType = PipeFactoryErrorType.UNKNOWN_FACTORY_ERROR,
pipe_code: str | None = None,
- domain: str | None = None,
+ domain_code: str | None = None,
missing_concept_code: str | None = None,
declared_concepts: list[str] | None = None,
):
self.error_type = error_type
self.pipe_code = pipe_code
- self.domain = domain
+ self.domain_code = domain_code
self.missing_concept_code = missing_concept_code
self.declared_concepts = declared_concepts or []
super().__init__(message)
@@ -122,7 +122,7 @@ class PipeValidationError(ValueError):
self,
message: str,
error_type: PipeValidationErrorType | None = None,
- domain: str | None = None,
+ domain_code: str | None = None,
pipe_code: str | None = None,
variable_names: list[str] | None = None,
required_concept_codes: list[str] | None = None,
@@ -131,7 +131,7 @@ class PipeValidationError(ValueError):
explanation: str | None = None,
):
self.error_type = error_type
- self.domain = domain
+ self.domain_code = domain_code
self.pipe_code = pipe_code
self.variable_names = variable_names
self.required_concept_codes = required_concept_codes
@@ -141,7 +141,7 @@ class PipeValidationError(ValueError):
super().__init__(message)
def desc(self) -> str:
- msg = f"{self.error_type} • domain='{self.domain}'"
+ msg = f"{self.error_type} • domain_code='{self.domain_code}'"
if self.pipe_code:
msg += f" • pipe='{self.pipe_code}'"
if self.variable_names:
diff --git a/pipelex/core/pipes/handle_pipe_errors.py b/pipelex/core/pipes/handle_pipe_errors.py
index 9a4be7b35..7dd9bf407 100644
--- a/pipelex/core/pipes/handle_pipe_errors.py
+++ b/pipelex/core/pipes/handle_pipe_errors.py
@@ -68,7 +68,7 @@ def categorize_pipe_validation_error(
unknown_field_name = str(loc[0]) if len(loc) >= 1 else None
categorized_error = PipesAndConceptValidationErrorData(
- domain=None,
+ domain_code=None,
source=None,
pipe_code=None,
concept_code=None, # We don't have the code at this point
@@ -123,7 +123,7 @@ def _handle_pipe_errors(
error_type = PipeValidationErrorType.UNKNOWN_VALIDATION_ERROR
return PipesAndConceptValidationErrorData(
- domain=None,
+ domain_code=None,
source=None,
pipe_code=pipe_code,
concept_code=None,
@@ -153,7 +153,7 @@ def categorize_pipe_validation_with_libraries_error(
error_type = pipe_error.error_type or PipeValidationErrorType.UNKNOWN_VALIDATION_ERROR
return PipesAndConceptValidationErrorData(
error_type=error_type,
- domain=pipe_error.domain,
+ domain_code=pipe_error.domain_code,
source=pipe_error.file_path or None,
pipe_code=pipe_error.pipe_code,
concept_code=None, # This is a pipe error, not a concept error
@@ -179,7 +179,7 @@ def categorize_pipe_factory_error(
"""
return PipeFactoryErrorData(
error_type=factory_error.error_type,
- domain=factory_error.domain,
+ domain_code=factory_error.domain_code,
pipe_code=factory_error.pipe_code,
missing_concept_code=factory_error.missing_concept_code,
declared_concepts=factory_error.declared_concepts,
diff --git a/pipelex/core/pipes/inputs/input_stuff_specs.py b/pipelex/core/pipes/inputs/input_stuff_specs.py
index ca5ea82dc..c5779da85 100644
--- a/pipelex/core/pipes/inputs/input_stuff_specs.py
+++ b/pipelex/core/pipes/inputs/input_stuff_specs.py
@@ -62,11 +62,11 @@ class InputStuffSpecs(RootModel[PipeInputsRoot]):
return transformed_dict
- def set_default_domain(self, domain: str):
+ def set_default_domain(self, domain_code: str):
for input_name, stuff_spec in self.root.items():
input_concept_code = stuff_spec.concept.code
if "." not in input_concept_code:
- stuff_spec.concept.code = f"{domain}.{input_concept_code}"
+ stuff_spec.concept.code = f"{domain_code}.{input_concept_code}"
self.root[input_name] = stuff_spec
def get_required_stuff_spec(self, variable_name: str) -> StuffSpec:
@@ -90,7 +90,7 @@ class InputStuffSpecs(RootModel[PipeInputsRoot]):
def concepts(self) -> list[Concept]:
all_concepts: list[Concept] = []
for stuff_spec in self.root.values():
- if stuff_spec.concept.concept_string not in [c.concept_string for c in all_concepts]:
+ if stuff_spec.concept.concept_ref not in [c.concept_ref for c in all_concepts]:
all_concepts.append(stuff_spec.concept)
return all_concepts
diff --git a/pipelex/core/pipes/inputs/input_stuff_specs_factory.py b/pipelex/core/pipes/inputs/input_stuff_specs_factory.py
index 0856d5f95..93e55520c 100644
--- a/pipelex/core/pipes/inputs/input_stuff_specs_factory.py
+++ b/pipelex/core/pipes/inputs/input_stuff_specs_factory.py
@@ -4,7 +4,7 @@ from typing import TYPE_CHECKING
from pipelex.base_exceptions import PipelexError
from pipelex.core.concepts.concept_factory import ConceptFactory
from pipelex.core.concepts.exceptions import ConceptStringError
-from pipelex.core.concepts.validation import validate_concept_string_or_code
+from pipelex.core.concepts.validation import validate_concept_ref_or_code
from pipelex.core.pipes.inputs.input_stuff_specs import InputStuffSpecs, PipeInputsRoot
from pipelex.core.pipes.stuff_spec.stuff_spec import StuffSpec
from pipelex.hub import get_required_concept
@@ -25,13 +25,13 @@ class InputStuffSpecsFactory:
@classmethod
def make_from_blueprint(
cls,
- domain: str,
+ domain_code: str,
blueprint: dict[str, str],
) -> InputStuffSpecs:
stuff_specs: PipeInputsRoot = {}
for var_name, stuff_spec_str in blueprint.items():
stuff_spec = InputStuffSpecsFactory.make_from_string(
- domain=domain,
+ domain_code=domain_code,
stuff_spec_str=stuff_spec_str,
)
stuff_specs[var_name] = stuff_spec
@@ -40,7 +40,7 @@ class InputStuffSpecsFactory:
@classmethod
def make_from_string(
cls,
- domain: str,
+ domain_code: str,
stuff_spec_str: str,
) -> StuffSpec:
"""Parse an input requirement string and return an StuffSpec.
@@ -52,7 +52,7 @@ class InputStuffSpecsFactory:
- "ConceptCode[5]" -> multiplicity = 5 (resolved with domain)
Args:
- domain: The domain to use for resolving concept codes without domain prefix
+ domain_code: The domain code to use for resolving concept codes without domain prefix
stuff_spec_str: String in the format "domain.ConceptCode" or "ConceptCode" with optional "[multiplicity]"
Returns:
@@ -71,19 +71,19 @@ class InputStuffSpecsFactory:
msg = f"Invalid input stuff spec string: {stuff_spec_str}"
raise InputStuffSpecsFactoryError(msg)
- concept_string_or_code = match.group(1)
+ concept_ref_or_code = match.group(1)
multiplicity_str = match.group(2)
# Validate and resolve concept string with domain
try:
- validate_concept_string_or_code(concept_string_or_code=concept_string_or_code)
+ validate_concept_ref_or_code(concept_ref_or_code=concept_ref_or_code)
except ConceptStringError as exc:
- msg = f"Invalid concept string '{concept_string_or_code}' when trying to make an 'StuffSpec' from string: {exc}"
+ msg = f"Invalid concept string '{concept_ref_or_code}' when trying to make an 'StuffSpec' from string: {exc}"
raise InputStuffSpecsFactoryError(msg) from exc
- concept_string_with_domain = ConceptFactory.make_concept_string_with_domain_from_concept_string_or_code(
- domain=domain,
- concept_sring_or_code=concept_string_or_code,
+ concept_ref_with_domain = ConceptFactory.make_concept_ref_with_domain_from_concept_ref_or_code(
+ domain_code=domain_code,
+ concept_sring_or_code=concept_ref_or_code,
)
# Determine multiplicity
@@ -96,5 +96,5 @@ class InputStuffSpecsFactory:
multiplicity = int(multiplicity_str)
# else: No brackets, multiplicity stays None
- concept = get_required_concept(concept_string=concept_string_with_domain)
+ concept = get_required_concept(concept_ref=concept_ref_with_domain)
return StuffSpec(concept=concept, multiplicity=multiplicity)
diff --git a/pipelex/core/pipes/pipe_abstract.py b/pipelex/core/pipes/pipe_abstract.py
index a01463d38..4027a9073 100644
--- a/pipelex/core/pipes/pipe_abstract.py
+++ b/pipelex/core/pipes/pipe_abstract.py
@@ -40,7 +40,7 @@ class PipeAbstract(ABC, BaseModel):
pipe_category: Any # Any so that subclasses can put a Literal
type: Any # Any so that subclasses can put a Literal
code: str
- domain: str
+ domain_code: str
description: str | None = None
inputs: InputStuffSpecs = Field(default_factory=InputStuffSpecs)
output: StuffSpec
@@ -52,18 +52,18 @@ class PipeAbstract(ABC, BaseModel):
@property
def concept_dependencies(self) -> list[Concept]:
"""Return all unique concept dependencies (output + inputs) without duplicates."""
- seen_concept_strings: set[str] = set()
+ seen_concept_refs: set[str] = set()
unique_concepts: list[Concept] = []
# Add output concept first
unique_concepts.append(self.output.concept)
- seen_concept_strings.add(self.output.concept.concept_string)
+ seen_concept_refs.add(self.output.concept.concept_ref)
# Add input concepts (avoiding duplicates)
for concept in self.inputs.concepts:
- if concept.concept_string not in seen_concept_strings:
+ if concept.concept_ref not in seen_concept_refs:
unique_concepts.append(concept)
- seen_concept_strings.add(concept.concept_string)
+ seen_concept_refs.add(concept.concept_ref)
return unique_concepts
@@ -137,7 +137,7 @@ class PipeAbstract(ABC, BaseModel):
raise PipeValidationError(
message=msg,
error_type=PipeValidationErrorType.MISSING_INPUT_VARIABLE,
- domain=self.domain,
+ domain_code=self.domain_code,
pipe_code=self.code,
variable_names=[required_variable_name],
)
@@ -154,7 +154,7 @@ class PipeAbstract(ABC, BaseModel):
raise PipeValidationError(
message=msg,
error_type=PipeValidationErrorType.MISSING_INPUT_VARIABLE,
- domain=self.domain,
+ domain_code=self.domain_code,
pipe_code=self.code,
variable_names=[var_name],
)
@@ -190,7 +190,7 @@ class PipeAbstract(ABC, BaseModel):
raise PipeValidationError(
message=msg,
error_type=PipeValidationErrorType.INPUT_STUFF_SPEC_MISMATCH,
- domain=self.domain,
+ domain_code=self.domain_code,
pipe_code=self.code,
variable_names=[var_name],
)
@@ -202,7 +202,7 @@ class PipeAbstract(ABC, BaseModel):
raise PipeValidationError(
message=msg,
error_type=PipeValidationErrorType.EXTRANEOUS_INPUT_VARIABLE,
- domain=self.domain,
+ domain_code=self.domain_code,
pipe_code=self.code,
variable_names=[input_name],
)
diff --git a/pipelex/core/pipes/pipe_blueprint.py b/pipelex/core/pipes/pipe_blueprint.py
index 340784a51..4e51fe60c 100644
--- a/pipelex/core/pipes/pipe_blueprint.py
+++ b/pipelex/core/pipes/pipe_blueprint.py
@@ -5,7 +5,7 @@ from typing import Any, final
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
from pipelex.core.concepts.exceptions import ConceptStringError
-from pipelex.core.concepts.validation import validate_concept_string_or_code
+from pipelex.core.concepts.validation import validate_concept_ref_or_code
from pipelex.core.pipes.validation import validate_input_name
from pipelex.core.pipes.variable_multiplicity import MUTLIPLICITY_PATTERN, PipeVariableMultiplicityError, parse_concept_with_multiplicity
from pipelex.types import Self, StrEnum
@@ -181,11 +181,11 @@ class PipeBlueprint(ABC, BaseModel):
raise ValueError(msg)
# Extract the concept part (without multiplicity) and validate it
- concept_string_or_code = match.group(1)
+ concept_ref_or_code = match.group(1)
try:
- validate_concept_string_or_code(concept_string_or_code=concept_string_or_code)
+ validate_concept_ref_or_code(concept_ref_or_code=concept_ref_or_code)
except ConceptStringError as exc:
- msg = f"Invalid concept string or code '{concept_string_or_code}' when trying to validate the input of a pipe blueprint: {exc}"
+ msg = f"Invalid concept string or code '{concept_ref_or_code}' when trying to validate the input of a pipe blueprint: {exc}"
raise ValueError(msg) from exc
self.validate_inputs()
@@ -199,7 +199,7 @@ class PipeBlueprint(ABC, BaseModel):
msg = f"Invalid concept specification syntax: '{self.output}'. {exc}"
raise ValueError(msg) from exc
try:
- validate_concept_string_or_code(concept_string_or_code=output_parse_result.concept)
+ validate_concept_ref_or_code(concept_ref_or_code=output_parse_result.concept)
except ConceptStringError as exc:
msg = f"Invalid concept string '{output_parse_result.concept}' when trying to validate the output of a pipe blueprint: {exc}"
raise ValueError(msg) from exc
diff --git a/pipelex/core/pipes/pipe_factory.py b/pipelex/core/pipes/pipe_factory.py
index cbbae5dbb..022881d54 100644
--- a/pipelex/core/pipes/pipe_factory.py
+++ b/pipelex/core/pipes/pipe_factory.py
@@ -4,7 +4,7 @@ from kajson.exceptions import ClassRegistryInheritanceError, ClassRegistryNotFou
from kajson.kajson_manager import KajsonManager
from typing_extensions import runtime_checkable
-from pipelex.core.concepts.helpers import strip_multiplicity_from_concept_string_or_code
+from pipelex.core.concepts.helpers import strip_multiplicity_from_concept_ref_or_code
from pipelex.core.concepts.native.concept_native import NativeConceptCode
from pipelex.core.pipes.exceptions import PipeFactoryError, PipeFactoryErrorType
from pipelex.core.pipes.inputs.input_stuff_specs import InputStuffSpecs
@@ -51,17 +51,15 @@ class PipeFactory(Generic[PipeAbstractType]):
# TODO: This test should move to the PipelexBlueprint validation.
# Validate that the specified concepts are declared in the bundle, or are natives concepts.
if blueprint.inputs is not None:
- for input_name, input_concept_string_or_code in blueprint.inputs.items():
- stripped_input_concept_string_or_code = strip_multiplicity_from_concept_string_or_code(
- concept_string_or_code=input_concept_string_or_code
- )
- if "." not in stripped_input_concept_string_or_code:
+ for input_name, input_concept_ref_or_code in blueprint.inputs.items():
+ stripped_input_concept_ref_or_code = strip_multiplicity_from_concept_ref_or_code(concept_ref_or_code=input_concept_ref_or_code)
+ if "." not in stripped_input_concept_ref_or_code:
if (
- not NativeConceptCode.is_native_concept_string_or_code(concept_string_or_code=stripped_input_concept_string_or_code)
- and stripped_input_concept_string_or_code not in concept_codes_from_the_same_domain
+ not NativeConceptCode.is_native_concept_ref_or_code(concept_ref_or_code=stripped_input_concept_ref_or_code)
+ and stripped_input_concept_ref_or_code not in concept_codes_from_the_same_domain
):
msg = (
- f"Input stuff '{input_name}' with concept '{stripped_input_concept_string_or_code}' "
+ f"Input stuff '{input_name}' with concept '{stripped_input_concept_ref_or_code}' "
f"in pipe '{pipe_code}' (domain '{domain_code}') is invalid. "
f"The concept must be either native, declared in domain '{domain_code}', or fully qualified with a domain prefix. "
f"Declared concepts are: '{concept_codes_from_the_same_domain}'"
@@ -69,13 +67,13 @@ class PipeFactory(Generic[PipeAbstractType]):
raise PipeFactoryError(msg)
if "." not in blueprint.output:
- stripped_output_concept_string_or_code = strip_multiplicity_from_concept_string_or_code(concept_string_or_code=blueprint.output)
+ stripped_output_concept_ref_or_code = strip_multiplicity_from_concept_ref_or_code(concept_ref_or_code=blueprint.output)
if (
- not NativeConceptCode.is_native_concept_string_or_code(concept_string_or_code=stripped_output_concept_string_or_code)
- and stripped_output_concept_string_or_code not in concept_codes_from_the_same_domain
+ not NativeConceptCode.is_native_concept_ref_or_code(concept_ref_or_code=stripped_output_concept_ref_or_code)
+ and stripped_output_concept_ref_or_code not in concept_codes_from_the_same_domain
):
msg = (
- f"Output concept '{stripped_output_concept_string_or_code}' in pipe '{pipe_code}' (domain '{domain_code}') is invalid. "
+ f"Output concept '{stripped_output_concept_ref_or_code}' in pipe '{pipe_code}' (domain '{domain_code}') is invalid. "
f"The concept must be either native, declared in domain '{domain_code}', or fully qualified with a domain prefix. "
f"Declared concepts are: '{concept_codes_from_the_same_domain}'"
)
@@ -83,19 +81,19 @@ class PipeFactory(Generic[PipeAbstractType]):
message=msg,
error_type=PipeFactoryErrorType.UNKNOWN_CONCEPT,
pipe_code=pipe_code,
- domain=domain_code,
- missing_concept_code=stripped_output_concept_string_or_code,
+ domain_code=domain_code,
+ missing_concept_code=stripped_output_concept_ref_or_code,
declared_concepts=concept_codes_from_the_same_domain,
)
# Parse common attributes
try:
- parsed_output = StuffSpecFactory.make_from_blueprint(domain=domain_code, output_string=blueprint.output)
+ parsed_output = StuffSpecFactory.make_from_blueprint(domain_code=domain_code, output_string=blueprint.output)
except StuffSpecFactoryError as exc:
msg = f"Error parsing output string '{blueprint.output}': {exc}"
raise PipeFactoryError(msg) from exc
parsed_inputs = InputStuffSpecsFactory.make_from_blueprint(
- domain=domain_code,
+ domain_code=domain_code,
blueprint=blueprint.inputs or {},
)
diff --git a/pipelex/core/pipes/stuff_spec/stuff_spec_factory.py b/pipelex/core/pipes/stuff_spec/stuff_spec_factory.py
index 37f81c72b..63b2e7a2b 100644
--- a/pipelex/core/pipes/stuff_spec/stuff_spec_factory.py
+++ b/pipelex/core/pipes/stuff_spec/stuff_spec_factory.py
@@ -15,13 +15,13 @@ class StuffSpecFactory:
@classmethod
def make_from_blueprint(
cls,
- domain: str,
+ domain_code: str,
output_string: str,
) -> StuffSpec:
"""Parse an output string and return a StuffSpec with concept and multiplicity.
Args:
- domain: The domain to use for resolving concept codes without domain prefix
+ domain_code: The domain code to use for resolving concept codes without domain prefix
output_string: String in the format "ConceptCode" or "domain.ConceptCode"
with optional "[multiplicity]" (e.g., "Text", "Text[]", "Text[3]")
@@ -40,17 +40,17 @@ class StuffSpecFactory:
# Resolve concept with domain
try:
- domain_and_code = ConceptFactory.make_domain_and_concept_code_from_concept_string_or_code(
- domain=domain,
- concept_string_or_code=parse_result.concept,
+ domain_and_code = ConceptFactory.make_domain_and_concept_code_from_concept_ref_or_code(
+ domain_code=domain_code,
+ concept_ref_or_code=parse_result.concept,
)
except ConceptFactoryError as exc:
msg = f"Error resolving concept from output string '{output_string}': {exc}"
raise StuffSpecFactoryError(msg) from exc
concept = get_required_concept(
- concept_string=ConceptFactory.make_concept_string_with_domain(
- domain=domain_and_code.domain,
+ concept_ref=ConceptFactory.make_concept_ref_with_domain(
+ domain_code=domain_and_code.domain_code,
concept_code=domain_and_code.concept_code,
),
)
diff --git a/pipelex/core/stuffs/stuff_factory.py b/pipelex/core/stuffs/stuff_factory.py
index 491922fa0..aedd360e9 100644
--- a/pipelex/core/stuffs/stuff_factory.py
+++ b/pipelex/core/stuffs/stuff_factory.py
@@ -8,7 +8,7 @@ from pipelex.client.protocol import StuffContentOrData
from pipelex.core.concepts.concept import Concept
from pipelex.core.concepts.concept_factory import ConceptFactory
from pipelex.core.concepts.native.concept_native import NativeConceptCode
-from pipelex.core.concepts.validation import validate_concept_string
+from pipelex.core.concepts.validation import validate_concept_ref
from pipelex.core.stuffs.list_content import ListContent
from pipelex.core.stuffs.stuff import DictStuff, Stuff
from pipelex.core.stuffs.stuff_content import StuffContent
@@ -24,14 +24,14 @@ class StuffFactoryError(PipelexError):
class StuffBlueprint(BaseModel):
stuff_name: str
- concept_string: str
+ concept_ref: str
content: dict[str, Any] | str
- @field_validator("concept_string")
+ @field_validator("concept_ref")
@classmethod
- def validate_concept_string_field(cls, concept_string: str) -> str:
- validate_concept_string(concept_string)
- return concept_string
+ def validate_concept_ref_field(cls, concept_ref: str) -> str:
+ validate_concept_ref(concept_ref)
+ return concept_ref
class StuffFactory:
@@ -48,9 +48,9 @@ class StuffFactory:
)
@classmethod
- def make_from_concept_string(cls, concept_string: str, name: str, content: StuffContent) -> Stuff:
- validate_concept_string(concept_string)
- concept = get_required_concept(concept_string=concept_string)
+ def make_from_concept_ref(cls, concept_ref: str, name: str, content: StuffContent) -> Stuff:
+ validate_concept_ref(concept_ref)
+ concept = get_required_concept(concept_ref=concept_ref)
return cls.make_stuff(
concept=concept,
content=content,
@@ -78,7 +78,7 @@ class StuffFactory:
def make_from_blueprint(cls, blueprint: StuffBlueprint) -> "Stuff":
concept_library = get_concept_library()
if isinstance(blueprint.content, str) and concept_library.is_compatible(
- tested_concept=concept_library.get_required_concept(concept_string=blueprint.concept_string),
+ tested_concept=concept_library.get_required_concept(concept_ref=blueprint.concept_ref),
wanted_concept=get_native_concept(native_concept=NativeConceptCode.TEXT),
):
the_stuff = cls.make_stuff(
@@ -88,11 +88,11 @@ class StuffFactory:
)
else:
the_stuff_content = StuffContentFactory.make_stuff_content_from_concept_required(
- concept=concept_library.get_required_concept(concept_string=blueprint.concept_string),
+ concept=concept_library.get_required_concept(concept_ref=blueprint.concept_ref),
value=blueprint.content,
)
the_stuff = cls.make_stuff(
- concept=concept_library.get_required_concept(concept_string=blueprint.concept_string),
+ concept=concept_library.get_required_concept(concept_ref=blueprint.concept_ref),
content=the_stuff_content,
name=blueprint.stuff_name,
)
@@ -125,7 +125,7 @@ class StuffFactory:
stuff_content_or_data: StuffContentOrData,
name: str | None = None,
code: str | None = None,
- search_domains: list[str] | None = None,
+ search_domain_codes: list[str] | None = None,
) -> Stuff:
"""Create a Stuff from StuffContentOrData covering all pipeline inputs cases.
@@ -195,14 +195,14 @@ class StuffFactory:
content_class_name = type(first_item).__name__
# Check if it's a native concept
- if "Content" in content_class_name and NativeConceptCode.is_native_concept_string_or_code(
- concept_string_or_code=content_class_name.split("Content")[0]
+ if "Content" in content_class_name and NativeConceptCode.is_native_concept_ref_or_code(
+ concept_ref_or_code=content_class_name.split("Content")[0]
):
concept = get_native_concept(native_concept=NativeConceptCode(content_class_name.split("Content")[0]))
else:
try:
- concept = concept_library.get_required_concept_from_concept_string_or_code(
- concept_string_or_code=content_class_name, search_domains=search_domains
+ concept = concept_library.get_required_concept_from_concept_ref_or_code(
+ concept_ref_or_code=content_class_name, search_domain_codes=search_domain_codes
)
except ConceptLibraryConceptNotFoundError as exc:
msg = (
@@ -224,16 +224,16 @@ class StuffFactory:
content_class_name = stuff_content_or_data.__class__.__name__
# Check if it's a native concept
- if "Content" in content_class_name and NativeConceptCode.is_native_concept_string_or_code(
- concept_string_or_code=content_class_name.split("Content")[0]
+ if "Content" in content_class_name and NativeConceptCode.is_native_concept_ref_or_code(
+ concept_ref_or_code=content_class_name.split("Content")[0]
):
# It's a native concept like TextContent, ImageContent, etc.
concept = get_native_concept(native_concept=NativeConceptCode(content_class_name.split("Content")[0]))
else:
# It's a StructuredContent, try to find the concept
try:
- concept = concept_library.get_required_concept_from_concept_string_or_code(
- concept_string_or_code=content_class_name, search_domains=search_domains
+ concept = concept_library.get_required_concept_from_concept_ref_or_code(
+ concept_ref_or_code=content_class_name, search_domain_codes=search_domain_codes
)
except ConceptLibraryConceptNotFoundError as exc:
msg = (
@@ -291,14 +291,14 @@ class StuffFactory:
raise StuffFactoryError(msg)
# Check if it's a native concept
- if "Content" in content_class_name and NativeConceptCode.is_native_concept_string_or_code(
- concept_string_or_code=content_class_name.split("Content")[0]
+ if "Content" in content_class_name and NativeConceptCode.is_native_concept_ref_or_code(
+ concept_ref_or_code=content_class_name.split("Content")[0]
):
concept = get_native_concept(native_concept=NativeConceptCode(content_class_name.split("Content")[0]))
else:
try:
- concept = concept_library.get_required_concept_from_concept_string_or_code(
- concept_string_or_code=content_class_name, search_domains=search_domains
+ concept = concept_library.get_required_concept_from_concept_ref_or_code(
+ concept_ref_or_code=content_class_name, search_domain_codes=search_domain_codes
)
except ConceptLibraryConceptNotFoundError as exc:
msg = (
@@ -343,18 +343,18 @@ class StuffFactory:
)
raise StuffFactoryError(msg)
- concept_string = stuff_content_or_data["concept"]
+ concept_ref = stuff_content_or_data["concept"]
content = stuff_content_or_data["content"]
# Get the concept from the library
try:
- concept = concept_library.get_required_concept_from_concept_string_or_code(
- concept_string_or_code=concept_string, search_domains=search_domains
+ concept = concept_library.get_required_concept_from_concept_ref_or_code(
+ concept_ref_or_code=concept_ref, search_domain_codes=search_domain_codes
)
except ConceptLibraryConceptNotFoundError as exc:
msg = (
f"Trying to create a Stuff '{name}' in the inputs of your pipe, from a dict that should represent a StuffContentOrData "
- f"but the concept of name '{concept_string}' is not found in the library"
+ f"but the concept of name '{concept_ref}' is not found in the library"
)
raise StuffFactoryError(msg) from exc
@@ -371,7 +371,7 @@ class StuffFactory:
)
msg = (
f"Trying to create a Stuff '{name}' in the inputs of your pipe, from a dict that should represent a StuffContentOrData "
- f"but the concept of name '{concept_string}' is not compatible with native concept 'native.Text'"
+ f"but the concept of name '{concept_ref}' is not compatible with native concept 'native.Text'"
)
raise StuffFactoryError(msg)
@@ -380,7 +380,7 @@ class StuffFactory:
if concept.structure_class_name != content.__class__.__name__:
msg = (
f"Trying to create a Stuff '{name}' in the inputs of your pipe, from a dict that should represent a StuffContentOrData "
- f"but the concept of name '{concept_string}' is not compatible with the content of type {content.__class__.__name__}"
+ f"but the concept of name '{concept_ref}' is not compatible with the content of type {content.__class__.__name__}"
)
raise StuffFactoryError(msg)
@@ -397,7 +397,7 @@ class StuffFactory:
if the_class is None:
msg = (
f"Trying to create a Stuff '{name}' in the inputs of your pipe, from a dict that should represent a StuffContentOrData "
- f"but the concept of name '{concept_string}' is not compatible with a dict content"
+ f"but the concept of name '{concept_ref}' is not compatible with a dict content"
)
raise StuffFactoryError(msg)
@@ -437,7 +437,7 @@ class StuffFactory:
code=code,
)
- msg = f"Concept '{concept_string}' is not compatible with list of text content"
+ msg = f"Concept '{concept_ref}' is not compatible with list of text content"
raise StuffFactoryError(msg)
# Case 2.4: list[StuffContent] (includes both native and StructuredContent)
diff --git a/pipelex/hub.py b/pipelex/hub.py
index de493171b..d5c08a22e 100644
--- a/pipelex/hub.py
+++ b/pipelex/hub.py
@@ -442,12 +442,12 @@ def teardown_current_library() -> None:
_library_id.set(None)
-def get_required_domain(domain: str) -> Domain:
- return get_pipelex_hub().get_required_domain_library().get_required_domain(domain=domain)
+def get_required_domain(domain_code: str) -> Domain:
+ return get_pipelex_hub().get_required_domain_library().get_required_domain(domain_code=domain_code)
-def get_optional_domain(domain: str) -> Domain | None:
- return get_pipelex_hub().get_required_domain_library().get_domain(domain=domain)
+def get_optional_domain(domain_code: str) -> Domain | None:
+ return get_pipelex_hub().get_required_domain_library().get_domain(domain_code=domain_code)
def get_pipe_library() -> PipeLibraryAbstract:
@@ -470,8 +470,8 @@ def get_concept_library() -> ConceptLibraryAbstract:
return get_pipelex_hub().get_library().concept_library
-def get_required_concept(concept_string: str) -> Concept:
- return get_pipelex_hub().get_library().concept_library.get_required_concept(concept_string=concept_string)
+def get_required_concept(concept_ref: str) -> Concept:
+ return get_pipelex_hub().get_library().concept_library.get_required_concept(concept_ref=concept_ref)
def get_pipe_router() -> PipeRouterProtocol:
diff --git a/pipelex/kit/agent_rules/write_pipelex.md b/pipelex/kit/agent_rules/write_pipelex.md
index 2a4b17711..23adb8c9a 100644
--- a/pipelex/kit/agent_rules/write_pipelex.md
+++ b/pipelex/kit/agent_rules/write_pipelex.md
@@ -20,10 +20,10 @@ A pipeline file has three main sections:
### Domain Statement
```plx
-domain = "domain_name"
+domain = "domain_code"
description = "Description of the domain" # Optional
```
-Note: The domain name usually matches the plx filename for single-file domains. For multi-file domains, use the subdirectory name.
+Note: The domain code usually matches the plx filename for single-file domains. For multi-file domains, use the subdirectory name.
### Concept Definitions
diff --git a/pipelex/kit/migrations/migrate_0.11.0_0.12.x.md b/pipelex/kit/migrations/migrate_0.11.0_0.12.x.md
index 17722a736..bb6ed5432 100644
--- a/pipelex/kit/migrations/migrate_0.11.0_0.12.x.md
+++ b/pipelex/kit/migrations/migrate_0.11.0_0.12.x.md
@@ -216,7 +216,7 @@ from my_project.pipelines.finance_struct import Invoice, InvoiceData
### Step 6: Update Concept References (Optional)
-While domain-prefixed concept references still work, you can now use simpler references:
+While domain code prefixed concept references still work, you can now use simpler references:
**Before:**
```plx
@@ -226,7 +226,7 @@ inputs = { wedding_photo = "images.Photo" }
**After:**
```plx
-# Simpler references (domain prefix optional)
+# Simpler references (domain code prefix optional)
inputs = { prompt = "ImgGenPrompt" }
inputs = { wedding_photo = "Photo" }
```
diff --git a/pipelex/libraries/concept/concept_library.py b/pipelex/libraries/concept/concept_library.py
index 0e40ef885..1ec371cc7 100644
--- a/pipelex/libraries/concept/concept_library.py
+++ b/pipelex/libraries/concept/concept_library.py
@@ -5,7 +5,7 @@ from pipelex.core.concepts.concept import Concept
from pipelex.core.concepts.concept_factory import ConceptFactory
from pipelex.core.concepts.exceptions import ConceptLibraryConceptNotFoundError, ConceptStringError
from pipelex.core.concepts.native.concept_native import NativeConceptCode
-from pipelex.core.concepts.validation import is_concept_string_valid, validate_concept_string_or_code
+from pipelex.core.concepts.validation import is_concept_ref_valid, validate_concept_ref_or_code
from pipelex.core.domains.domain import SpecialDomain
from pipelex.libraries.concept.concept_library_abstract import ConceptLibraryAbstract
from pipelex.libraries.concept.exceptions import ConceptLibraryError
@@ -59,15 +59,15 @@ class ConceptLibrary(RootModel[ConceptLibraryRoot], ConceptLibraryAbstract):
return list(self.root.values())
@override
- def list_concepts_by_domain(self, domain: str) -> list[Concept]:
- return [concept for key, concept in self.root.items() if key.startswith(f"{domain}.")]
+ def list_concepts_by_domain(self, domain_code: str) -> list[Concept]:
+ return [concept for key, concept in self.root.items() if key.startswith(f"{domain_code}.")]
@override
def add_new_concept(self, concept: Concept):
- if concept.concept_string in self.root:
- msg = f"Concept '{concept.concept_string}' already exists in the library"
+ if concept.concept_ref in self.root:
+ msg = f"Concept '{concept.concept_ref}' already exists in the library"
raise ConceptLibraryError(msg)
- self.root[concept.concept_string] = concept
+ self.root[concept.concept_ref] = concept
@override
def add_concepts(self, concepts: list[Concept]):
@@ -75,30 +75,30 @@ class ConceptLibrary(RootModel[ConceptLibraryRoot], ConceptLibraryAbstract):
self.add_new_concept(concept=concept)
@override
- def remove_concepts_by_concept_strings(self, concept_strings: list[str]) -> None:
- for concept_string in concept_strings:
- if concept_string in self.root:
- del self.root[concept_string]
+ def remove_concepts_by_concept_refs(self, concept_refs: list[str]) -> None:
+ for concept_ref in concept_refs:
+ if concept_ref in self.root:
+ del self.root[concept_ref]
@override
def is_compatible(self, tested_concept: Concept, wanted_concept: Concept, strict: bool = False) -> bool:
return Concept.are_concept_compatible(concept_1=tested_concept, concept_2=wanted_concept, strict=strict)
- def get_optional_concept(self, concept_string: str) -> Concept | None:
- return self.root.get(concept_string)
+ def get_optional_concept(self, concept_ref: str) -> Concept | None:
+ return self.root.get(concept_ref)
@override
- def get_required_concept(self, concept_string: str) -> Concept:
- """`concept_string` can have the domain or not. If it doesn't have the domain, it is assumed to be native.
+ def get_required_concept(self, concept_ref: str) -> Concept:
+ """`concept_ref` can have the domain or not. If it doesn't have the domain, it is assumed to be native.
If it is not native and doesnt have a domain, it should raise an error
"""
- if not is_concept_string_valid(concept_string=concept_string):
- msg = f"Concept string '{concept_string}' is not a valid concept string"
+ if not is_concept_ref_valid(concept_ref=concept_ref):
+ msg = f"Concept string '{concept_ref}' is not a valid concept string"
raise ConceptLibraryError(msg)
- the_concept = self.get_optional_concept(concept_string=concept_string)
+ the_concept = self.get_optional_concept(concept_ref=concept_ref)
if not the_concept:
- msg = f"Concept '{concept_string}' not found in the library"
+ msg = f"Concept '{concept_ref}' not found in the library"
raise ConceptLibraryError(msg)
return the_concept
@@ -115,44 +115,44 @@ class ConceptLibrary(RootModel[ConceptLibraryRoot], ConceptLibraryAbstract):
return [self.get_native_concept(native_concept=native_concept) for native_concept in NativeConceptCode.values_list()]
@override
- def get_required_concept_from_concept_string_or_code(self, concept_string_or_code: str, search_domains: list[str] | None = None) -> Concept:
+ def get_required_concept_from_concept_ref_or_code(self, concept_ref_or_code: str, search_domain_codes: list[str] | None = None) -> Concept:
try:
- validate_concept_string_or_code(concept_string_or_code=concept_string_or_code)
+ validate_concept_ref_or_code(concept_ref_or_code=concept_ref_or_code)
except ConceptStringError as exc:
- msg = f"Could not validate concept string or code '{concept_string_or_code}': {exc}"
+ msg = f"Could not validate concept string or code '{concept_ref_or_code}': {exc}"
raise ConceptLibraryError(msg) from exc
- if NativeConceptCode.is_native_concept_string_or_code(concept_string_or_code=concept_string_or_code):
- native_concept_string = NativeConceptCode.get_validated_native_concept_string(concept_string_or_code=concept_string_or_code)
- return self.get_native_concept(native_concept=NativeConceptCode(native_concept_string.split(".")[1]))
- elif "." in concept_string_or_code:
- return self.get_required_concept(concept_string=concept_string_or_code)
+ if NativeConceptCode.is_native_concept_ref_or_code(concept_ref_or_code=concept_ref_or_code):
+ native_concept_ref = NativeConceptCode.get_validated_native_concept_ref(concept_ref_or_code=concept_ref_or_code)
+ return self.get_native_concept(native_concept=NativeConceptCode(native_concept_ref.split(".")[1]))
+ elif "." in concept_ref_or_code:
+ return self.get_required_concept(concept_ref=concept_ref_or_code)
else:
found_concepts: list[Concept] = []
- if search_domains is None:
+ if search_domain_codes is None:
for concept in self.root.values():
- if concept_string_or_code == concept.code:
+ if concept_ref_or_code == concept.code:
found_concepts.append(concept)
if len(found_concepts) == 0:
- msg = f"Concept '{concept_string_or_code}' not found in the library and no search domains were provided"
+ msg = f"Concept '{concept_ref_or_code}' not found in the library and no search domains were provided"
raise ConceptLibraryConceptNotFoundError(msg)
if len(found_concepts) > 1:
- msg = f"Multiple concepts found for '{concept_string_or_code}': {found_concepts}. Please specify the domain."
+ msg = f"Multiple concepts found for '{concept_ref_or_code}': {found_concepts}. Please specify the domain."
raise ConceptLibraryConceptNotFoundError(msg)
return found_concepts[0]
else:
- for domain in search_domains:
+ for domain_code in search_domain_codes:
if found_concept := self.get_required_concept(
- concept_string=ConceptFactory.make_concept_string_with_domain(domain=domain, concept_code=concept_string_or_code),
+ concept_ref=ConceptFactory.make_concept_ref_with_domain(domain_code=domain_code, concept_code=concept_ref_or_code),
):
found_concepts.append(found_concept)
if len(found_concepts) == 0:
- msg = f"Concept '{concept_string_or_code}' not found in the library and no search domains were provided"
+ msg = f"Concept '{concept_ref_or_code}' not found in the library and no search domains were provided"
raise ConceptLibraryConceptNotFoundError(msg)
if len(found_concepts) > 1:
- msg = f"Multiple concepts found for '{concept_string_or_code}': {found_concepts}. Please specify the domain."
+ msg = f"Multiple concepts found for '{concept_ref_or_code}': {found_concepts}. Please specify the domain."
raise ConceptLibraryConceptNotFoundError(msg)
return found_concepts[0]
- def is_concept_exists(self, concept_string: str) -> bool:
- return concept_string in self.root
+ def is_concept_exists(self, concept_ref: str) -> bool:
+ return concept_ref in self.root
diff --git a/pipelex/libraries/concept/concept_library_abstract.py b/pipelex/libraries/concept/concept_library_abstract.py
index 9ad5b7101..0f1d2f942 100644
--- a/pipelex/libraries/concept/concept_library_abstract.py
+++ b/pipelex/libraries/concept/concept_library_abstract.py
@@ -14,11 +14,11 @@ class ConceptLibraryAbstract(ABC):
pass
@abstractmethod
- def remove_concepts_by_concept_strings(self, concept_strings: list[str]) -> None:
+ def remove_concepts_by_concept_refs(self, concept_refs: list[str]) -> None:
pass
@abstractmethod
- def list_concepts_by_domain(self, domain: str) -> list[Concept]:
+ def list_concepts_by_domain(self, domain_code: str) -> list[Concept]:
pass
@abstractmethod
@@ -26,7 +26,7 @@ class ConceptLibraryAbstract(ABC):
pass
@abstractmethod
- def get_required_concept(self, concept_string: str) -> Concept:
+ def get_required_concept(self, concept_ref: str) -> Concept:
pass
@abstractmethod
@@ -50,5 +50,5 @@ class ConceptLibraryAbstract(ABC):
pass
@abstractmethod
- def get_required_concept_from_concept_string_or_code(self, concept_string_or_code: str, search_domains: list[str] | None = None) -> Concept:
+ def get_required_concept_from_concept_ref_or_code(self, concept_ref_or_code: str, search_domain_codes: list[str] | None = None) -> Concept:
pass
diff --git a/pipelex/libraries/domain/domain_library.py b/pipelex/libraries/domain/domain_library.py
index aaad77bad..a1c74d583 100644
--- a/pipelex/libraries/domain/domain_library.py
+++ b/pipelex/libraries/domain/domain_library.py
@@ -26,8 +26,8 @@ class DomainLibrary(RootModel[DomainLibraryRoot], DomainLibraryAbstract):
return cls(root={})
@override
- def get_domain(self, domain: str) -> Domain | None:
- return self.root.get(domain)
+ def get_domain(self, domain_code: str) -> Domain | None:
+ return self.root.get(domain_code)
def add_domain(self, domain: Domain):
domain_code = domain.code
@@ -47,10 +47,10 @@ class DomainLibrary(RootModel[DomainLibraryRoot], DomainLibraryAbstract):
del self.root[domain_code]
@override
- def get_required_domain(self, domain: str) -> Domain:
+ def get_required_domain(self, domain_code: str) -> Domain:
"""Get a domain by code from this library, raising an error if not found."""
- the_domain = self.get_domain(domain=domain)
+ the_domain = self.get_domain(domain_code=domain_code)
if not the_domain:
- msg = f"Domain '{domain}' not found. Check for typos and make sure it is declared in a pipeline library."
+ msg = f"Domain '{domain_code}' not found. Check for typos and make sure it is declared in a pipeline library."
raise DomainLibraryError(msg)
return the_domain
diff --git a/pipelex/libraries/domain/domain_library_abstract.py b/pipelex/libraries/domain/domain_library_abstract.py
index 4102b4605..63fe18575 100644
--- a/pipelex/libraries/domain/domain_library_abstract.py
+++ b/pipelex/libraries/domain/domain_library_abstract.py
@@ -5,11 +5,11 @@ from pipelex.core.domains.domain import Domain
class DomainLibraryAbstract(ABC):
@abstractmethod
- def get_domain(self, domain: str) -> Domain | None:
+ def get_domain(self, domain_code: str) -> Domain | None:
"""Get a domain by code from this library."""
@abstractmethod
- def get_required_domain(self, domain: str) -> Domain:
+ def get_required_domain(self, domain_code: str) -> Domain:
"""Get a domain by code from this library, raising an error if not found."""
@abstractmethod
diff --git a/pipelex/libraries/library.py b/pipelex/libraries/library.py
index 870d6bbbf..a2a084418 100644
--- a/pipelex/libraries/library.py
+++ b/pipelex/libraries/library.py
@@ -51,10 +51,10 @@ class Library(BaseModel):
# TODO: Make this non mandatory in production, or a test
for concept in pipe.concept_dependencies:
try:
- self.concept_library.is_concept_exists(concept_string=concept.concept_string)
+ self.concept_library.is_concept_exists(concept_ref=concept.concept_ref)
except ConceptLibraryError as concept_error:
msg = (
- f"INTERNAL ERROR: Pipe '{pipe.code}' references concept '{concept.concept_string}' "
+ f"INTERNAL ERROR: Pipe '{pipe.code}' references concept '{concept.concept_ref}' "
f"which doesn't exist in the concept library. This should be impossible as concepts are "
f"validated during pipe construction (via get_required_concept() in pipe factories). "
f"This indicates a bug in the system. Original error: {concept_error}"
diff --git a/pipelex/libraries/library_manager.py b/pipelex/libraries/library_manager.py
index afc91753d..71be444dd 100644
--- a/pipelex/libraries/library_manager.py
+++ b/pipelex/libraries/library_manager.py
@@ -204,7 +204,7 @@ class LibraryManager(LibraryManagerAbstract):
concepts: list[Concept] = []
for concept_code, concept_blueprint in blueprint.concept.items():
concept = ConceptFactory.make_from_blueprint(
- domain=blueprint.domain,
+ domain_code=blueprint.domain,
concept_code=concept_code,
blueprint_or_string_description=concept_blueprint,
)
@@ -275,10 +275,10 @@ class LibraryManager(LibraryManagerAbstract):
library = self.get_current_library()
if blueprint.concept is not None:
concept_codes_to_remove = [
- ConceptFactory.make_concept_string_with_domain(domain=blueprint.domain, concept_code=concept_code)
+ ConceptFactory.make_concept_ref_with_domain(domain_code=blueprint.domain, concept_code=concept_code)
for concept_code in blueprint.concept
]
- library.concept_library.remove_concepts_by_concept_strings(concept_strings=concept_codes_to_remove)
+ library.concept_library.remove_concepts_by_concept_refs(concept_refs=concept_codes_to_remove)
@override
def _remove_from_blueprint(self, library_id: str, blueprint: PipelexBundleBlueprint) -> None:
diff --git a/pipelex/libraries/pipe/pipe_library.py b/pipelex/libraries/pipe/pipe_library.py
index c0f75cbe9..de6ea2b75 100644
--- a/pipelex/libraries/pipe/pipe_library.py
+++ b/pipelex/libraries/pipe/pipe_library.py
@@ -93,15 +93,15 @@ class PipeLibrary(RootModel[PipeLibraryRoot], PipeLibraryAbstract):
pipes = self.get_pipes()
# Sort pipes by domain and code
- ordered_items = sorted(pipes, key=lambda pipe: (pipe.domain or "", pipe.code or ""))
+ ordered_items = sorted(pipes, key=lambda pipe: (pipe.domain_code or "", pipe.code or ""))
# Create dictionary for return value
pipes_dict: dict[str, dict[str, dict[str, str]]] = {}
# Group by domain and create separate tables
- for domain, domain_pipes in groupby(ordered_items, key=lambda pipe: pipe.domain):
+ for domain_code, domain_pipes in groupby(ordered_items, key=lambda pipe: pipe.domain_code):
table = Table(
- title=f"[bold magenta]domain = {domain}[/]",
+ title=f"[bold magenta]domain = {domain_code}[/]",
show_header=True,
show_lines=True,
header_style="bold cyan",
@@ -114,13 +114,13 @@ class PipeLibrary(RootModel[PipeLibraryRoot], PipeLibraryAbstract):
table.add_column("Input", style="yellow")
table.add_column("Output", style="yellow")
- pipes_dict[domain] = {}
+ pipes_dict[domain_code] = {}
for pipe in domain_pipes:
inputs = pipe.inputs
- formatted_inputs = [f"{name}: {_format_concept_code(stuff_spec.concept.code, domain)}" for name, stuff_spec in inputs.items]
+ formatted_inputs = [f"{name}: {_format_concept_code(stuff_spec.concept.code, domain_code)}" for name, stuff_spec in inputs.items]
formatted_inputs_str = ", ".join(formatted_inputs)
- output_code = _format_concept_code(pipe.output.concept.code, domain)
+ output_code = _format_concept_code(pipe.output.concept.code, domain_code)
table.add_row(
pipe.code,
@@ -129,7 +129,7 @@ class PipeLibrary(RootModel[PipeLibraryRoot], PipeLibraryAbstract):
output_code,
)
- pipes_dict[domain][pipe.code] = {
+ pipes_dict[domain_code][pipe.code] = {
"description": pipe.description or "",
"inputs": formatted_inputs_str,
"output": pipe.output.concept.code,
diff --git a/pipelex/pipe_controllers/batch/pipe_batch_factory.py b/pipelex/pipe_controllers/batch/pipe_batch_factory.py
index 28fb8b7e2..a727b9a51 100644
--- a/pipelex/pipe_controllers/batch/pipe_batch_factory.py
+++ b/pipelex/pipe_controllers/batch/pipe_batch_factory.py
@@ -29,7 +29,7 @@ class PipeBatchFactory(PipeFactoryProtocol[PipeBatchBlueprint, PipeBatch]):
input_item_name=blueprint.input_item_name,
)
return PipeBatch(
- domain=domain_code,
+ domain_code=domain_code,
code=pipe_code,
description=description,
inputs=inputs,
diff --git a/pipelex/pipe_controllers/condition/pipe_condition.py b/pipelex/pipe_controllers/condition/pipe_condition.py
index 512ec2169..018d47598 100644
--- a/pipelex/pipe_controllers/condition/pipe_condition.py
+++ b/pipelex/pipe_controllers/condition/pipe_condition.py
@@ -130,22 +130,22 @@ class PipeCondition(PipeController):
"""
for pipe_code in self.mapped_pipe_codes:
pipe = get_required_pipe(pipe_code=pipe_code)
- if self.output.concept.concept_string not in {
- pipe.output.concept.concept_string,
- NativeConceptCode.DYNAMIC.concept_string,
- NativeConceptCode.ANYTHING.concept_string,
+ if self.output.concept.concept_ref not in {
+ pipe.output.concept.concept_ref,
+ NativeConceptCode.DYNAMIC.concept_ref,
+ NativeConceptCode.ANYTHING.concept_ref,
}:
msg = (
- f"The output concept code '{self.output.concept.concept_string}' of the pipe '{self.code}' is not "
- f"matching the output concept code '{pipe.output.concept.concept_string}' of the pipe '{pipe_code}'"
+ f"The output concept code '{self.output.concept.concept_ref}' of the pipe '{self.code}' is not "
+ f"matching the output concept code '{pipe.output.concept.concept_ref}' of the pipe '{pipe_code}'"
)
raise PipeValidationError(
message=msg,
error_type=PipeValidationErrorType.INADEQUATE_OUTPUT_CONCEPT,
- domain=self.domain,
+ domain_code=self.domain_code,
pipe_code=self.code,
- provided_concept_code=pipe.output.concept.concept_string,
- required_concept_codes=[self.output.concept.concept_string],
+ provided_concept_code=pipe.output.concept.concept_ref,
+ required_concept_codes=[self.output.concept.concept_ref],
)
# TODO: Restore this validation. The problem lies with needed_inputs that construct Anything concepts.
diff --git a/pipelex/pipe_controllers/condition/pipe_condition_factory.py b/pipelex/pipe_controllers/condition/pipe_condition_factory.py
index 3e562c0bb..0551e50f0 100644
--- a/pipelex/pipe_controllers/condition/pipe_condition_factory.py
+++ b/pipelex/pipe_controllers/condition/pipe_condition_factory.py
@@ -35,7 +35,7 @@ class PipeConditionFactory(PipeFactoryProtocol[PipeConditionBlueprint, PipeCondi
raise PipeConditionFactoryError(msg)
return PipeCondition(
- domain=domain_code,
+ domain_code=domain_code,
code=pipe_code,
description=description,
inputs=inputs,
diff --git a/pipelex/pipe_controllers/parallel/pipe_parallel_blueprint.py b/pipelex/pipe_controllers/parallel/pipe_parallel_blueprint.py
index 9dacf01d1..576277c96 100644
--- a/pipelex/pipe_controllers/parallel/pipe_parallel_blueprint.py
+++ b/pipelex/pipe_controllers/parallel/pipe_parallel_blueprint.py
@@ -3,7 +3,7 @@ from typing import Literal
from pydantic import field_validator, model_validator
from typing_extensions import override
-from pipelex.core.concepts.validation import is_concept_string_or_code_valid
+from pipelex.core.concepts.validation import is_concept_ref_or_code_valid
from pipelex.core.pipes.pipe_blueprint import PipeBlueprint
from pipelex.pipe_controllers.sub_pipe_blueprint import SubPipeBlueprint
from pipelex.types import Self
@@ -26,7 +26,7 @@ class PipeParallelBlueprint(PipeBlueprint):
@classmethod
def validate_combined_output(cls, combined_output: str) -> str:
if combined_output:
- if not is_concept_string_or_code_valid(concept_string_or_code=combined_output):
+ if not is_concept_ref_or_code_valid(concept_ref_or_code=combined_output):
msg = f"Combined output '{combined_output}' is not a valid concept string or code"
raise ValueError(msg)
return combined_output
diff --git a/pipelex/pipe_controllers/parallel/pipe_parallel_factory.py b/pipelex/pipe_controllers/parallel/pipe_parallel_factory.py
index e71951278..993c3e533 100644
--- a/pipelex/pipe_controllers/parallel/pipe_parallel_factory.py
+++ b/pipelex/pipe_controllers/parallel/pipe_parallel_factory.py
@@ -48,13 +48,13 @@ class PipeParallelFactory(PipeFactoryProtocol[PipeParallelBlueprint, PipeParalle
# Handle combined_output if specified
if blueprint.combined_output:
- combined_output_domain_and_code = ConceptFactory.make_domain_and_concept_code_from_concept_string_or_code(
- domain=domain_code,
- concept_string_or_code=blueprint.combined_output,
+ combined_output_domain_and_code = ConceptFactory.make_domain_and_concept_code_from_concept_ref_or_code(
+ domain_code=domain_code,
+ concept_ref_or_code=blueprint.combined_output,
)
combined_output = get_required_concept(
- concept_string=ConceptFactory.make_concept_string_with_domain(
- domain=combined_output_domain_and_code.domain,
+ concept_ref=ConceptFactory.make_concept_ref_with_domain(
+ domain_code=combined_output_domain_and_code.domain_code,
concept_code=combined_output_domain_and_code.concept_code,
),
)
@@ -62,7 +62,7 @@ class PipeParallelFactory(PipeFactoryProtocol[PipeParallelBlueprint, PipeParalle
combined_output = None
return PipeParallel(
- domain=domain_code,
+ domain_code=domain_code,
code=pipe_code,
description=description,
inputs=inputs,
diff --git a/pipelex/pipe_controllers/sequence/pipe_sequence.py b/pipelex/pipe_controllers/sequence/pipe_sequence.py
index 03119325d..3c8d3d410 100644
--- a/pipelex/pipe_controllers/sequence/pipe_sequence.py
+++ b/pipelex/pipe_controllers/sequence/pipe_sequence.py
@@ -61,17 +61,17 @@ class PipeSequence(PipeController):
# Check concept compatibility
if not get_concept_library().is_compatible(tested_concept=last_step_pipe.output.concept, wanted_concept=self.output.concept):
msg = (
- f"PipeSequence concept mismatch: the output concept '{last_step_pipe.output.concept.concept_string}' "
+ f"PipeSequence concept mismatch: the output concept '{last_step_pipe.output.concept.concept_ref}' "
f"of the last step '{last_step_pipe.code}' of sequence pipe '{self.code}' "
- f"is not compatible with the output concept '{self.output.concept.concept_string}' of the sequence."
+ f"is not compatible with the output concept '{self.output.concept.concept_ref}' of the sequence."
)
raise PipeValidationError(
message=msg,
error_type=PipeValidationErrorType.INADEQUATE_OUTPUT_CONCEPT,
- domain=self.domain,
+ domain_code=self.domain_code,
pipe_code=self.code,
- provided_concept_code=last_step_pipe.output.concept.concept_string,
- required_concept_codes=[self.output.concept.concept_string],
+ provided_concept_code=last_step_pipe.output.concept.concept_ref,
+ required_concept_codes=[self.output.concept.concept_ref],
)
last_sub_pipe = self.sequential_sub_pipes[-1]
@@ -92,10 +92,10 @@ class PipeSequence(PipeController):
raise PipeValidationError(
message=msg,
error_type=PipeValidationErrorType.INADEQUATE_OUTPUT_MULTIPLICITY,
- domain=self.domain,
+ domain_code=self.domain_code,
pipe_code=self.code,
- provided_concept_code=last_step_pipe.output.concept.concept_string,
- required_concept_codes=[self.output.concept.concept_string],
+ provided_concept_code=last_step_pipe.output.concept.concept_ref,
+ required_concept_codes=[self.output.concept.concept_ref],
)
@override
@@ -204,14 +204,14 @@ class PipeSequence(PipeController):
# Verify the output of this pipe is matching the output of the last step.
concept_of_last_step = get_required_pipe(pipe_code=self.sequential_sub_pipes[-1].pipe_code).output.concept
- # if self.output.concept_string != concept_string_of_last_step:
+ # if self.output.concept_ref != concept_ref_of_last_step:
if not get_concept_library().is_compatible(tested_concept=concept_of_last_step, wanted_concept=self.output.concept):
msg = f"""PipeSequence concept mismatch:
-the output concept '{concept_of_last_step.concept_string}' of the last step '{self.sequential_sub_pipes[-1].pipe_code}'
-of sequence pipe '{self.code}' is not compatible with the output concept '{self.output.concept.concept_string}' of the sequence.
+the output concept '{concept_of_last_step.concept_ref}' of the last step '{self.sequential_sub_pipes[-1].pipe_code}'
+of sequence pipe '{self.code}' is not compatible with the output concept '{self.output.concept.concept_ref}' of the sequence.
"""
raise PipeControllerOutputConceptMismatchError(
- message=msg, tested_concept=concept_of_last_step.concept_string, wanted_concept=self.output.concept.concept_string
+ message=msg, tested_concept=concept_of_last_step.concept_ref, wanted_concept=self.output.concept.concept_ref
)
return await self._run_controller_pipe(
job_metadata=job_metadata,
diff --git a/pipelex/pipe_controllers/sequence/pipe_sequence_factory.py b/pipelex/pipe_controllers/sequence/pipe_sequence_factory.py
index 006823071..0745703cb 100644
--- a/pipelex/pipe_controllers/sequence/pipe_sequence_factory.py
+++ b/pipelex/pipe_controllers/sequence/pipe_sequence_factory.py
@@ -34,7 +34,7 @@ class PipeSequenceFactory(PipeFactoryProtocol[PipeSequenceBlueprint, PipeSequenc
sequential_sub_pipes.append(sub_pipe)
return PipeSequence(
- domain=domain_code,
+ domain_code=domain_code,
code=pipe_code,
description=description,
inputs=inputs,
diff --git a/pipelex/pipe_controllers/sub_pipe.py b/pipelex/pipe_controllers/sub_pipe.py
index 5164a7add..f11d3d0a9 100644
--- a/pipelex/pipe_controllers/sub_pipe.py
+++ b/pipelex/pipe_controllers/sub_pipe.py
@@ -76,13 +76,13 @@ class SubPipe(BaseModel):
input_list_name=batch_params.input_list_stuff_name,
input_item_name=batch_params.input_item_stuff_name,
inputs={
- batch_params.input_list_stuff_name: item_stuff_spec.concept.concept_string,
+ batch_params.input_list_stuff_name: item_stuff_spec.concept.concept_ref,
},
)
pipe_batch_adhoc_pipe_code = f"{self.pipe_code}_adhoc_batch"
pipe_batch = PipeFactory[PipeBatch].make_from_blueprint(
- domain_code=sub_pipe.domain,
+ domain_code=sub_pipe.domain_code,
pipe_code=pipe_batch_adhoc_pipe_code,
blueprint=pipe_batch_blueprint,
concept_codes_from_the_same_domain=[concept.code for concept in sub_pipe.concept_dependencies],
diff --git a/pipelex/pipe_operators/compose/pipe_compose.py b/pipelex/pipe_operators/compose/pipe_compose.py
index 12ad7a099..52ccb4fbd 100644
--- a/pipelex/pipe_operators/compose/pipe_compose.py
+++ b/pipelex/pipe_operators/compose/pipe_compose.py
@@ -89,16 +89,16 @@ class PipeCompose(PipeOperator[PipeComposeOutput]):
):
msg = (
f"The output of a PipeCompose must be strictly compatible with the Text concept. "
- f"In the pipe '{self.code}' the output is '{self.output.concept.concept_string}'. "
+ f"In the pipe '{self.code}' the output is '{self.output.concept.concept_ref}'. "
"Make sure this concept refines the native Text concept."
)
raise PipeValidationError(
message=msg,
error_type=PipeValidationErrorType.INADEQUATE_OUTPUT_CONCEPT,
- domain=self.domain,
+ domain_code=self.domain_code,
pipe_code=self.code,
- provided_concept_code=self.output.concept.concept_string,
- required_concept_codes=[NativeConceptCode.TEXT.concept_string],
+ provided_concept_code=self.output.concept.concept_ref,
+ required_concept_codes=[NativeConceptCode.TEXT.concept_ref],
)
@override
diff --git a/pipelex/pipe_operators/compose/pipe_compose_factory.py b/pipelex/pipe_operators/compose/pipe_compose_factory.py
index caeb51558..23a424cfb 100644
--- a/pipelex/pipe_operators/compose/pipe_compose_factory.py
+++ b/pipelex/pipe_operators/compose/pipe_compose_factory.py
@@ -38,7 +38,7 @@ class PipeComposeFactory(PipeFactoryProtocol[PipeComposeBlueprint, PipeCompose])
raise PipeComposeFactoryError(msg) from exc
return PipeCompose(
- domain=domain_code,
+ domain_code=domain_code,
code=pipe_code,
description=description,
inputs=inputs,
diff --git a/pipelex/pipe_operators/extract/pipe_extract.py b/pipelex/pipe_operators/extract/pipe_extract.py
index 9b7d60fb4..170c10b70 100644
--- a/pipelex/pipe_operators/extract/pipe_extract.py
+++ b/pipelex/pipe_operators/extract/pipe_extract.py
@@ -85,14 +85,14 @@ class PipeExtract(PipeOperator[PipeExtractOutput]):
@override
def validate_output_with_library(self):
if self.output.concept != get_native_concept(native_concept=NativeConceptCode.PAGE):
- msg = f"PipeExtract output should be a Page concept, but is {self.output.concept.concept_string}"
+ msg = f"PipeExtract output should be a Page concept, but is {self.output.concept.concept_ref}"
raise PipeValidationError(
message=msg,
error_type=PipeValidationErrorType.INADEQUATE_OUTPUT_CONCEPT,
- domain=self.domain,
+ domain_code=self.domain_code,
pipe_code=self.code,
- provided_concept_code=self.output.concept.concept_string,
- required_concept_codes=[NativeConceptCode.PAGE.concept_string],
+ provided_concept_code=self.output.concept.concept_ref,
+ required_concept_codes=[NativeConceptCode.PAGE.concept_ref],
)
@override
diff --git a/pipelex/pipe_operators/extract/pipe_extract_factory.py b/pipelex/pipe_operators/extract/pipe_extract_factory.py
index 72b76b421..db28a3c69 100644
--- a/pipelex/pipe_operators/extract/pipe_extract_factory.py
+++ b/pipelex/pipe_operators/extract/pipe_extract_factory.py
@@ -49,16 +49,16 @@ class PipeExtractFactory(PipeFactoryProtocol[PipeExtractBlueprint, PipeExtract])
pdf_stuff_name = input_name
else:
msg = (
- f"The input concept {input_requirement.concept.concept_string} is not compatible "
- f"with the required concept {get_native_concept(native_concept=NativeConceptCode.IMAGE).concept_string} or "
- f"{get_native_concept(native_concept=NativeConceptCode.PDF).concept_string}"
+ f"The input concept {input_requirement.concept.concept_ref} is not compatible "
+ f"with the required concept {get_native_concept(native_concept=NativeConceptCode.IMAGE).concept_ref} or "
+ f"{get_native_concept(native_concept=NativeConceptCode.PDF).concept_ref}"
)
raise PipeExtractFactoryError(msg)
page_views_dpi = blueprint.page_views_dpi or get_config().cogt.extract_config.default_page_views_dpi
return PipeExtract(
- domain=domain_code,
+ domain_code=domain_code,
code=pipe_code,
description=description,
output=output,
diff --git a/pipelex/pipe_operators/func/pipe_func.py b/pipelex/pipe_operators/func/pipe_func.py
index c6fc7abca..ed65b4dab 100644
--- a/pipelex/pipe_operators/func/pipe_func.py
+++ b/pipelex/pipe_operators/func/pipe_func.py
@@ -156,7 +156,7 @@ class PipeFunc(PipeOperator[PipeFuncOutput]):
variable_name="mock_output",
concept=ConceptFactory.make(
concept_code=self.output.concept.code,
- domain="generic",
+ domain_code="generic",
description="Lorem Ipsum",
structure_class_name=self.output.concept.structure_class_name,
),
diff --git a/pipelex/pipe_operators/func/pipe_func_factory.py b/pipelex/pipe_operators/func/pipe_func_factory.py
index 00c50d178..1f2f37deb 100644
--- a/pipelex/pipe_operators/func/pipe_func_factory.py
+++ b/pipelex/pipe_operators/func/pipe_func_factory.py
@@ -25,7 +25,7 @@ class PipeFuncFactory(PipeFactoryProtocol[PipeFuncBlueprint, PipeFunc]):
) -> PipeFunc:
# TODO: make function_name into a callable in PipeFunc
return PipeFunc(
- domain=domain_code,
+ domain_code=domain_code,
code=pipe_code,
description=description,
inputs=inputs,
diff --git a/pipelex/pipe_operators/img_gen/pipe_img_gen.py b/pipelex/pipe_operators/img_gen/pipe_img_gen.py
index 43339bd48..1f65309fb 100644
--- a/pipelex/pipe_operators/img_gen/pipe_img_gen.py
+++ b/pipelex/pipe_operators/img_gen/pipe_img_gen.py
@@ -87,15 +87,15 @@ class PipeImgGen(PipeOperator[PipeImgGenOutput]):
):
msg = (
f"The output of a PipeImgGen must be compatible with the Image concept. "
- f"In the pipe '{self.code}' the output is '{self.output.concept.concept_string}'"
+ f"In the pipe '{self.code}' the output is '{self.output.concept.concept_ref}'"
)
raise PipeValidationError(
message=msg,
error_type=PipeValidationErrorType.INADEQUATE_OUTPUT_CONCEPT,
- domain=self.domain,
+ domain_code=self.domain_code,
pipe_code=self.code,
- provided_concept_code=self.output.concept.concept_string,
- required_concept_codes=[NativeConceptCode.IMAGE.concept_string],
+ provided_concept_code=self.output.concept.concept_ref,
+ required_concept_codes=[NativeConceptCode.IMAGE.concept_ref],
)
@override
diff --git a/pipelex/pipe_operators/img_gen/pipe_img_gen_factory.py b/pipelex/pipe_operators/img_gen/pipe_img_gen_factory.py
index b0ff4b5e7..ce78efa16 100644
--- a/pipelex/pipe_operators/img_gen/pipe_img_gen_factory.py
+++ b/pipelex/pipe_operators/img_gen/pipe_img_gen_factory.py
@@ -38,7 +38,7 @@ class PipeImgGenFactory(PipeFactoryProtocol[PipeImgGenBlueprint, PipeImgGen]):
)
return PipeImgGen(
- domain=domain_code,
+ domain_code=domain_code,
code=pipe_code,
description=description,
inputs=inputs,
diff --git a/pipelex/pipe_operators/llm/llm_prompt_blueprint.py b/pipelex/pipe_operators/llm/llm_prompt_blueprint.py
index 035882cfe..e118eb9ce 100644
--- a/pipelex/pipe_operators/llm/llm_prompt_blueprint.py
+++ b/pipelex/pipe_operators/llm/llm_prompt_blueprint.py
@@ -43,7 +43,7 @@ class LLMPromptBlueprint(BaseModel):
# let's get back to it when we have a better solution for structuring_method
async def make_llm_prompt(
self,
- output_concept_string: str,
+ output_concept_ref: str,
context_provider: ContextProviderAbstract,
output_structure_prompt: str | None = None,
extra_params: dict[str, Any] | None = None,
@@ -125,7 +125,7 @@ class LLMPromptBlueprint(BaseModel):
# Note that output_structure_prompt can be None
# it's OK to have a null user_text
- log.verbose(f"User text with {output_concept_string=}:\n {user_text}")
+ log.verbose(f"User text with {output_concept_ref=}:\n {user_text}")
############################################################
# System text
diff --git a/pipelex/pipe_operators/llm/pipe_llm.py b/pipelex/pipe_operators/llm/pipe_llm.py
index 6741eb036..489929113 100644
--- a/pipelex/pipe_operators/llm/pipe_llm.py
+++ b/pipelex/pipe_operators/llm/pipe_llm.py
@@ -100,14 +100,14 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
):
msg = (
f"The output of the PipeLLM '{self.code}' cannot be compatible with the Image concept. "
- f"The output concept is '{self.output.concept.concept_string}'. "
+ f"The output concept is '{self.output.concept.concept_ref}'. "
"Use a PipeImgGen if you want to generate images. You can use a PipeLLM to generate the prompt for a PipeImgGen."
)
raise PipeValidationError(
message=msg,
error_type=PipeValidationErrorType.LLM_OUTPUT_CANNOT_BE_IMAGE,
pipe_code=self.code,
- provided_concept_code=self.output.concept.concept_string,
+ provided_concept_code=self.output.concept.concept_ref,
)
@override
@@ -146,7 +146,7 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
output_concept_code = SpecialDomain.NATIVE + "." + NativeConceptCode.TEXT
else:
output_stuff_spec.concept = get_required_concept(
- concept_string=ConceptFactory.make_concept_string_with_domain(domain=self.domain, concept_code=output_concept_code),
+ concept_ref=ConceptFactory.make_concept_ref_with_domain(domain_code=self.domain_code, concept_code=output_concept_code),
)
multiplicity_resolution = output_multiplicity_to_apply(
@@ -214,7 +214,7 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
and not is_multiple_output
):
llm_prompt_1_for_text = await self.llm_prompt_spec.make_llm_prompt(
- output_concept_string=output_stuff_spec.concept.concept_string,
+ output_concept_ref=output_stuff_spec.concept.concept_ref,
context_provider=working_memory,
output_structure_prompt=None,
extra_params=llm_prompt_run_params.params,
@@ -273,11 +273,11 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
output_structure_prompt: str | None = None
if llm_config.is_structure_prompt_enabled:
output_structure_prompt = await PipeLLM.get_output_structure_prompt(
- concept_string=pipe_run_params.dynamic_output_concept_code or output_stuff_spec.concept.concept_string,
+ concept_ref=pipe_run_params.dynamic_output_concept_code or output_stuff_spec.concept.concept_ref,
is_with_preliminary_text=is_with_preliminary_text,
)
llm_prompt_1_for_object = await self.llm_prompt_spec.make_llm_prompt(
- output_concept_string=output_stuff_spec.concept.concept_string,
+ output_concept_ref=output_stuff_spec.concept.concept_ref,
context_provider=working_memory,
output_structure_prompt=output_structure_prompt,
extra_params=llm_prompt_run_params.params,
@@ -450,8 +450,8 @@ class PipeLLM(PipeOperator[PipeLLMOutput]):
)
@staticmethod
- async def get_output_structure_prompt(concept_string: str, is_with_preliminary_text: bool) -> str | None:
- concept = get_required_concept(concept_string=concept_string)
+ async def get_output_structure_prompt(concept_ref: str, is_with_preliminary_text: bool) -> str | None:
+ concept = get_required_concept(concept_ref=concept_ref)
output_class = get_class_registry().get_class(concept.structure_class_name)
if not output_class:
return None
diff --git a/pipelex/pipe_operators/llm/pipe_llm_factory.py b/pipelex/pipe_operators/llm/pipe_llm_factory.py
index 4323aa88b..f9b32b53d 100644
--- a/pipelex/pipe_operators/llm/pipe_llm_factory.py
+++ b/pipelex/pipe_operators/llm/pipe_llm_factory.py
@@ -36,7 +36,7 @@ class PipeLLMFactory(PipeFactoryProtocol[PipeLLMBlueprint, PipeLLM]):
blueprint: PipeLLMBlueprint,
) -> PipeLLM:
system_prompt = blueprint.system_prompt
- if not system_prompt and (domain_obj := get_optional_domain(domain=domain_code)):
+ if not system_prompt and (domain_obj := get_optional_domain(domain_code=domain_code)):
system_prompt = domain_obj.system_prompt
system_prompt_jinja2_blueprint: TemplateBlueprint | None = None
@@ -73,13 +73,13 @@ class PipeLLMFactory(PipeFactoryProtocol[PipeLLMBlueprint, PipeLLM]):
# Parse to strip multiplicity brackets
input_parse_result = parse_concept_with_multiplicity(requirement_str)
- domain_and_code = ConceptFactory.make_domain_and_concept_code_from_concept_string_or_code(
- domain=domain_code,
- concept_string_or_code=input_parse_result.concept,
+ domain_and_code = ConceptFactory.make_domain_and_concept_code_from_concept_ref_or_code(
+ domain_code=domain_code,
+ concept_ref_or_code=input_parse_result.concept,
)
concept = get_required_concept(
- concept_string=ConceptFactory.make_concept_string_with_domain(
- domain=domain_and_code.domain,
+ concept_ref=ConceptFactory.make_concept_ref_with_domain(
+ domain_code=domain_and_code.domain_code,
concept_code=domain_and_code.concept_code,
),
)
@@ -114,7 +114,7 @@ class PipeLLMFactory(PipeFactoryProtocol[PipeLLMBlueprint, PipeLLM]):
)
return PipeLLM(
- domain=domain_code,
+ domain_code=domain_code,
code=pipe_code,
description=description,
inputs=inputs,
diff --git a/pipelex/pipeline/execute.py b/pipelex/pipeline/execute.py
index cf39dfa7e..b52c73100 100644
--- a/pipelex/pipeline/execute.py
+++ b/pipelex/pipeline/execute.py
@@ -28,7 +28,7 @@ async def execute_pipeline(
output_multiplicity: VariableMultiplicity | None = None,
dynamic_output_concept_code: str | None = None,
pipe_run_mode: PipeRunMode | None = None,
- search_domains: list[str] | None = None,
+ search_domain_codes: list[str] | None = None,
) -> PipeOutput:
"""Execute a pipeline and wait for its completion.
@@ -68,8 +68,8 @@ async def execute_pipeline(
Pipe run mode: ``PipeRunMode.LIVE`` or ``PipeRunMode.DRY``. If not specified,
inferred from the environment variable ``PIPELEX_FORCE_DRY_RUN_MODE``. Defaults
to ``PipeRunMode.LIVE`` if the environment variable is not set.
- search_domains:
- List of domains to search for pipes. The executed pipe's domain is automatically
+ search_domain_codes:
+ List of domain codes to search for pipes. The executed pipe's domain is automatically
added if not already present.
Returns:
@@ -88,7 +88,7 @@ async def execute_pipeline(
output_multiplicity=output_multiplicity,
dynamic_output_concept_code=dynamic_output_concept_code,
pipe_run_mode=pipe_run_mode,
- search_domains=search_domains,
+ search_domain_codes=search_domain_codes,
)
properties: dict[EventProperty, Any]
diff --git a/pipelex/pipeline/pipeline_run_setup.py b/pipelex/pipeline/pipeline_run_setup.py
index 988726a30..f5e36a2e6 100644
--- a/pipelex/pipeline/pipeline_run_setup.py
+++ b/pipelex/pipeline/pipeline_run_setup.py
@@ -44,7 +44,7 @@ async def pipeline_run_setup(
output_multiplicity: VariableMultiplicity | None = None,
dynamic_output_concept_code: str | None = None,
pipe_run_mode: PipeRunMode | None = None,
- search_domains: list[str] | None = None,
+ search_domain_codes: list[str] | None = None,
) -> tuple[PipeJob, str, str]:
"""Set up a pipeline for execution.
@@ -85,8 +85,8 @@ async def pipeline_run_setup(
Pipe run mode: ``PipeRunMode.LIVE`` or ``PipeRunMode.DRY``. If not specified,
inferred from the environment variable ``PIPELEX_FORCE_DRY_RUN_MODE``. Defaults
to ``PipeRunMode.LIVE`` if the environment variable is not set.
- search_domains:
- List of domains to search for pipes. The executed pipe's domain is automatically
+ search_domain_codes:
+ List of domain codes to search for pipes. The executed pipe's domain is automatically
added if not already present.
Returns:
@@ -140,9 +140,9 @@ async def pipeline_run_setup(
pipe_code = pipe.code
- search_domains = search_domains or []
- if pipe.domain not in search_domains:
- search_domains.insert(0, pipe.domain)
+ search_domain_codes = search_domain_codes or []
+ if pipe.domain_code not in search_domain_codes:
+ search_domain_codes.insert(0, pipe.domain_code)
working_memory: WorkingMemory | None = None
@@ -152,7 +152,7 @@ async def pipeline_run_setup(
else:
working_memory = WorkingMemoryFactory.make_from_pipeline_inputs(
pipeline_inputs=inputs,
- search_domains=search_domains,
+ search_domain_codes=search_domain_codes,
)
if pipe_run_mode is None:
diff --git a/pipelex/pipeline/start.py b/pipelex/pipeline/start.py
index 044d35d92..5a2662918 100644
--- a/pipelex/pipeline/start.py
+++ b/pipelex/pipeline/start.py
@@ -19,7 +19,7 @@ async def start_pipeline(
output_multiplicity: VariableMultiplicity | None = None,
dynamic_output_concept_code: str | None = None,
pipe_run_mode: PipeRunMode | None = None,
- search_domains: list[str] | None = None,
+ search_domain_codes: list[str] | None = None,
) -> tuple[str, asyncio.Task[PipeOutput]]:
"""Start a pipeline in the background.
@@ -61,8 +61,8 @@ async def start_pipeline(
Pipe run mode: ``PipeRunMode.LIVE`` or ``PipeRunMode.DRY``. If not specified,
inferred from the environment variable ``PIPELEX_FORCE_DRY_RUN_MODE``. Defaults
to ``PipeRunMode.LIVE`` if the environment variable is not set.
- search_domains:
- List of domains to search for pipes. The executed pipe's domain is automatically
+ search_domain_codes:
+ List of domain codes to search for pipes. The executed pipe's domain is automatically
added if not already present.
Returns:
@@ -82,7 +82,7 @@ async def start_pipeline(
output_multiplicity=output_multiplicity,
dynamic_output_concept_code=dynamic_output_concept_code,
pipe_run_mode=pipe_run_mode,
- search_domains=search_domains,
+ search_domain_codes=search_domain_codes,
)
task: asyncio.Task[PipeOutput] = asyncio.create_task(get_pipe_router().run(pipe_job))
diff --git a/pipelex/system/telemetry/otel_factory.py b/pipelex/system/telemetry/otel_factory.py
index 0713e90c1..2acf5535c 100644
--- a/pipelex/system/telemetry/otel_factory.py
+++ b/pipelex/system/telemetry/otel_factory.py
@@ -81,7 +81,7 @@ class OtelFactory:
for input_name in needed_input_names:
stuff = working_memory.get_stuff(name=input_name)
inputs_dict[input_name] = {
- "concept": stuff.concept.simple_concept_string,
+ "concept": stuff.concept.simple_concept_ref,
"content": stuff.content.smart_dump(),
}
@@ -108,7 +108,7 @@ class OtelFactory:
return "{}"
output_dict: dict[str, Any] = {
- "concept": main_stuff.concept.simple_concept_string,
+ "concept": main_stuff.concept.simple_concept_ref,
"content": main_stuff.content.smart_dump(),
}
diff --git a/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_1.py b/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_1.py
index 12db4b601..a61ca1b57 100644
--- a/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_1.py
+++ b/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_1.py
@@ -37,7 +37,7 @@ class TestPipeConditionExpressionTemplate:
stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="CategoryInput",
- domain="test_pipe_condition",
+ domain_code="test_pipe_condition",
description="test_pipe_condition.CategoryInput",
structure_class_name="CategoryInput",
),
diff --git a/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_2.py b/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_2.py
index f799de0cc..f9043a64e 100644
--- a/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_2.py
+++ b/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_2.py
@@ -37,7 +37,7 @@ class TestPipeConditionExpression:
stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="CategoryInput",
- domain="test_pipe_condition",
+ domain_code="test_pipe_condition",
description="test_pipe_condition.CategoryInput",
structure_class_name="CategoryInput",
),
diff --git a/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_simple.py b/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_simple.py
index c9ab487c7..92da2f747 100644
--- a/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_simple.py
+++ b/tests/e2e/pipelex/pipes/pipe_controller/pipe_condition/test_pipe_condition_simple.py
@@ -85,7 +85,7 @@ class TestPipeConditionSimple:
variable_name="user_status",
concept=ConceptFactory.make(
concept_code="CategoryInput",
- domain="test_pipe_condition",
+ domain_code="test_pipe_condition",
description="CategoryInput",
structure_class_name="CategoryInput",
),
diff --git a/tests/e2e/pipelex/pipes/pipe_controller/pipe_parallel/test_pipe_parallel_1.py b/tests/e2e/pipelex/pipes/pipe_controller/pipe_parallel/test_pipe_parallel_1.py
index 8385bd50b..9f13140df 100644
--- a/tests/e2e/pipelex/pipes/pipe_controller/pipe_parallel/test_pipe_parallel_1.py
+++ b/tests/e2e/pipelex/pipes/pipe_controller/pipe_parallel/test_pipe_parallel_1.py
@@ -41,7 +41,7 @@ class TestPipeParallelDocumentAnalysis:
stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="DocumentInput",
- domain="test_pipe_parallel",
+ domain_code="test_pipe_parallel",
description="test_pipe_parallel.DocumentInput",
structure_class_name="DocumentInput",
),
diff --git a/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_batching.py b/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_batching.py
index 018a44e47..4d5c32c02 100644
--- a/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_batching.py
+++ b/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_batching.py
@@ -32,7 +32,7 @@ async def test_review_analysis_sequence_with_batching(pipe_run_mode: PipeRunMode
variable_name="document",
concept=ConceptFactory.make(
concept_code="Document",
- domain="customer_feedback",
+ domain_code="customer_feedback",
description="Lorem ipsum",
structure_class_name="Document",
),
@@ -51,7 +51,7 @@ async def test_review_analysis_sequence_with_batching(pipe_run_mode: PipeRunMode
name="document",
concept=ConceptFactory.make(
concept_code="Document",
- domain="customer_feedback",
+ domain_code="customer_feedback",
description="customer_feedback.Document",
structure_class_name="Document",
),
@@ -75,7 +75,7 @@ async def test_review_analysis_sequence_with_batching(pipe_run_mode: PipeRunMode
assert pipe_output.working_memory is not None
assert pipe_output.main_stuff is not None
assert pipe_output.main_stuff.concept.code == "ProductRating"
- assert pipe_output.main_stuff.concept.domain == "customer_feedback"
+ assert pipe_output.main_stuff.concept.domain_code == "customer_feedback"
# Log the working memory for debugging
log.verbose("Final working memory after pipeline execution:")
diff --git a/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_multiplicity.py b/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_multiplicity.py
index 220e31750..c01f19603 100644
--- a/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_multiplicity.py
+++ b/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_multiplicity.py
@@ -22,7 +22,7 @@ class TestPipeSequenceMultiplicity:
name="topic",
concept=ConceptFactory.make(
concept_code="CreativeTopic",
- domain="creative_ideation",
+ domain_code="creative_ideation",
description="creative_ideation.CreativeTopic",
structure_class_name="CreativeTopic",
),
@@ -44,4 +44,4 @@ class TestPipeSequenceMultiplicity:
assert pipe_output.working_memory is not None
assert pipe_output.main_stuff is not None
assert pipe_output.main_stuff.concept.code == "BestIdea"
- assert pipe_output.main_stuff.concept.domain == "creative_ideation"
+ assert pipe_output.main_stuff.concept.domain_code == "creative_ideation"
diff --git a/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_simple.py b/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_simple.py
index 6435942f9..ebe4cb5a5 100644
--- a/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_simple.py
+++ b/tests/e2e/pipelex/pipes/pipe_controller/pipe_sequence/test_pipe_sequence_simple.py
@@ -28,7 +28,7 @@ class TestPipeSequenceSimple:
name="raw_text",
concept=ConceptFactory.make(
concept_code="RawText",
- domain="simple_text_processing",
+ domain_code="simple_text_processing",
description="simple_text_processing.RawText",
structure_class_name="TextContent",
),
@@ -50,4 +50,4 @@ class TestPipeSequenceSimple:
assert pipe_output.working_memory is not None
assert pipe_output.main_stuff is not None
assert pipe_output.main_stuff.concept.code == "SummaryText"
- assert pipe_output.main_stuff.concept.domain == "simple_text_processing"
+ assert pipe_output.main_stuff.concept.domain_code == "simple_text_processing"
diff --git a/tests/integration/pipelex/client/test_client.py b/tests/integration/pipelex/client/test_client.py
index fb66cb352..110cfaa30 100644
--- a/tests/integration/pipelex/client/test_client.py
+++ b/tests/integration/pipelex/client/test_client.py
@@ -75,7 +75,7 @@ class TestPipelexApiClient:
StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="Question",
- domain="answer",
+ domain_code="answer",
description="answer.Question",
structure_class_name="Question",
),
diff --git a/tests/integration/pipelex/pipes/controller/pipe_batch/test_pipe_batch_simple.py b/tests/integration/pipelex/pipes/controller/pipe_batch/test_pipe_batch_simple.py
index 0b7b5bcbf..3adda78b5 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_batch/test_pipe_batch_simple.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_batch/test_pipe_batch_simple.py
@@ -33,15 +33,15 @@ class TestPipeBatchSimple:
load_test_library: Callable[[list[Path]], None],
):
load_test_library([Path("tests/integration/pipelex/pipes/controller/pipe_batch")])
- domain = "test_integration"
+ domain_code = "test_integration"
concept_1 = ConceptFactory.make_from_blueprint(
concept_code="TestConcept1",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_2 = ConceptFactory.make_from_blueprint(
concept_code="TestConcept2",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_library = get_concept_library()
@@ -51,15 +51,15 @@ class TestPipeBatchSimple:
description="Simple batch processing test",
branch_pipe_code="uppercase_transformer", # This exists in the PLX file
inputs={
- "text_list": concept_1.concept_string,
+ "text_list": concept_1.concept_ref,
},
- output=concept_2.concept_string,
+ output=concept_2.concept_ref,
input_list_name="text_list",
input_item_name="text_item",
)
pipe_batch = PipeFactory[PipeBatch].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="simple_batch",
blueprint=pipe_batch_blueprint,
)
@@ -81,7 +81,7 @@ class TestPipeBatchSimple:
# Verify the PipeBatch instance was created correctly
assert pipe_batch is not None
- assert pipe_batch.domain == domain
+ assert pipe_batch.domain_code == domain_code
assert pipe_batch.code == "simple_batch"
assert pipe_batch.branch_pipe_code == "uppercase_transformer"
assert pipe_batch.batch_params is not None
@@ -145,7 +145,7 @@ class TestPipeBatchSimple:
batch_result = final_working_memory.get_stuff("batch_result")
assert batch_result is not None
assert batch_result.concept.code == concept_2.code
- assert batch_result.concept.domain == domain
+ assert batch_result.concept.domain_code == domain_code
# Verify the batch result content matches exactly
assert isinstance(batch_result.content, ListContent)
diff --git a/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_complex.py b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_complex.py
index a248b04ce..1c3f9299d 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_complex.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_complex.py
@@ -40,7 +40,7 @@ class TestPipeConditionComplex:
doc_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="DocumentRequest",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.DocumentRequest",
structure_class_name="DocumentRequest",
),
@@ -50,7 +50,7 @@ class TestPipeConditionComplex:
user_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="UserProfile",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.UserProfile",
structure_class_name="UserProfile",
),
@@ -89,7 +89,7 @@ class TestPipeConditionComplex:
doc_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="DocumentRequest",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.DocumentRequest",
structure_class_name="DocumentRequest",
),
@@ -99,7 +99,7 @@ class TestPipeConditionComplex:
user_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="UserProfile",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.UserProfile",
structure_class_name="UserProfile",
),
@@ -135,7 +135,7 @@ class TestPipeConditionComplex:
doc_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="DocumentRequest",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.DocumentRequest",
structure_class_name="DocumentRequest",
),
@@ -145,7 +145,7 @@ class TestPipeConditionComplex:
user_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="UserProfile",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.UserProfile",
structure_class_name="UserProfile",
),
@@ -189,7 +189,7 @@ class TestPipeConditionComplex:
doc_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="DocumentRequest",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.DocumentRequest",
structure_class_name="DocumentRequest",
),
@@ -199,7 +199,7 @@ class TestPipeConditionComplex:
user_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="UserProfile",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.UserProfile",
structure_class_name="UserProfile",
),
@@ -236,7 +236,7 @@ class TestPipeConditionComplex:
doc_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="DocumentRequest",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.DocumentRequest",
structure_class_name="DocumentRequest",
),
@@ -246,7 +246,7 @@ class TestPipeConditionComplex:
user_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="UserProfile",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.UserProfile",
structure_class_name="UserProfile",
),
@@ -278,7 +278,7 @@ class TestPipeConditionComplex:
doc_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="DocumentRequest",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.DocumentRequest",
structure_class_name="DocumentRequest",
),
@@ -350,7 +350,7 @@ class TestPipeConditionComplex:
doc_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="DocumentRequest",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.DocumentRequest",
structure_class_name="DocumentRequest",
),
@@ -360,7 +360,7 @@ class TestPipeConditionComplex:
user_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="UserProfile",
- domain="test_pipe_condition_complex",
+ domain_code="test_pipe_condition_complex",
description="test_pipe_condition_complex.UserProfile",
structure_class_name="UserProfile",
),
diff --git a/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_simple.py b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_simple.py
index c58fabc25..a8c5bad0e 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_simple.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_simple.py
@@ -53,7 +53,7 @@ class TestPipeConditionSimple:
working_memory = WorkingMemoryFactory.make_from_single_stuff(input_text_stuff)
- assert pipe_condition.domain == "test_integration"
+ assert pipe_condition.domain_code == "test_integration"
assert pipe_condition.code == "text_length_condition"
assert pipe_condition.outcome_map == {"long": "capitalize_long_text", "short": "add_prefix_short_text"}
@@ -96,7 +96,10 @@ class TestPipeConditionSimple:
assert isinstance(final_result_in_memory.content, TextContent)
if pipe_run_mode != PipeRunMode.DRY:
assert final_result_in_memory.content.text == "LONG: HELLO WORLD"
- assert f"{final_result_in_memory.concept.domain}.{final_result_in_memory.concept.code}" == f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}"
+ assert (
+ f"{final_result_in_memory.concept.domain_code}.{final_result_in_memory.concept.code}"
+ == f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}"
+ )
async def test_condition_short_text_processing(self, pipe_run_mode: PipeRunMode, load_test_library: Callable[[list[Path]], None]):
"""Test PipeCondition with short text that should trigger add_prefix_short_text pipe."""
@@ -167,7 +170,10 @@ class TestPipeConditionSimple:
assert isinstance(final_result_in_memory.content, TextContent)
if pipe_run_mode != PipeRunMode.DRY:
assert final_result_in_memory.content.text == "SHORT: hi"
- assert f"{final_result_in_memory.concept.domain}.{final_result_in_memory.concept.code}" == f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}"
+ assert (
+ f"{final_result_in_memory.concept.domain_code}.{final_result_in_memory.concept.code}"
+ == f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}"
+ )
async def test_condition_dry_run_success(self, load_test_library: Callable[[list[Path]], None]):
"""Test PipeCondition dry run with valid inputs using real pipe - should succeed."""
@@ -177,7 +183,7 @@ class TestPipeConditionSimple:
input_data_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="CategoryInput",
- domain="test_pipe_condition_2",
+ domain_code="test_pipe_condition_2",
description="test_pipe_condition_2.CategoryInput",
structure_class_name="CategoryInput",
),
@@ -252,7 +258,7 @@ class TestPipeConditionSimple:
input_data_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="CategoryInput",
- domain="test_pipe_condition_2",
+ domain_code="test_pipe_condition_2",
description="test_pipe_condition_2.CategoryInput",
structure_class_name="CategoryInput",
),
diff --git a/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_validation.py b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_validation.py
index 1b0db25a2..be1c28fc8 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_validation.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_condition/test_pipe_condition_validation.py
@@ -15,15 +15,15 @@ class TestPipeConditionValidation:
def test_pipe_condition_creation(self, load_test_library: Callable[[list[Path]], None]):
"""Test basic PipeCondition creation"""
load_test_library([Path("tests/integration/pipelex/pipes/controller/pipe_condition")])
- domain = "test_domain"
+ domain_code = "test_domain"
concept_1 = ConceptFactory.make_from_blueprint(
concept_code="TestConcept",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_2 = ConceptFactory.make_from_blueprint(
concept_code="Result",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_library = get_concept_library()
@@ -31,21 +31,21 @@ class TestPipeConditionValidation:
pipe_condition_blueprint = PipeConditionBlueprint(
description="Test condition for validation",
- inputs={"input_var": concept_1.concept_string},
- output=concept_2.concept_string,
+ inputs={"input_var": concept_1.concept_ref},
+ output=concept_2.concept_ref,
expression="input_var",
outcomes={"value1": "pipe_a", "value2": "pipe_b"},
default_outcome="default_pipe",
)
pipe_condition = PipeFactory[PipeCondition].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="test_condition",
blueprint=pipe_condition_blueprint,
)
assert pipe_condition.code == "test_condition"
- assert pipe_condition.domain == domain
+ assert pipe_condition.domain_code == domain_code
assert len(pipe_condition.outcome_map) == 2
assert pipe_condition.expression == "{{ input_var }}"
assert pipe_condition.default_outcome == "default_pipe"
@@ -56,31 +56,31 @@ class TestPipeConditionValidation:
"""Test that both expression_template and expression formats work"""
load_test_library([Path("tests/integration/pipelex/pipes/controller/pipe_condition")])
# Test with expression_template
- domain = "test_domain"
+ domain_code = "test_domain"
concept_library = get_concept_library()
concept_1 = ConceptFactory.make_from_blueprint(
concept_code="TestConcept",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_2 = ConceptFactory.make_from_blueprint(
concept_code="Result",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_library.add_concepts([concept_1, concept_2])
pipe_condition_template_blueprint = PipeConditionBlueprint(
description="Test condition with expression template",
- inputs={"var": concept_1.concept_string},
- output=concept_2.concept_string,
+ inputs={"var": concept_1.concept_ref},
+ output=concept_2.concept_ref,
expression_template="{{ var }}",
outcomes={"value": "target_pipe"},
default_outcome=SpecialOutcome.CONTINUE,
)
pipe_condition_template = PipeFactory[PipeCondition].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="test_condition_template",
blueprint=pipe_condition_template_blueprint,
)
@@ -88,15 +88,15 @@ class TestPipeConditionValidation:
# Test with expression
pipe_condition_expr_blueprint = PipeConditionBlueprint(
description="Test condition with expression",
- inputs={"var": concept_1.concept_string},
- output=concept_2.concept_string,
+ inputs={"var": concept_1.concept_ref},
+ output=concept_2.concept_ref,
expression="var",
outcomes={"value": "target_pipe"},
default_outcome=SpecialOutcome.CONTINUE,
)
pipe_condition_expr = PipeFactory[PipeCondition].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="test_condition_expr",
blueprint=pipe_condition_expr_blueprint,
)
diff --git a/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_simple.py b/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_simple.py
index 8a4af75b8..b9006bc17 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_simple.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_simple.py
@@ -55,7 +55,7 @@ class TestPipeParallelSimple:
working_memory = WorkingMemoryFactory.make_from_single_stuff(input_text_stuff)
# Verify the PipeParallel instance was created correctly
- assert pipe_parallel.domain == "test_integration"
+ assert pipe_parallel.domain_code == "test_integration"
assert pipe_parallel.code == "parallel_text_analyzer"
assert len(pipe_parallel.parallel_sub_pipes) == 3
assert pipe_parallel.add_each_output is True
@@ -105,7 +105,7 @@ class TestPipeParallelSimple:
# Should return one of: positive, negative, neutral
if pipe_run_mode != PipeRunMode.DRY:
assert sentiment_result.content.text.lower() in {"positive", "negative", "neutral"}
- assert f"{sentiment_result.concept.domain}.{sentiment_result.concept.code}" == f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}"
+ assert f"{sentiment_result.concept.domain_code}.{sentiment_result.concept.code}" == f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}"
# Verify word count result
word_count_result = final_working_memory.get_stuff("word_count_result")
@@ -116,7 +116,7 @@ class TestPipeParallelSimple:
if pipe_run_mode != PipeRunMode.DRY:
assert word_count_text.isdigit() or word_count_text in {"12", "thirteen", "twelve"} # Allow for some variation
assert word_count_result.concept.code == "Text"
- assert word_count_result.concept.domain == "native"
+ assert word_count_result.concept.domain_code == "native"
# Verify keywords extraction result
keywords_result = final_working_memory.get_stuff("keywords_result")
@@ -127,7 +127,7 @@ class TestPipeParallelSimple:
if pipe_run_mode != PipeRunMode.DRY:
assert "," in keywords_text or len(keywords_text.split()) >= 2 # Should have multiple keywords
assert keywords_result.concept.code == "Text"
- assert keywords_result.concept.domain == "native"
+ assert keywords_result.concept.domain_code == "native"
# Verify that all results are different (pipes ran independently)
assert sentiment_result.content.text != word_count_result.content.text
diff --git a/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_validation.py b/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_validation.py
index b7ffbfe07..8b95b8f61 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_validation.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_parallel/test_pipe_parallel_validation.py
@@ -18,21 +18,21 @@ class TestPipeParallelValidation:
def test_pipe_parallel_with_real_pipe_structure(self, load_empty_library: Callable[[], None]):
load_empty_library()
# Create a real PipeLLM that will infer inputs from the prompt template
- domain = "test_domain"
+ domain_code = "test_domain"
concept_library = get_concept_library()
concept_blueprint = ConceptBlueprint(description="A test document")
concept_1 = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code="Document",
blueprint_or_string_description=concept_blueprint,
)
concept_2 = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code="Context",
blueprint_or_string_description=concept_blueprint,
)
concept_3 = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code="Analysis",
blueprint_or_string_description=concept_blueprint,
)
@@ -40,16 +40,16 @@ class TestPipeParallelValidation:
pipe_llm_blueprint = PipeLLMBlueprint(
inputs={
- "document": concept_1.concept_string,
- "context": concept_2.concept_string,
+ "document": concept_1.concept_ref,
+ "context": concept_2.concept_ref,
},
description="Analysis pipe for document processing",
- output=ConceptFactory.make_concept_string_with_domain(domain=domain, concept_code=concept_3.code),
+ output=ConceptFactory.make_concept_ref_with_domain(domain_code=domain_code, concept_code=concept_3.code),
prompt="Analyze this document: \n@context\n@document",
)
real_pipe = PipeFactory[PipeLLM].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="analyze_document",
blueprint=pipe_llm_blueprint,
concept_codes_from_the_same_domain=[concept_1.code, concept_2.code, concept_3.code],
@@ -59,9 +59,9 @@ class TestPipeParallelValidation:
pipe_library.add_new_pipe(pipe=real_pipe)
# Verify the real pipe was created successfully
- assert real_pipe.domain == domain
+ assert real_pipe.domain_code == domain_code
assert real_pipe.output.concept.code == concept_3.code
- assert real_pipe.output.concept.domain == domain
+ assert real_pipe.output.concept.domain_code == domain_code
# Create PipeParallel that would reference this pipe
pipe_parallel_blueprint = PipeParallelBlueprint(
@@ -70,14 +70,14 @@ class TestPipeParallelValidation:
"document": concept_1.code,
"context": concept_2.code,
},
- output=ConceptFactory.make_concept_string_with_domain(domain=domain, concept_code=concept_3.code),
+ output=ConceptFactory.make_concept_ref_with_domain(domain_code=domain_code, concept_code=concept_3.code),
parallels=[SubPipeBlueprint(pipe=real_pipe.code, result="analysis_result")],
add_each_output=True,
combined_output=None,
)
pipe_parallel = PipeFactory[PipeParallel].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="parallel_document_processor",
blueprint=pipe_parallel_blueprint,
concept_codes_from_the_same_domain=[concept_1.code, concept_2.code, concept_3.code],
@@ -89,7 +89,7 @@ class TestPipeParallelValidation:
assert pipe_parallel.parallel_sub_pipes[0].output_name == "analysis_result"
# Verify PipeParallel has the expected structure
- assert pipe_parallel.domain == domain
+ assert pipe_parallel.domain_code == domain_code
assert pipe_parallel.code == "parallel_document_processor"
assert pipe_parallel.add_each_output is True
@@ -99,21 +99,21 @@ class TestPipeParallelValidation:
load_empty_library()
"""Test basic PipeParallel creation and structure"""
# Create a simple PipeParallel with proper inputs
- domain = "test_domain"
+ domain_code = "test_domain"
concept_library = get_concept_library()
concept_blueprint = ConceptBlueprint(description="Lorem Ipsum")
concept_1 = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code="Document",
blueprint_or_string_description=concept_blueprint,
)
concept_2 = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code="Context",
blueprint_or_string_description=concept_blueprint,
)
concept_3 = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code="ProcessedAnalysis",
blueprint_or_string_description=concept_blueprint,
)
@@ -121,15 +121,15 @@ class TestPipeParallelValidation:
pipe_parallel_blueprint = PipeParallelBlueprint(
description="Basic parallel pipe for testing",
- inputs={"input_var": concept_1.concept_string},
- output=ConceptFactory.make_concept_string_with_domain(domain=domain, concept_code=concept_3.code),
+ inputs={"input_var": concept_1.concept_ref},
+ output=ConceptFactory.make_concept_ref_with_domain(domain_code=domain_code, concept_code=concept_3.code),
parallels=[SubPipeBlueprint(pipe="test_pipe_1", result="result_1")],
add_each_output=True,
combined_output=None,
)
pipe_parallel = PipeFactory[PipeParallel].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="test_parallel",
blueprint=pipe_parallel_blueprint,
concept_codes_from_the_same_domain=[concept_1.code, concept_2.code, concept_3.code],
@@ -137,11 +137,11 @@ class TestPipeParallelValidation:
# Verify the PipeParallel was created correctly
assert pipe_parallel.code == "test_parallel"
- assert pipe_parallel.domain == domain
+ assert pipe_parallel.domain_code == domain_code
assert len(pipe_parallel.parallel_sub_pipes) == 1
assert pipe_parallel.inputs.root["input_var"].concept.code == concept_1.code
assert pipe_parallel.output.concept.code == concept_3.code
- assert pipe_parallel.output.concept.domain == domain
+ assert pipe_parallel.output.concept.domain_code == domain_code
assert pipe_parallel.add_each_output is True
assert pipe_parallel.combined_output is None
@@ -150,21 +150,21 @@ class TestPipeParallelValidation:
def test_pipe_parallel_needed_inputs_structure(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test that PipeParallel needed_inputs method can be called and returns expected structure"""
- domain = "test_domain"
+ domain_code = "test_domain"
concept_library = get_concept_library()
concept_blueprint = ConceptBlueprint(description="A test document")
concept_1 = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code="Document",
blueprint_or_string_description=concept_blueprint,
)
concept_2 = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code="Context",
blueprint_or_string_description=concept_blueprint,
)
concept_3 = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code="ProcessedAnalysis",
blueprint_or_string_description=concept_blueprint,
)
@@ -174,17 +174,17 @@ class TestPipeParallelValidation:
pipe_parallel_blueprint = PipeParallelBlueprint(
description="Parallel processor for testing inputs structure",
inputs={
- "document": concept_1.concept_string,
- "context": concept_2.concept_string,
+ "document": concept_1.concept_ref,
+ "context": concept_2.concept_ref,
},
- output=ConceptFactory.make_concept_string_with_domain(domain=domain, concept_code=concept_3.code),
+ output=ConceptFactory.make_concept_ref_with_domain(domain_code=domain_code, concept_code=concept_3.code),
parallels=[], # No sub-pipes to avoid dependency issues
add_each_output=True,
combined_output=None,
)
pipe_parallel = PipeFactory[PipeParallel].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="parallel_document_processor",
blueprint=pipe_parallel_blueprint,
concept_codes_from_the_same_domain=[concept_1.code, concept_2.code, concept_3.code],
diff --git a/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_creation.py b/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_creation.py
index 59b0917fe..15f0d4711 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_creation.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_creation.py
@@ -15,15 +15,15 @@ class TestPipeSequenceCreation:
def test_pipe_sequence_creation(self, load_test_library: Callable[[list[Path]], None]):
"""Test basic PipeSequence creation"""
load_test_library([Path("tests/integration/pipelex/pipes/controller/pipe_sequence")])
- domain = "test_domain"
+ domain_code = "test_domain"
concept_1 = ConceptFactory.make_from_blueprint(
concept_code="TestConcept",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_2 = ConceptFactory.make_from_blueprint(
concept_code="ProcessedText",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_library = get_concept_library()
@@ -31,19 +31,19 @@ class TestPipeSequenceCreation:
pipe_sequence_blueprint = PipeSequenceBlueprint(
description="Test sequence for validation",
- inputs={"text": concept_1.concept_string},
- output=concept_2.concept_string,
+ inputs={"text": concept_1.concept_ref},
+ output=concept_2.concept_ref,
steps=[SubPipeBlueprint(pipe="test_pipe_1", result="intermediate_result")],
)
pipe_sequence = PipeFactory[PipeSequence].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="test_sequence",
blueprint=pipe_sequence_blueprint,
)
assert pipe_sequence.code == "test_sequence"
- assert pipe_sequence.domain == domain
+ assert pipe_sequence.domain_code == domain_code
assert len(pipe_sequence.sequential_sub_pipes) == 1
assert pipe_sequence.sequential_sub_pipes[0].pipe_code == "test_pipe_1"
assert pipe_sequence.sequential_sub_pipes[0].output_name == "intermediate_result"
diff --git a/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_dry_run.py b/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_dry_run.py
index 7a7990ca3..8307d804a 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_dry_run.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_dry_run.py
@@ -45,7 +45,7 @@ class TestPipeSequenceDryRun:
discord_updates_stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="DiscordChannelUpdate",
- domain="discord_newsletter",
+ domain_code="discord_newsletter",
description="Lorem Ipsum",
structure_class_name="DiscordChannelUpdate",
),
@@ -76,7 +76,7 @@ class TestPipeSequenceDryRun:
# The pipeline only has one step (summarization), so the final output is ChannelSummary
# This test is focused on verifying that batching works correctly in dry run mode
assert pipe_output.main_stuff.concept.code == "HtmlNewsletter"
- assert pipe_output.main_stuff.concept.domain == "discord_newsletter"
+ assert pipe_output.main_stuff.concept.domain_code == "discord_newsletter"
# Verify working memory structure
final_working_memory: WorkingMemory = pipe_output.working_memory
@@ -84,7 +84,7 @@ class TestPipeSequenceDryRun:
# Check that discord_channel_updates was created as ListContent
discord_updates_stuff_final = final_working_memory.get_stuff("discord_channel_updates")
assert discord_updates_stuff_final.concept.code == "DiscordChannelUpdate"
- assert discord_updates_stuff_final.concept.domain == "discord_newsletter"
+ assert discord_updates_stuff_final.concept.domain_code == "discord_newsletter"
# The key assertion: verify it's a ListContent with multiple items
discord_updates_list = discord_updates_stuff_final.as_list_of_fixed_content_type(item_type=DiscordChannelUpdate)
@@ -100,7 +100,7 @@ class TestPipeSequenceDryRun:
channel_summaries_stuff: Stuff | None = final_working_memory.get_optional_stuff("channel_summaries")
assert channel_summaries_stuff is not None, "channel_summaries should be in working memory"
assert channel_summaries_stuff.concept.code == "ChannelSummary"
- assert channel_summaries_stuff.concept.domain == "discord_newsletter"
+ assert channel_summaries_stuff.concept.domain_code == "discord_newsletter"
assert isinstance(channel_summaries_stuff, Stuff), "ChannelSurrmary Stuff is not a Stuff"
# Verify channel_summaries is also a ListContent with multiple ChannelSummary items
diff --git a/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_multiple_steps.py b/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_multiple_steps.py
index 31bf09bba..d34e5292a 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_multiple_steps.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_multiple_steps.py
@@ -15,15 +15,15 @@ class TestPipeSequenceMultipleSteps:
def test_pipe_sequence_multiple_sub_pipes(self, load_test_library: Callable[[list[Path]], None]):
"""Test PipeSequence with multiple sequential sub-pipes"""
load_test_library([Path("tests/integration/pipelex/pipes/controller/pipe_sequence")])
- domain = "test_domain"
+ domain_code = "test_domain"
concept_1 = ConceptFactory.make_from_blueprint(
concept_code="TestConcept",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_2 = ConceptFactory.make_from_blueprint(
concept_code="ProcessedText",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_library = get_concept_library()
@@ -31,13 +31,13 @@ class TestPipeSequenceMultipleSteps:
pipe_sequence_blueprint = PipeSequenceBlueprint(
description="Test sequence with multiple steps",
- inputs={"initial_input": concept_1.concept_string},
- output=concept_2.concept_string,
+ inputs={"initial_input": concept_1.concept_ref},
+ output=concept_2.concept_ref,
steps=[SubPipeBlueprint(pipe="step_1", result="intermediate"), SubPipeBlueprint(pipe="step_2", result="final_output")],
)
pipe_sequence = PipeFactory[PipeSequence].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="test_sequence",
blueprint=pipe_sequence_blueprint,
)
diff --git a/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_output_multiplicity.py b/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_output_multiplicity.py
index 92da5e144..7b56c3db8 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_output_multiplicity.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_output_multiplicity.py
@@ -30,7 +30,7 @@ class TestPipeSequenceOutputMultiplicity:
"""
load_empty_library()
- domain = "test_multiplicity"
+ domain_code = "test_multiplicity"
# Create a PipeLLM with multiple output (output_multiplicity=3)
llm_blueprint = PipeLLMBlueprint(
@@ -41,7 +41,7 @@ class TestPipeSequenceOutputMultiplicity:
prompt="@input_text",
)
llm_pipe = PipeFactory[PipeLLM].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="llm_multiple_output",
blueprint=llm_blueprint,
)
@@ -57,7 +57,7 @@ class TestPipeSequenceOutputMultiplicity:
],
)
sequence_pipe = PipeFactory[PipeSequence].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="sequence_mismatch",
blueprint=sequence_blueprint,
)
@@ -83,7 +83,7 @@ class TestPipeSequenceOutputMultiplicity:
"""
load_empty_library()
- domain = "test_no_multiplicity"
+ domain_code = "test_no_multiplicity"
# Create a PipeLLM with single output (no multiplicity)
llm_blueprint = PipeLLMBlueprint(
@@ -94,7 +94,7 @@ class TestPipeSequenceOutputMultiplicity:
prompt="@input_text",
)
llm_pipe = PipeFactory[PipeLLM].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="llm_single_output",
blueprint=llm_blueprint,
)
@@ -110,7 +110,7 @@ class TestPipeSequenceOutputMultiplicity:
],
)
sequence_pipe = PipeFactory[PipeSequence].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="sequence_matching",
blueprint=sequence_blueprint,
)
@@ -132,7 +132,7 @@ class TestPipeSequenceOutputMultiplicity:
"""
load_empty_library()
- domain = "test_variable_multiplicity"
+ domain_code = "test_variable_multiplicity"
# Create a PipeLLM with variable multiplicity output
llm_blueprint = PipeLLMBlueprint(
@@ -143,7 +143,7 @@ class TestPipeSequenceOutputMultiplicity:
prompt="@input_text",
)
llm_pipe = PipeFactory[PipeLLM].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="llm_variable_output",
blueprint=llm_blueprint,
)
@@ -159,7 +159,7 @@ class TestPipeSequenceOutputMultiplicity:
],
)
sequence_pipe = PipeFactory[PipeSequence].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="sequence_variable_matching",
blueprint=sequence_blueprint,
)
@@ -181,7 +181,7 @@ class TestPipeSequenceOutputMultiplicity:
"""
load_empty_library()
- domain = "test_variable_vs_none"
+ domain_code = "test_variable_vs_none"
# Create a PipeLLM with variable multiplicity
llm_blueprint = PipeLLMBlueprint(
@@ -192,7 +192,7 @@ class TestPipeSequenceOutputMultiplicity:
prompt="@input_text",
)
llm_pipe = PipeFactory[PipeLLM].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="llm_variable",
blueprint=llm_blueprint,
)
@@ -208,7 +208,7 @@ class TestPipeSequenceOutputMultiplicity:
],
)
sequence_pipe = PipeFactory[PipeSequence].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="sequence_mismatch_var_none",
blueprint=sequence_blueprint,
)
@@ -236,7 +236,7 @@ class TestPipeSequenceOutputMultiplicity:
"""
load_empty_library()
- domain = "test_fixed_vs_variable"
+ domain_code = "test_fixed_vs_variable"
# Create a PipeLLM with fixed multiplicity
llm_blueprint = PipeLLMBlueprint(
@@ -247,7 +247,7 @@ class TestPipeSequenceOutputMultiplicity:
prompt="@input_text",
)
llm_pipe = PipeFactory[PipeLLM].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="llm_fixed_3",
blueprint=llm_blueprint,
)
@@ -264,7 +264,7 @@ class TestPipeSequenceOutputMultiplicity:
],
)
sequence_pipe = PipeFactory[PipeSequence].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="sequence_fixed_to_variable",
blueprint=sequence_blueprint,
)
diff --git a/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_simple.py b/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_simple.py
index 8c362daaa..688793eb9 100644
--- a/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_simple.py
+++ b/tests/integration/pipelex/pipes/controller/pipe_sequence/test_pipe_sequence_simple.py
@@ -29,10 +29,10 @@ class TestPipeSequenceSimple:
async def test_simple_sequence_processing(self, pipe_run_mode: PipeRunMode, load_test_library: Callable[[list[Path]], None]):
"""Test PipeSequence with a simple 2-step text transformation scenario."""
load_test_library([Path("tests/integration/pipelex/pipes/controller/pipe_sequence")])
- domain = "test_integration"
+ domain_code = "test_integration"
concept_1 = ConceptFactory.make_from_blueprint(
concept_code="TestConcept1",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_library = get_concept_library()
@@ -42,8 +42,8 @@ class TestPipeSequenceSimple:
# Create PipeSequence instance - pipes are loaded from PLX files
pipe_sequence_blueprint = PipeSequenceBlueprint(
description="Simple sequence for text processing",
- inputs={"input_text": concept_1.concept_string},
- output=concept_2.concept_string,
+ inputs={"input_text": concept_1.concept_ref},
+ output=concept_2.concept_ref,
steps=[
SubPipeBlueprint(pipe="capitalize_text", result="capitalized_text"),
SubPipeBlueprint(pipe="add_prefix", result="final_text"),
@@ -51,7 +51,7 @@ class TestPipeSequenceSimple:
)
pipe_sequence = PipeFactory[PipeSequence].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="simple_sequence",
blueprint=pipe_sequence_blueprint,
)
@@ -67,7 +67,7 @@ class TestPipeSequenceSimple:
# Verify the PipeSequence instance was created correctly
assert pipe_sequence is not None
- assert pipe_sequence.domain == "test_integration"
+ assert pipe_sequence.domain_code == "test_integration"
assert pipe_sequence.code == "simple_sequence"
assert len(pipe_sequence.sequential_sub_pipes) == 2
assert pipe_sequence.sequential_sub_pipes[0].pipe_code == "capitalize_text"
diff --git a/tests/integration/pipelex/pipes/operator/pipe_extract/test_pipe_extract.py b/tests/integration/pipelex/pipes/operator/pipe_extract/test_pipe_extract.py
index bbea9f6cf..075e2600d 100644
--- a/tests/integration/pipelex/pipes/operator/pipe_extract/test_pipe_extract.py
+++ b/tests/integration/pipelex/pipes/operator/pipe_extract/test_pipe_extract.py
@@ -35,7 +35,7 @@ class TestPipeExtract:
concept_library = get_concept_library()
concept_1 = ConceptFactory.make_from_blueprint(
concept_code="PageScan",
- domain="extract",
+ domain_code="extract",
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
concept_library.add_new_concept(concept=concept_1)
@@ -74,7 +74,7 @@ class TestPipeExtract:
stuff=StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="PageScan",
- domain="extract",
+ domain_code="extract",
description="Lorem Ipsum",
structure_class_name="PageScan",
),
diff --git a/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm.py b/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm.py
index f23bf78a1..9175a2959 100644
--- a/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm.py
+++ b/tests/integration/pipelex/pipes/operator/pipe_llm/test_pipe_llm.py
@@ -165,7 +165,7 @@ class TestPipeLLMBasic:
working_memory = WorkingMemoryFactory.make_from_single_stuff(stuff=stuff)
pipe_llm_blueprint = PipeLLMBlueprint(
description="LLM test for image processing with attributes",
- inputs={stuff_name: stuff.concept.concept_string},
+ inputs={stuff_name: stuff.concept.concept_ref},
output=NativeConceptCode.TEXT,
system_prompt=PipeTestCases.SYSTEM_PROMPT,
prompt=PipeTestCases.MULTI_IMG_DESC_PROMPT,
diff --git a/tests/integration/pipelex/pipes/test_bracket_notation_controllers.py b/tests/integration/pipelex/pipes/test_bracket_notation_controllers.py
index c02b93793..ed128ce67 100644
--- a/tests/integration/pipelex/pipes/test_bracket_notation_controllers.py
+++ b/tests/integration/pipelex/pipes/test_bracket_notation_controllers.py
@@ -19,18 +19,18 @@ class TestBracketNotationInControllers:
def test_pipe_parallel_with_bracket_notation(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test PipeParallel factory with bracket notation."""
- domain = "test"
+ domain_code = "test"
concept_library = get_concept_library()
concept_data_item = ConceptFactory.make_from_blueprint(
concept_code="DataItem",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Data item"),
)
concept_library.add_concepts([concept_data_item])
concept_processed_data = ConceptFactory.make_from_blueprint(
concept_code="ProcessedData",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Processed data"),
)
concept_library.add_concepts([concept_processed_data])
@@ -44,7 +44,7 @@ class TestBracketNotationInControllers:
)
pipe = PipeFactory[PipeParallel].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="test_parallel",
blueprint=blueprint,
concept_codes_from_the_same_domain=[concept_data_item.code, concept_processed_data.code],
@@ -58,17 +58,17 @@ class TestBracketNotationInControllers:
def test_pipe_condition_with_bracket_notation(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test PipeCondition factory with bracket notation."""
- domain = "test"
+ domain_code = "test"
concept_library = get_concept_library()
concept_1 = ConceptFactory.make_from_blueprint(
concept_code="Category",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Category"),
)
concept_2 = ConceptFactory.make_from_blueprint(
concept_code="Result",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Result"),
)
concept_library.add_concepts([concept_1, concept_2])
@@ -83,7 +83,7 @@ class TestBracketNotationInControllers:
)
pipe = PipeFactory[PipeCondition].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="test_condition",
blueprint=blueprint,
concept_codes_from_the_same_domain=[concept_1.code, concept_2.code],
@@ -97,17 +97,17 @@ class TestBracketNotationInControllers:
def test_pipe_batch_with_bracket_notation(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test PipeBatch factory with bracket notation."""
- domain = "test"
+ domain_code = "test"
concept_library = get_concept_library()
concept_item = ConceptFactory.make_from_blueprint(
concept_code="Item",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Item"),
)
concept_processed_item = ConceptFactory.make_from_blueprint(
concept_code="ProcessedItem",
- domain=domain,
+ domain_code=domain_code,
blueprint_or_string_description=ConceptBlueprint(description="Processed item"),
)
concept_library.add_concepts([concept_item, concept_processed_item])
@@ -122,7 +122,7 @@ class TestBracketNotationInControllers:
)
pipe = PipeFactory[PipeBatch].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="test_batch",
blueprint=blueprint,
concept_codes_from_the_same_domain=[concept_item.code, concept_processed_item.code],
diff --git a/tests/integration/pipelex/pipes/test_flow_factory/test_flow_factory.py b/tests/integration/pipelex/pipes/test_flow_factory/test_flow_factory.py
index 16156aaec..536cf2bc8 100644
--- a/tests/integration/pipelex/pipes/test_flow_factory/test_flow_factory.py
+++ b/tests/integration/pipelex/pipes/test_flow_factory/test_flow_factory.py
@@ -66,7 +66,7 @@ class TestFlowFactory:
# Verify the flow was created correctly
assert flow is not None
- assert flow.domain is not None
+ assert flow.domain_code is not None
assert flow.flow_elements is not None
assert len(flow.flow_elements) > 0
diff --git a/tests/integration/pipelex/test_data.py b/tests/integration/pipelex/test_data.py
index ea49e8d47..f52a5c8ff 100644
--- a/tests/integration/pipelex/test_data.py
+++ b/tests/integration/pipelex/test_data.py
@@ -63,7 +63,7 @@ class PipeTestCases:
)
COMPLEX_STUFF = StuffFactory.make_stuff(
name="complex",
- concept=ConceptFactory.make(concept_code="Complex", domain="tests", description="tests.Complex", structure_class_name="Complex"),
+ concept=ConceptFactory.make(concept_code="Complex", domain_code="tests", description="tests.Complex", structure_class_name="Complex"),
content=ListContent(
items=[
TextContent(text="The quick brown fox jumps over the lazy dog"),
@@ -107,7 +107,7 @@ class PipeTestCases:
]
TRICKY_QUESTION_BLUEPRINT = StuffBlueprint(
stuff_name="question",
- concept_string="answer.Question",
+ concept_ref="answer.Question",
content=USER_TEXT_TRICKY_2,
)
NO_INPUT: ClassVar[list[tuple[str, str]]] = [ # topic, pipe
diff --git a/tests/integration/pipelex/test_inline_structure_concepts.py b/tests/integration/pipelex/test_inline_structure_concepts.py
index fa2ecc59e..5fb75da21 100644
--- a/tests/integration/pipelex/test_inline_structure_concepts.py
+++ b/tests/integration/pipelex/test_inline_structure_concepts.py
@@ -48,13 +48,13 @@ class TestInlineStructureConcepts:
# Create concept from blueprint
concept = ConceptFactory.make_from_blueprint(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="TestFeatureAnalysis",
blueprint_or_string_description=blueprint,
)
# Verify concept properties
- assert concept.domain == "test_domain"
+ assert concept.domain_code == "test_domain"
assert concept.code == "TestFeatureAnalysis"
assert concept.description == "Analysis of a photo's visual content"
assert concept.structure_class_name == "TestFeatureAnalysis"
@@ -88,14 +88,14 @@ class TestInlineStructureConcepts:
# Create concept from blueprint
concept = ConceptFactory.make_from_blueprint(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="TestStringRef",
blueprint_or_string_description=blueprint,
)
# Verify concept properties
assert concept.code == "TestStringRef"
- assert concept.domain == "test_domain"
+ assert concept.domain_code == "test_domain"
assert concept.description == "Test with string reference"
assert concept.structure_class_name == "TextContent"
@@ -106,7 +106,7 @@ class TestInlineStructureConcepts:
# Create concept from blueprint
concept = ConceptFactory.make_from_blueprint(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="TestAutoDetect",
blueprint_or_string_description=blueprint,
)
@@ -144,14 +144,14 @@ class TestInlineStructureConcepts:
blueprint = ConceptBlueprint(description="Complex document structure", structure=inline_structure)
concept = ConceptFactory.make_from_blueprint(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="ComplexDocument",
blueprint_or_string_description=blueprint,
)
# Verify concept creation
assert concept.code == "ComplexDocument"
- assert concept.domain == "test_domain"
+ assert concept.domain_code == "test_domain"
assert concept.structure_class_name == "ComplexDocument"
# Verify the generated class works
@@ -182,7 +182,7 @@ class TestInlineStructureConcepts:
not a registered subclass of StuffContent",
):
_ = ConceptFactory.make_from_blueprint(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="TestInvalidRef",
blueprint_or_string_description=ConceptBlueprint(description="Test invalid reference", structure="NonExistentClass"),
)
@@ -197,7 +197,7 @@ not a registered subclass of StuffContent",
blueprint1 = ConceptBlueprint(description="Person information", structure=structure1)
concept1 = ConceptFactory.make_from_blueprint(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="Person",
blueprint_or_string_description=blueprint1,
)
@@ -210,7 +210,7 @@ not a registered subclass of StuffContent",
blueprint2 = ConceptBlueprint(description="Product information", structure=structure2)
concept2 = ConceptFactory.make_from_blueprint(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="Product",
blueprint_or_string_description=blueprint2,
)
@@ -260,13 +260,13 @@ not a registered subclass of StuffContent",
# Create concept from blueprint
concept = ConceptFactory.make_from_blueprint(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="AnimalInfo",
blueprint_or_string_description=blueprint,
)
# Verify concept properties
- assert concept.domain == "test_domain"
+ assert concept.domain_code == "test_domain"
assert concept.code == "AnimalInfo"
assert concept.structure_class_name == "AnimalInfo"
diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_pipe_llm.py b/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_pipe_llm.py
index 9bbf321ed..59fe59758 100644
--- a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_pipe_llm.py
+++ b/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_pipe_llm.py
@@ -21,9 +21,11 @@ class TestPipeLLMBlueprintConversion:
self, test_name: str, pipe_spec: PipeLLMSpec, expected_blueprint: PipeLLMBlueprint, load_empty_library: Callable[[], str]
):
load_empty_library()
- item_concept = ConceptFactory.make(concept_code="Item", domain="test_domain", description="Item", structure_class_name="Item")
- data_concept = ConceptFactory.make(concept_code="Data", domain="test_domain", description="Data", structure_class_name="Data")
- analysis_concept = ConceptFactory.make(concept_code="Analysis", domain="test_domain", description="Analysis", structure_class_name="Analysis")
+ item_concept = ConceptFactory.make(concept_code="Item", domain_code="test_domain", description="Item", structure_class_name="Item")
+ data_concept = ConceptFactory.make(concept_code="Data", domain_code="test_domain", description="Data", structure_class_name="Data")
+ analysis_concept = ConceptFactory.make(
+ concept_code="Analysis", domain_code="test_domain", description="Analysis", structure_class_name="Analysis"
+ )
concept_library = get_concept_library()
concept_library.add_new_concept(concept=item_concept)
concept_library.add_new_concept(concept=data_concept)
diff --git a/tests/unit/pipelex/builder/test_runner_generator.py b/tests/unit/pipelex/builder/test_runner_generator.py
index 326ded71f..f07b31294 100644
--- a/tests/unit/pipelex/builder/test_runner_generator.py
+++ b/tests/unit/pipelex/builder/test_runner_generator.py
@@ -77,7 +77,7 @@ class TestConceptGenerateInputRepresentationPython:
def test_refined_text_python(self) -> None:
"""Test Python representation for a concept that refines Text."""
concept = ConceptFactory.make(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="Question",
description="A question",
structure_class_name="TextContent",
@@ -268,7 +268,7 @@ class TestGenerateRunnerCode:
"""Test that custom class imports use domain_conceptCode format for standalone scripts."""
# Create a custom concept (non-native)
custom_concept = ConceptFactory.make(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="CustomOutput",
description="A custom output",
structure_class_name="CustomOutput",
diff --git a/tests/unit/pipelex/client/test_api_serialization.py b/tests/unit/pipelex/client/test_api_serialization.py
index 6bc0f3f18..925f9ab4b 100644
--- a/tests/unit/pipelex/client/test_api_serialization.py
+++ b/tests/unit/pipelex/client/test_api_serialization.py
@@ -70,7 +70,7 @@ class TestApiSerialization:
stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="DateTimeEvent",
- domain="event",
+ domain_code="event",
description="event.DateTimeEvent",
structure_class_name="DateTimeEvent",
),
diff --git a/tests/unit/pipelex/core/concepts/concept_factory/data.py b/tests/unit/pipelex/core/concepts/concept_factory/data.py
index 084bb59ff..b4621f6fd 100644
--- a/tests/unit/pipelex/core/concepts/concept_factory/data.py
+++ b/tests/unit/pipelex/core/concepts/concept_factory/data.py
@@ -15,7 +15,7 @@ class TestCases:
# Test cases for make_refines method - only native concepts can be refined
MAKE_REFINES_TEST_CASES: ClassVar[list[tuple[str, ConceptBlueprint, str]]] = [
(
- "native_concept_string",
+ "native_concept_ref",
ConceptBlueprint(description="A concept that refines a native text concept", refines=NativeConceptCode.TEXT),
f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}",
),
@@ -34,30 +34,30 @@ class TestCases:
),
]
- # Test cases for make_domain_and_concept_code_from_concept_string_or_concept_code method
+ # Test cases for make_domain_and_concept_code_from_concept_ref_or_concept_code method
MAKE_DOMAIN_AND_CONCEPT_CODE_TEST_CASES: ClassVar[list[tuple[str, str, DomainAndConceptCode]]] = [
# Test case 1: Concept string with dot notation
- ("my_domain", "other_domain.ConceptName", DomainAndConceptCode(domain="other_domain", concept_code="ConceptName")),
+ ("my_domain", "other_domain.ConceptName", DomainAndConceptCode(domain_code="other_domain", concept_code="ConceptName")),
# Test case 2: Concept string with dot notation (ignores same domain codes)
- ("my_domain", "other_domain.ConceptName", DomainAndConceptCode(domain="other_domain", concept_code="ConceptName")),
+ ("my_domain", "other_domain.ConceptName", DomainAndConceptCode(domain_code="other_domain", concept_code="ConceptName")),
# Test case 3: Native concept code (Text)
- ("my_domain", "Text", DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="Text")),
+ ("my_domain", "Text", DomainAndConceptCode(domain_code=SpecialDomain.NATIVE, concept_code="Text")),
# Test case 4: Native concept code (Image)
- ("my_domain", "Image", DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="Image")),
+ ("my_domain", "Image", DomainAndConceptCode(domain_code=SpecialDomain.NATIVE, concept_code="Image")),
# Test case 5: Native concept code (PDF)
- ("my_domain", "PDF", DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="PDF")),
+ ("my_domain", "PDF", DomainAndConceptCode(domain_code=SpecialDomain.NATIVE, concept_code="PDF")),
# Test case 6: Native concept code with same domain codes provided (native takes precedence)
- ("my_domain", "Text", DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="Text")),
+ ("my_domain", "Text", DomainAndConceptCode(domain_code=SpecialDomain.NATIVE, concept_code="Text")),
# Test case 7: Concept code from same domain
- ("my_domain", "MyConcept", DomainAndConceptCode(domain="my_domain", concept_code="MyConcept")),
+ ("my_domain", "MyConcept", DomainAndConceptCode(domain_code="my_domain", concept_code="MyConcept")),
# Test case 8: Different domain in concept string
- ("my_domain", "another_domain.SomeConcept", DomainAndConceptCode(domain="another_domain", concept_code="SomeConcept")),
+ ("my_domain", "another_domain.SomeConcept", DomainAndConceptCode(domain_code="another_domain", concept_code="SomeConcept")),
# Test case 13: All native concept codes
- ("my_domain", "Dynamic", DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="Dynamic")),
- ("my_domain", "TextAndImages", DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="TextAndImages")),
- ("my_domain", "Number", DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="Number")),
- ("my_domain", "Page", DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="Page")),
- ("my_domain", "Anything", DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="Anything")),
+ ("my_domain", "Dynamic", DomainAndConceptCode(domain_code=SpecialDomain.NATIVE, concept_code="Dynamic")),
+ ("my_domain", "TextAndImages", DomainAndConceptCode(domain_code=SpecialDomain.NATIVE, concept_code="TextAndImages")),
+ ("my_domain", "Number", DomainAndConceptCode(domain_code=SpecialDomain.NATIVE, concept_code="Number")),
+ ("my_domain", "Page", DomainAndConceptCode(domain_code=SpecialDomain.NATIVE, concept_code="Page")),
+ ("my_domain", "Anything", DomainAndConceptCode(domain_code=SpecialDomain.NATIVE, concept_code="Anything")),
]
# Test cases for make_from_blueprint method
@@ -69,11 +69,11 @@ class TestCases:
"Text",
ConceptBlueprint(description="Native text concept"),
Concept(
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
code="Text",
description="Native text concept",
structure_class_name=NativeConceptCode.TEXT.structure_class_name,
- refines=NativeConceptCode.TEXT.concept_string,
+ refines=NativeConceptCode.TEXT.concept_ref,
),
),
# Test case 6: Concept code from same domain
@@ -83,7 +83,7 @@ class TestCases:
"DomainConcept",
ConceptBlueprint(description="A concept from same domain"),
Concept(
- domain="my_domain",
+ domain_code="my_domain",
code="DomainConcept",
description="A concept from same domain",
structure_class_name="DomainConcept",
@@ -109,7 +109,7 @@ class TestCases:
},
),
Concept(
- domain="my_domain",
+ domain_code="my_domain",
code="PersonConcept",
description="A person with structured data",
structure_class_name="PersonConcept",
@@ -123,7 +123,7 @@ class TestCases:
"ConceptWithRefines",
ConceptBlueprint(description="A concept with refines", refines="native.Image"),
Concept(
- domain="my_domain",
+ domain_code="my_domain",
code="ConceptWithRefines",
description="A concept with refines",
structure_class_name="ConceptWithRefines",
diff --git a/tests/unit/pipelex/core/concepts/concept_factory/test_concept_factory.py b/tests/unit/pipelex/core/concepts/concept_factory/test_concept_factory.py
index 785e37ad9..b9e91edb1 100644
--- a/tests/unit/pipelex/core/concepts/concept_factory/test_concept_factory.py
+++ b/tests/unit/pipelex/core/concepts/concept_factory/test_concept_factory.py
@@ -83,36 +83,36 @@ class TestConceptFactory:
assert normalize_structure_blueprint(mixed_structure_blueprint2) == expected_structure2
@pytest.mark.parametrize(
- ("domain", "concept_string_or_code", "expected_result"),
+ ("domain_code", "concept_ref_or_code", "expected_result"),
TestCases.MAKE_DOMAIN_AND_CONCEPT_CODE_TEST_CASES,
)
- def test_make_domain_and_concept_code_from_concept_string_or_code(
+ def test_make_domain_and_concept_code_from_concept_ref_or_code(
self,
- domain: str,
- concept_string_or_code: str,
+ domain_code: str,
+ concept_ref_or_code: str,
expected_result: list[str],
):
- result = ConceptFactory.make_domain_and_concept_code_from_concept_string_or_code(
- domain=domain,
- concept_string_or_code=concept_string_or_code,
+ result = ConceptFactory.make_domain_and_concept_code_from_concept_ref_or_code(
+ domain_code=domain_code,
+ concept_ref_or_code=concept_ref_or_code,
)
assert result == expected_result
@pytest.mark.parametrize(
- ("test_name", "domain", "concept_code", "blueprint", "expected_concept"),
+ ("test_name", "domain_code", "concept_code", "blueprint", "expected_concept"),
TestCases.MAKE_FROM_BLUEPRINT_TEST_CASES,
)
def test_make_from_blueprint(
self,
test_name: str,
- domain: str,
+ domain_code: str,
concept_code: str,
blueprint: ConceptBlueprint,
expected_concept: Concept,
):
"""Test make_from_blueprint method with various blueprint configurations."""
result = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code=concept_code,
blueprint_or_string_description=blueprint,
)
@@ -127,7 +127,7 @@ class TestConceptFactory:
with pytest.raises(ConceptFactoryError, match="is not a registered subclass of StuffContent"):
ConceptFactory.make_from_blueprint(
- domain="my_domain",
+ domain_code="my_domain",
concept_code="TestConcept",
blueprint_or_string_description=blueprint,
)
diff --git a/tests/unit/pipelex/core/concepts/test_concept.py b/tests/unit/pipelex/core/concepts/test_concept.py
index 1743be436..0c45b1f80 100644
--- a/tests/unit/pipelex/core/concepts/test_concept.py
+++ b/tests/unit/pipelex/core/concepts/test_concept.py
@@ -8,7 +8,7 @@ from pipelex.core.concepts.concept_structure_blueprint import ConceptStructureBl
from pipelex.core.concepts.exceptions import ConceptStringError
from pipelex.core.concepts.native.concept_native import NativeConceptCode
from pipelex.core.concepts.native.exceptions import NativeConceptDefinitionError
-from pipelex.core.concepts.validation import validate_concept_string
+from pipelex.core.concepts.validation import validate_concept_ref
from pipelex.core.domains.domain import SpecialDomain
from pipelex.core.stuffs.structured_content import StructuredContent
@@ -33,60 +33,57 @@ class DocumentWithNestedImage(StructuredContent):
class TestConcept:
"""Test Concept class."""
- def test_get_validated_native_concept_string(self):
- assert NativeConceptCode.get_validated_native_concept_string(NativeConceptCode.TEXT) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}"
- assert NativeConceptCode.get_validated_native_concept_string(NativeConceptCode.IMAGE) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.IMAGE}"
- assert NativeConceptCode.get_validated_native_concept_string(NativeConceptCode.PDF) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.PDF}"
+ def test_get_validated_native_concept_ref(self):
+ assert NativeConceptCode.get_validated_native_concept_ref(NativeConceptCode.TEXT) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}"
+ assert NativeConceptCode.get_validated_native_concept_ref(NativeConceptCode.IMAGE) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.IMAGE}"
+ assert NativeConceptCode.get_validated_native_concept_ref(NativeConceptCode.PDF) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.PDF}"
assert (
- NativeConceptCode.get_validated_native_concept_string(NativeConceptCode.TEXT_AND_IMAGES)
+ NativeConceptCode.get_validated_native_concept_ref(NativeConceptCode.TEXT_AND_IMAGES)
== f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT_AND_IMAGES}"
)
- assert NativeConceptCode.get_validated_native_concept_string(NativeConceptCode.NUMBER) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.NUMBER}"
+ assert NativeConceptCode.get_validated_native_concept_ref(NativeConceptCode.NUMBER) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.NUMBER}"
assert (
- NativeConceptCode.get_validated_native_concept_string(NativeConceptCode.ANYTHING)
- == f"{SpecialDomain.NATIVE}.{NativeConceptCode.ANYTHING}"
+ NativeConceptCode.get_validated_native_concept_ref(NativeConceptCode.ANYTHING) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.ANYTHING}"
)
+ assert NativeConceptCode.get_validated_native_concept_ref(NativeConceptCode.DYNAMIC) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.DYNAMIC}"
assert (
- NativeConceptCode.get_validated_native_concept_string(NativeConceptCode.DYNAMIC) == f"{SpecialDomain.NATIVE}.{NativeConceptCode.DYNAMIC}"
- )
- assert (
- NativeConceptCode.get_validated_native_concept_string(f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}")
+ NativeConceptCode.get_validated_native_concept_ref(f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}")
== f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}"
)
assert (
- NativeConceptCode.get_validated_native_concept_string(f"{SpecialDomain.NATIVE}.{NativeConceptCode.IMAGE}")
+ NativeConceptCode.get_validated_native_concept_ref(f"{SpecialDomain.NATIVE}.{NativeConceptCode.IMAGE}")
== f"{SpecialDomain.NATIVE}.{NativeConceptCode.IMAGE}"
)
assert (
- NativeConceptCode.get_validated_native_concept_string(f"{SpecialDomain.NATIVE}.{NativeConceptCode.PDF}")
+ NativeConceptCode.get_validated_native_concept_ref(f"{SpecialDomain.NATIVE}.{NativeConceptCode.PDF}")
== f"{SpecialDomain.NATIVE}.{NativeConceptCode.PDF}"
)
assert (
- NativeConceptCode.get_validated_native_concept_string(f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT_AND_IMAGES}")
+ NativeConceptCode.get_validated_native_concept_ref(f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT_AND_IMAGES}")
== f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT_AND_IMAGES}"
)
assert (
- NativeConceptCode.get_validated_native_concept_string(f"{SpecialDomain.NATIVE}.{NativeConceptCode.NUMBER}")
+ NativeConceptCode.get_validated_native_concept_ref(f"{SpecialDomain.NATIVE}.{NativeConceptCode.NUMBER}")
== f"{SpecialDomain.NATIVE}.{NativeConceptCode.NUMBER}"
)
with pytest.raises(NativeConceptDefinitionError):
- NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.TEXT}")
+ NativeConceptCode.get_validated_native_concept_ref(f"not_native.{NativeConceptCode.TEXT}")
with pytest.raises(NativeConceptDefinitionError):
- NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.IMAGE}")
+ NativeConceptCode.get_validated_native_concept_ref(f"not_native.{NativeConceptCode.IMAGE}")
with pytest.raises(NativeConceptDefinitionError):
- NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.PDF}")
+ NativeConceptCode.get_validated_native_concept_ref(f"not_native.{NativeConceptCode.PDF}")
with pytest.raises(NativeConceptDefinitionError):
- NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.TEXT_AND_IMAGES}")
+ NativeConceptCode.get_validated_native_concept_ref(f"not_native.{NativeConceptCode.TEXT_AND_IMAGES}")
with pytest.raises(NativeConceptDefinitionError):
- NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.NUMBER}")
+ NativeConceptCode.get_validated_native_concept_ref(f"not_native.{NativeConceptCode.NUMBER}")
with pytest.raises(NativeConceptDefinitionError):
- NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.ANYTHING}")
+ NativeConceptCode.get_validated_native_concept_ref(f"not_native.{NativeConceptCode.ANYTHING}")
with pytest.raises(NativeConceptDefinitionError):
- NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.DYNAMIC}")
+ NativeConceptCode.get_validated_native_concept_ref(f"not_native.{NativeConceptCode.DYNAMIC}")
with pytest.raises(NativeConceptDefinitionError):
- NativeConceptCode.get_validated_native_concept_string("RandomConcept")
+ NativeConceptCode.get_validated_native_concept_ref("RandomConcept")
with pytest.raises(NativeConceptDefinitionError):
- NativeConceptCode.get_validated_native_concept_string("text")
+ NativeConceptCode.get_validated_native_concept_ref("text")
def test_is_native_concept(self):
"""Test is_native_concept method."""
@@ -101,7 +98,7 @@ class TestConcept:
Concept.is_native_concept(
ConceptFactory.make_from_blueprint(
concept_code=NativeConceptCode.TEXT,
- domain=valid_domain,
+ domain_code=valid_domain,
blueprint_or_string_description=ConceptBlueprint(description=valid_definition),
),
)
@@ -111,7 +108,7 @@ class TestConcept:
Concept.is_native_concept(
ConceptFactory.make_from_blueprint(
concept_code=NativeConceptCode.TEXT,
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
blueprint_or_string_description=ConceptBlueprint(description=valid_definition),
),
)
@@ -121,7 +118,7 @@ class TestConcept:
Concept.is_native_concept(
ConceptFactory.make_from_blueprint(
concept_code=NativeConceptCode.IMAGE,
- domain=valid_domain,
+ domain_code=valid_domain,
blueprint_or_string_description=ConceptBlueprint(description=valid_definition),
),
)
@@ -131,7 +128,7 @@ class TestConcept:
Concept.is_native_concept(
ConceptFactory.make_from_blueprint(
concept_code=NativeConceptCode.PDF,
- domain=valid_domain,
+ domain_code=valid_domain,
blueprint_or_string_description=ConceptBlueprint(description=valid_definition),
),
)
@@ -141,7 +138,7 @@ class TestConcept:
Concept.is_native_concept(
ConceptFactory.make_from_blueprint(
concept_code=NativeConceptCode.TEXT_AND_IMAGES,
- domain=valid_domain,
+ domain_code=valid_domain,
blueprint_or_string_description=ConceptBlueprint(description=valid_definition),
),
)
@@ -151,7 +148,7 @@ class TestConcept:
Concept.is_native_concept(
ConceptFactory.make_from_blueprint(
concept_code=NativeConceptCode.NUMBER,
- domain=valid_domain,
+ domain_code=valid_domain,
blueprint_or_string_description=ConceptBlueprint(description=valid_definition),
),
)
@@ -161,7 +158,7 @@ class TestConcept:
Concept.is_native_concept(
ConceptFactory.make_from_blueprint(
concept_code=NativeConceptCode.ANYTHING,
- domain=valid_domain,
+ domain_code=valid_domain,
blueprint_or_string_description=ConceptBlueprint(description=valid_definition),
),
)
@@ -171,88 +168,88 @@ class TestConcept:
Concept.is_native_concept(
ConceptFactory.make_from_blueprint(
concept_code="RandomConcept",
- domain=valid_domain,
+ domain_code=valid_domain,
blueprint_or_string_description=ConceptBlueprint(description=valid_definition),
),
)
is False
)
- def test_construct_concept_string_with_domain(self):
- """Test construct_concept_string_with_domain method."""
+ def test_construct_concept_ref_with_domain(self):
+ """Test construct_concept_ref_with_domain method."""
valid_domain = "valid_domain"
assert (
- ConceptFactory.make_concept_string_with_domain(domain=valid_domain, concept_code=NativeConceptCode.TEXT)
+ ConceptFactory.make_concept_ref_with_domain(domain_code=valid_domain, concept_code=NativeConceptCode.TEXT)
== f"{valid_domain}.{NativeConceptCode.TEXT}"
)
- def test_validate_concept_string(self):
- """Test validate_concept_string method."""
+ def test_validate_concept_ref(self):
+ """Test validate_concept_ref method."""
valid_domain = "valid_domain"
valid_concept_code = "ConceptCode"
- valid_concept_string = f"{valid_domain}.{valid_concept_code}"
+ valid_concept_ref = f"{valid_domain}.{valid_concept_code}"
# Valid cases - should not raise exceptions
- validate_concept_string(valid_concept_string)
- validate_concept_string(f"domain_123.{valid_concept_code}")
- validate_concept_string(f"{SpecialDomain.NATIVE}.{NativeConceptCode.ANYTHING}")
- validate_concept_string(f"{valid_domain}.UPPERCASE")
+ validate_concept_ref(valid_concept_ref)
+ validate_concept_ref(f"domain_123.{valid_concept_code}")
+ validate_concept_ref(f"{SpecialDomain.NATIVE}.{NativeConceptCode.ANYTHING}")
+ validate_concept_ref(f"{valid_domain}.UPPERCASE")
# Invalid cases - should raise ConceptCodeError
with pytest.raises(ConceptStringError):
- validate_concept_string(f"snake_case_domaiN.{valid_concept_code}")
+ validate_concept_ref(f"snake_case_domaiN.{valid_concept_code}")
# Multiple dots
with pytest.raises(ConceptStringError):
- validate_concept_string(f"domain.sub.{valid_concept_code}")
+ validate_concept_ref(f"domain.sub.{valid_concept_code}")
with pytest.raises(ConceptStringError):
- validate_concept_string(f"a.b.c.{valid_concept_code}")
+ validate_concept_ref(f"a.b.c.{valid_concept_code}")
# Invalid domain (not snake_case)
with pytest.raises(ConceptStringError):
- validate_concept_string(f"InvalidDomain.{valid_concept_code}")
+ validate_concept_ref(f"InvalidDomain.{valid_concept_code}")
with pytest.raises(ConceptStringError):
- validate_concept_string(f"domain-name.{valid_concept_code}")
+ validate_concept_ref(f"domain-name.{valid_concept_code}")
with pytest.raises(ConceptStringError):
- validate_concept_string(f"Domain_Name.{valid_concept_code}")
+ validate_concept_ref(f"Domain_Name.{valid_concept_code}")
with pytest.raises(ConceptStringError):
- validate_concept_string(f"123domain.{valid_concept_code}")
+ validate_concept_ref(f"123domain.{valid_concept_code}")
# Invalid concept code (not PascalCase)
with pytest.raises(ConceptStringError):
- validate_concept_string(f"{valid_domain}.invalidText")
+ validate_concept_ref(f"{valid_domain}.invalidText")
with pytest.raises(ConceptStringError):
- validate_concept_string(f"{valid_domain}.text")
+ validate_concept_ref(f"{valid_domain}.text")
with pytest.raises(ConceptStringError):
- validate_concept_string(f"{valid_domain}.Text_Name")
+ validate_concept_ref(f"{valid_domain}.Text_Name")
with pytest.raises(ConceptStringError):
- validate_concept_string(f"{valid_domain}.text-name")
+ validate_concept_ref(f"{valid_domain}.text-name")
def test_are_concept_compatible(self):
concept1 = ConceptFactory.make_from_blueprint(
concept_code="Code1",
- domain="domain1",
+ domain_code="domain1",
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum", refines=NativeConceptCode.TEXT),
)
concept2 = ConceptFactory.make_from_blueprint(
concept_code="Code2",
- domain="domain1",
+ domain_code="domain1",
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum", refines=NativeConceptCode.TEXT),
)
concept3 = ConceptFactory.make_from_blueprint(
concept_code="Code3",
- domain="domain2",
+ domain_code="domain2",
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum", structure="TextContent"),
)
concept4 = ConceptFactory.make_from_blueprint(
concept_code="Code4",
- domain="domain1",
+ domain_code="domain1",
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum", structure="ImageContent"),
)
@@ -266,7 +263,7 @@ class TestConcept:
concept_7 = ConceptFactory.make_from_blueprint(
concept_code="VisualDescription",
- domain="images",
+ domain_code="images",
blueprint_or_string_description=ConceptBlueprint(description="Lorem Ipsum"),
)
@@ -290,7 +287,7 @@ class TestConcept:
"""Test that a concept created with .make() that refines native.Text is strictly compatible with Text."""
# Create a concept that refines native.Text using ConceptFactory.make()
concept_not_native_text = ConceptFactory.make(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="MyConceptNotNativeText",
description="Test concept for unit tests",
structure_class_name="TextContent",
@@ -309,7 +306,7 @@ class TestConcept:
# Create a concept with a structure blueprint that has exactly the same field as TextContent: text: str
custom_text_like_concept = ConceptFactory.make_from_blueprint(
concept_code="MyTextLikeConcept",
- domain="test_structure_equiv",
+ domain_code="test_structure_equiv",
blueprint_or_string_description=ConceptBlueprint(
description="A concept with the exact same structure as TextContent",
structure={
@@ -339,7 +336,7 @@ class TestConcept:
# Create a concept using our custom DocumentWithNestedImage class
concept_with_nested_image = ConceptFactory.make(
- domain="test_nested",
+ domain_code="test_nested",
concept_code="DocumentWithImage",
description="A document containing nested image info",
structure_class_name="DocumentWithNestedImage",
@@ -347,7 +344,7 @@ class TestConcept:
# Create a concept using the NestedImageInfo class (same structure as ImageContent)
concept_image_like = ConceptFactory.make(
- domain="test_nested",
+ domain_code="test_nested",
concept_code="ImageInfo",
description="Image-like info",
structure_class_name="NestedImageInfo",
diff --git a/tests/unit/pipelex/core/concepts/test_concept_find_image_field_paths.py b/tests/unit/pipelex/core/concepts/test_concept_find_image_field_paths.py
index 959332300..b93011bdd 100644
--- a/tests/unit/pipelex/core/concepts/test_concept_find_image_field_paths.py
+++ b/tests/unit/pipelex/core/concepts/test_concept_find_image_field_paths.py
@@ -60,7 +60,7 @@ def register_test_concepts(load_test_library: Callable[[list[Path]], None]):
# Create and register concepts
concepts_to_register: list[Concept] = [
ConceptFactory.make(
- domain=TestData.DOMAIN,
+ domain_code=TestData.DOMAIN,
concept_code=code,
description=description,
structure_class_name=structure_class_name,
@@ -76,8 +76,8 @@ def register_test_concepts(load_test_library: Callable[[list[Path]], None]):
yield
# Cleanup: Remove test concepts from library
- concept_strings = [concept.concept_string for concept in concepts_to_register]
- concept_library.remove_concepts_by_concept_strings(concept_strings)
+ concept_refs = [concept.concept_ref for concept in concepts_to_register]
+ concept_library.remove_concepts_by_concept_refs(concept_refs)
class TestConceptFindImageFieldPaths:
diff --git a/tests/unit/pipelex/core/concepts/test_helpers.py b/tests/unit/pipelex/core/concepts/test_helpers.py
index db5418353..26113965b 100644
--- a/tests/unit/pipelex/core/concepts/test_helpers.py
+++ b/tests/unit/pipelex/core/concepts/test_helpers.py
@@ -1,10 +1,10 @@
import pytest
-from pipelex.core.concepts.helpers import strip_multiplicity_from_concept_string_or_code
+from pipelex.core.concepts.helpers import strip_multiplicity_from_concept_ref_or_code
class TestStripMultiplicityFromConceptStringOrCode:
- """Test the strip_multiplicity_from_concept_string_or_code function."""
+ """Test the strip_multiplicity_from_concept_ref_or_code function."""
@pytest.mark.parametrize(
("input_string", "expected_output"),
@@ -55,5 +55,5 @@ class TestStripMultiplicityFromConceptStringOrCode:
- Concepts with multi-digit multiplicity [10-999]
- Concepts with large multiplicity [1000+]
"""
- result = strip_multiplicity_from_concept_string_or_code(input_string)
+ result = strip_multiplicity_from_concept_ref_or_code(input_string)
assert result == expected_output
diff --git a/tests/unit/pipelex/core/concepts/test_special_args_concept.py b/tests/unit/pipelex/core/concepts/test_special_args_concept.py
index 134d29147..2da73d6f4 100644
--- a/tests/unit/pipelex/core/concepts/test_special_args_concept.py
+++ b/tests/unit/pipelex/core/concepts/test_special_args_concept.py
@@ -30,7 +30,7 @@ class TestSpecialArgsConcept:
):
"""Test creating a concept with a 'content' field and running a pipe that uses it."""
load_empty_library()
- domain = "test"
+ domain_code = "test"
concept_library = get_concept_library()
# Create a ConceptBlueprint with a structure containing "content"
@@ -46,7 +46,7 @@ class TestSpecialArgsConcept:
# Make a Concept using ConceptFactory
concept = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code="ContentConcept",
blueprint_or_string_description=concept_blueprint,
)
@@ -54,7 +54,7 @@ class TestSpecialArgsConcept:
concept_library.add_new_concept(concept)
# Verify the concept was created
assert concept.code == "ContentConcept"
- assert concept.domain == domain
+ assert concept.domain_code == domain_code
assert concept.description == "A concept with content field"
# Create a PipeLLM that uses the content field
@@ -67,7 +67,7 @@ class TestSpecialArgsConcept:
# Make a PipeLLM using PipeFactory
pipe_llm = PipeFactory[PipeLLM].make_from_blueprint(
- domain_code=domain,
+ domain_code=domain_code,
pipe_code="test_pipe",
blueprint=pipe_llm_blueprint,
concept_codes_from_the_same_domain=[concept.code],
@@ -75,7 +75,7 @@ class TestSpecialArgsConcept:
# Verify the pipe was created
assert pipe_llm.code == "test_pipe"
- assert pipe_llm.domain == domain
+ assert pipe_llm.domain_code == domain_code
# Create content for the concept
content = StuffContentFactory.make_stuff_content_from_concept_required(
diff --git a/tests/unit/pipelex/core/memory/conftest.py b/tests/unit/pipelex/core/memory/conftest.py
index 920ca8b66..a7a7df7c1 100644
--- a/tests/unit/pipelex/core/memory/conftest.py
+++ b/tests/unit/pipelex/core/memory/conftest.py
@@ -159,7 +159,9 @@ def complex_list_memory() -> WorkingMemory:
)
complex_stuff = StuffFactory.make_stuff(
- concept=ConceptFactory.make(concept_code="List", domain=SpecialDomain.NATIVE, description="Lorem Ipsum", structure_class_name="ListContent"),
+ concept=ConceptFactory.make(
+ concept_code="List", domain_code=SpecialDomain.NATIVE, description="Lorem Ipsum", structure_class_name="ListContent"
+ ),
name="mixed_list",
content=complex_content,
)
@@ -193,7 +195,9 @@ def html_content_memory() -> WorkingMemory:
)
stuff = StuffFactory.make_stuff(
- concept=ConceptFactory.make(concept_code="Html", domain=SpecialDomain.NATIVE, description="Lorem Ipsum", structure_class_name="HtmlContent"),
+ concept=ConceptFactory.make(
+ concept_code="Html", domain_code=SpecialDomain.NATIVE, description="Lorem Ipsum", structure_class_name="HtmlContent"
+ ),
name="test_report",
content=html_content,
)
diff --git a/tests/unit/pipelex/core/memory/test_dry_working_memory.py b/tests/unit/pipelex/core/memory/test_dry_working_memory.py
index 680a99be2..c31535ca7 100644
--- a/tests/unit/pipelex/core/memory/test_dry_working_memory.py
+++ b/tests/unit/pipelex/core/memory/test_dry_working_memory.py
@@ -24,7 +24,7 @@ class TestDryWorkingMemory:
TypedNamedStuffSpec(
variable_name="page",
concept=ConceptFactory.make(
- concept_code=NativeConceptCode.PAGE, domain="test_tricky_questions", description="Lorem Ipsum", structure_class_name="Page"
+ concept_code=NativeConceptCode.PAGE, domain_code="test_tricky_questions", description="Lorem Ipsum", structure_class_name="Page"
),
structure_class=PageContent,
),
@@ -66,7 +66,7 @@ class TestDryWorkingMemory:
variable_name="thoughtful_answer",
concept=ConceptFactory.make(
concept_code="ThoughtfulAnswer",
- domain="test_tricky_questions",
+ domain_code="test_tricky_questions",
description="Thoughtful answer",
structure_class_name="ThoughtfulAnswer",
),
@@ -74,7 +74,7 @@ class TestDryWorkingMemory:
),
TypedNamedStuffSpec(
variable_name="question",
- concept=ConceptFactory.make(concept_code="Question", domain="answer", description="Question", structure_class_name="Question"),
+ concept=ConceptFactory.make(concept_code="Question", domain_code="answer", description="Question", structure_class_name="Question"),
structure_class=TextContent,
),
]
@@ -89,11 +89,11 @@ class TestDryWorkingMemory:
# Verify concept codes are preserved
thoughtful_answer_stuff = dry_memory.get_stuff("thoughtful_answer")
assert thoughtful_answer_stuff.concept.code == "ThoughtfulAnswer"
- assert thoughtful_answer_stuff.concept.domain == "test_tricky_questions"
+ assert thoughtful_answer_stuff.concept.domain_code == "test_tricky_questions"
question_stuff = dry_memory.get_stuff("question")
assert question_stuff.concept.code == "Question"
- assert question_stuff.concept.domain == "answer"
+ assert question_stuff.concept.domain_code == "answer"
# Verify structured content was created properly
thoughtful_answer_content = thoughtful_answer_stuff.content
@@ -123,7 +123,7 @@ class TestDryWorkingMemory:
variable_name="question_analysis",
concept=ConceptFactory.make(
concept_code="QuestionAnalysis",
- domain="test_tricky_questions",
+ domain_code="test_tricky_questions",
description="Question analysis",
structure_class_name="QuestionAnalysis",
),
@@ -133,7 +133,7 @@ class TestDryWorkingMemory:
variable_name="conclusion",
concept=ConceptFactory.make(
concept_code="ThoughtfulAnswerConclusion",
- domain="test_tricky_questions",
+ domain_code="test_tricky_questions",
description="Thoughtful answer conclusion",
structure_class_name="ThoughtfulAnswerConclusion",
),
@@ -155,7 +155,7 @@ class TestDryWorkingMemory:
conclusion_stuff = dry_memory.get_stuff("conclusion")
assert isinstance(conclusion_stuff.content, TextContent)
assert conclusion_stuff.concept.code == "ThoughtfulAnswerConclusion"
- assert conclusion_stuff.concept.domain == "test_tricky_questions"
+ assert conclusion_stuff.concept.domain_code == "test_tricky_questions"
log.info("Created mock working memory with TextContent fallback:")
dry_memory.pretty_print_summary()
@@ -171,7 +171,7 @@ class TestDryWorkingMemory:
variable_name="thoughtful_answer",
concept=ConceptFactory.make(
concept_code="ThoughtfulAnswer",
- domain="test_tricky_questions",
+ domain_code="test_tricky_questions",
description="Thoughtful answer",
structure_class_name="ThoughtfulAnswer",
),
@@ -179,14 +179,14 @@ class TestDryWorkingMemory:
),
TypedNamedStuffSpec(
variable_name="raw_question",
- concept=ConceptFactory.make(concept_code="Question", domain="answer", description="Question", structure_class_name="Question"),
+ concept=ConceptFactory.make(concept_code="Question", domain_code="answer", description="Question", structure_class_name="Question"),
structure_class=TextContent,
),
TypedNamedStuffSpec(
variable_name="analysis_result",
concept=ConceptFactory.make(
concept_code="QuestionAnalysis",
- domain="test_tricky_questions",
+ domain_code="test_tricky_questions",
description="Question analysis",
structure_class_name="QuestionAnalysis",
),
@@ -202,18 +202,18 @@ class TestDryWorkingMemory:
thoughtful_answer_stuff = dry_memory.get_stuff("thoughtful_answer")
assert isinstance(thoughtful_answer_stuff.content, ThoughtfulAnswer)
assert thoughtful_answer_stuff.concept.code == "ThoughtfulAnswer"
- assert thoughtful_answer_stuff.concept.domain == "test_tricky_questions"
+ assert thoughtful_answer_stuff.concept.domain_code == "test_tricky_questions"
# Verify text content
raw_question_stuff = dry_memory.get_stuff("raw_question")
assert isinstance(raw_question_stuff.content, TextContent)
assert raw_question_stuff.concept.code == "Question"
- assert raw_question_stuff.concept.domain == "answer"
+ assert raw_question_stuff.concept.domain_code == "answer"
analysis_result_stuff = dry_memory.get_stuff("analysis_result")
assert isinstance(analysis_result_stuff.content, TextContent)
assert analysis_result_stuff.concept.code == "QuestionAnalysis"
- assert analysis_result_stuff.concept.domain == "test_tricky_questions"
+ assert analysis_result_stuff.concept.domain_code == "test_tricky_questions"
log.info("Created mock working memory with mixed content types:")
dry_memory.pretty_print_summary()
@@ -242,14 +242,14 @@ class TestDryWorkingMemory:
needed_inputs = [
TypedNamedStuffSpec(
variable_name="question",
- concept=ConceptFactory.make(concept_code="Question", domain="answer", description="Question", structure_class_name="Question"),
+ concept=ConceptFactory.make(concept_code="Question", domain_code="answer", description="Question", structure_class_name="Question"),
structure_class=TextContent,
),
TypedNamedStuffSpec(
variable_name="question_analysis",
concept=ConceptFactory.make(
concept_code="QuestionAnalysis",
- domain="test_tricky_questions",
+ domain_code="test_tricky_questions",
description="Question analysis",
structure_class_name="QuestionAnalysis",
),
@@ -259,7 +259,7 @@ class TestDryWorkingMemory:
variable_name="thoughtful_answer",
concept=ConceptFactory.make(
concept_code="ThoughtfulAnswer",
- domain="test_tricky_questions",
+ domain_code="test_tricky_questions",
description="Thoughtful answer",
structure_class_name="ThoughtfulAnswer",
),
diff --git a/tests/unit/pipelex/core/memory/test_working_memory_typed_access.py b/tests/unit/pipelex/core/memory/test_working_memory_typed_access.py
index affaae68b..88bfd5f69 100644
--- a/tests/unit/pipelex/core/memory/test_working_memory_typed_access.py
+++ b/tests/unit/pipelex/core/memory/test_working_memory_typed_access.py
@@ -34,7 +34,7 @@ def nested_content_memory() -> WorkingMemory:
stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="Page",
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="A page with text and images",
structure_class_name="PageContent",
),
@@ -59,7 +59,7 @@ def nested_content_with_none_memory() -> WorkingMemory:
stuff = StuffFactory.make_stuff(
concept=ConceptFactory.make(
concept_code="Page",
- domain=SpecialDomain.NATIVE,
+ domain_code=SpecialDomain.NATIVE,
description="A page with minimal content",
structure_class_name="PageContent",
),
diff --git a/tests/unit/pipelex/core/pipes/data.py b/tests/unit/pipelex/core/pipes/data.py
index 3af1cc27f..4c151233d 100644
--- a/tests/unit/pipelex/core/pipes/data.py
+++ b/tests/unit/pipelex/core/pipes/data.py
@@ -25,7 +25,7 @@ MAKE_VARIABLE_MULTIPLICITY_TEST_CASES: list[tuple[int | None, bool | None, Varia
]
# Test cases for InputRequirementsFactory.make_from_string
-# Format: (domain, requirement_str, expected_concept_string, expected_multiplicity)
+# Format: (domain, requirement_str, expected_concept_ref, expected_multiplicity)
SINGLE_ITEM_NO_BRACKETS_TEST_CASES: list[tuple[str, str, str, int | bool | None]] = [
# Native domain tests with full concept strings
("native", "native.Text", "native.Text", None),
@@ -33,14 +33,14 @@ SINGLE_ITEM_NO_BRACKETS_TEST_CASES: list[tuple[str, str, str, int | bool | None]
("native", "native.PDF", "native.PDF", None),
]
-# Format: (domain, requirement_str, expected_concept_string)
+# Format: (domain, requirement_str, expected_concept_ref)
MULTIPLE_ITEMS_EMPTY_BRACKETS_TEST_CASES: list[tuple[str, str, str]] = [
# Native domain tests
("native", "native.Text[]", "native.Text"),
("native", "native.Image[]", "native.Image"),
]
-# Format: (domain, requirement_str, expected_concept_string, expected_multiplicity)
+# Format: (domain, requirement_str, expected_concept_ref, expected_multiplicity)
FIXED_COUNT_TEST_CASES: list[tuple[str, str, str, int]] = [
# Native domain tests
("native", "native.Text[5]", "native.Text", 5),
@@ -48,7 +48,7 @@ FIXED_COUNT_TEST_CASES: list[tuple[str, str, str, int]] = [
("native", "native.PDF[10]", "native.PDF", 10),
]
-# Format: (domain, requirement_str, concept_codes_from_same_domain, expected_concept_string, expected_multiplicity, description)
+# Format: (domain, requirement_str, concept_codes_from_same_domain, expected_concept_ref, expected_multiplicity, description)
CONCEPT_CODE_RESOLUTION_TEST_CASES: list[tuple[str, str, str, int | bool | None, str]] = [
# Native concepts resolved from concept code only (no multiplicity)
("native", "Text", "native.Text", None, "Native Text without brackets"),
@@ -62,7 +62,7 @@ CONCEPT_CODE_RESOLUTION_TEST_CASES: list[tuple[str, str, str, int | bool | None,
("accounting", "Text[3]", "native.Text", 3, "Native always wins"),
]
-# Format: (domain, requirement_str, expected_concept_string, expected_multiplicity)
+# Format: (domain, requirement_str, expected_concept_ref, expected_multiplicity)
EXPLICIT_DOMAIN_IN_STRING_TEST_CASES: list[tuple[str, str, str, int | bool | None]] = [
# Explicitly specifying native domain in string
("my_domain", "native.Text", "native.Text", None),
@@ -70,7 +70,7 @@ EXPLICIT_DOMAIN_IN_STRING_TEST_CASES: list[tuple[str, str, str, int | bool | Non
("test_domain", "native.PDF[]", "native.PDF", True),
]
-# Format: (domain, requirement_str, expected_concept_string, expected_multiplicity)
+# Format: (domain, requirement_str, expected_concept_ref, expected_multiplicity)
VARIOUS_FIXED_COUNTS_TEST_CASES: list[tuple[str, str, str, int]] = [
# Native domain with various counts
("native", "native.Image[1]", "native.Image", 1),
@@ -80,7 +80,7 @@ VARIOUS_FIXED_COUNTS_TEST_CASES: list[tuple[str, str, str, int]] = [
("native", "native.Image[999]", "native.Image", 999),
]
-# Format: (domain, requirement_str, expected_concept_string)
+# Format: (domain, requirement_str, expected_concept_ref)
DIFFERENT_CONCEPT_CODES_TEST_CASES: list[tuple[str, str, str]] = [
# Native concepts
("native", "native.Text", "native.Text"),
diff --git a/tests/unit/pipelex/core/pipes/test_input_requirements_factory.py b/tests/unit/pipelex/core/pipes/test_input_requirements_factory.py
index cbe37d3ff..bddea91bc 100644
--- a/tests/unit/pipelex/core/pipes/test_input_requirements_factory.py
+++ b/tests/unit/pipelex/core/pipes/test_input_requirements_factory.py
@@ -21,77 +21,77 @@ class TestMakeInputRequirementsFromString:
"""Test the InputStuffSpecsFactory.make_from_str method."""
@pytest.mark.parametrize(
- ("domain", "stuff_spec_str", "expected_concept_string", "expected_multiplicity"),
+ ("domain_code", "stuff_spec_str", "expected_concept_ref", "expected_multiplicity"),
SINGLE_ITEM_NO_BRACKETS_TEST_CASES,
)
def test_single_item_default_no_brackets(
self,
- domain: str,
+ domain_code: str,
stuff_spec_str: str,
- expected_concept_string: str,
+ expected_concept_ref: str,
expected_multiplicity: int | bool | None,
load_empty_library: Callable[[], None],
):
"""Test parsing a concept string without brackets (single item, default)."""
load_empty_library()
- result = InputStuffSpecsFactory.make_from_string(domain=domain, stuff_spec_str=stuff_spec_str)
+ result = InputStuffSpecsFactory.make_from_string(domain_code=domain_code, stuff_spec_str=stuff_spec_str)
assert isinstance(result, StuffSpec)
- assert result.concept.concept_string == expected_concept_string
+ assert result.concept.concept_ref == expected_concept_ref
assert result.multiplicity == expected_multiplicity
@pytest.mark.parametrize(
- ("domain", "stuff_spec_str", "expected_concept_string"),
+ ("domain_code", "stuff_spec_str", "expected_concept_ref"),
MULTIPLE_ITEMS_EMPTY_BRACKETS_TEST_CASES,
)
def test_multiple_items_with_empty_brackets(
- self, domain: str, stuff_spec_str: str, expected_concept_string: str, load_empty_library: Callable[[], None]
+ self, domain_code: str, stuff_spec_str: str, expected_concept_ref: str, load_empty_library: Callable[[], None]
):
load_empty_library()
"""Test parsing a concept string with empty brackets (multiple items)."""
- result = InputStuffSpecsFactory.make_from_string(domain=domain, stuff_spec_str=stuff_spec_str)
+ result = InputStuffSpecsFactory.make_from_string(domain_code=domain_code, stuff_spec_str=stuff_spec_str)
assert isinstance(result, StuffSpec)
- assert result.concept.concept_string == expected_concept_string
+ assert result.concept.concept_ref == expected_concept_ref
assert result.multiplicity is True
@pytest.mark.parametrize(
- ("domain", "stuff_spec_str", "expected_concept_string", "expected_multiplicity"),
+ ("domain_code", "stuff_spec_str", "expected_concept_ref", "expected_multiplicity"),
FIXED_COUNT_TEST_CASES,
)
def test_fixed_count_with_number_in_brackets(
- self, domain: str, stuff_spec_str: str, expected_concept_string: str, expected_multiplicity: int, load_empty_library: Callable[[], None]
+ self, domain_code: str, stuff_spec_str: str, expected_concept_ref: str, expected_multiplicity: int, load_empty_library: Callable[[], None]
):
"""Test parsing a concept string with a number in brackets (fixed count)."""
load_empty_library()
- result = InputStuffSpecsFactory.make_from_string(domain=domain, stuff_spec_str=stuff_spec_str)
+ result = InputStuffSpecsFactory.make_from_string(domain_code=domain_code, stuff_spec_str=stuff_spec_str)
assert isinstance(result, StuffSpec)
- assert result.concept.concept_string == expected_concept_string
+ assert result.concept.concept_ref == expected_concept_ref
assert result.multiplicity == expected_multiplicity
@pytest.mark.parametrize(
- ("domain", "stuff_spec_str", "expected_concept_string", "expected_multiplicity"),
+ ("domain_code", "stuff_spec_str", "expected_concept_ref", "expected_multiplicity"),
VARIOUS_FIXED_COUNTS_TEST_CASES,
)
def test_various_fixed_counts(
- self, domain: str, stuff_spec_str: str, expected_concept_string: str, expected_multiplicity: int, load_empty_library: Callable[[], None]
+ self, domain_code: str, stuff_spec_str: str, expected_concept_ref: str, expected_multiplicity: int, load_empty_library: Callable[[], None]
):
load_empty_library()
"""Test parsing concept strings with various numbers in brackets."""
- result = InputStuffSpecsFactory.make_from_string(domain=domain, stuff_spec_str=stuff_spec_str)
+ result = InputStuffSpecsFactory.make_from_string(domain_code=domain_code, stuff_spec_str=stuff_spec_str)
assert result.multiplicity == expected_multiplicity, f"Failed for {stuff_spec_str}"
- assert result.concept.concept_string == expected_concept_string
+ assert result.concept.concept_ref == expected_concept_ref
@pytest.mark.parametrize(
- ("domain", "stuff_spec_str", "expected_concept_string"),
+ ("domain_code", "stuff_spec_str", "expected_concept_ref"),
DIFFERENT_CONCEPT_CODES_TEST_CASES,
)
- def test_different_concept_codes(self, domain: str, stuff_spec_str: str, expected_concept_string: str, load_empty_library: Callable[[], None]):
+ def test_different_concept_codes(self, domain_code: str, stuff_spec_str: str, expected_concept_ref: str, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test parsing various concept codes without multiplicity."""
- result = InputStuffSpecsFactory.make_from_string(domain=domain, stuff_spec_str=stuff_spec_str)
- assert result.concept.concept_string == expected_concept_string
+ result = InputStuffSpecsFactory.make_from_string(domain_code=domain_code, stuff_spec_str=stuff_spec_str)
+ assert result.concept.concept_ref == expected_concept_ref
assert result.multiplicity is None
def test_custom_domain_concepts(self, load_empty_library: Callable[[], None]):
@@ -99,27 +99,27 @@ class TestMakeInputRequirementsFromString:
"""Test parsing concept codes from custom domains."""
# Note: This test will only work if these concepts exist in the system
# For now, we'll test with native concepts, but the pattern should work for any domain
- result = InputStuffSpecsFactory.make_from_string(domain="native", stuff_spec_str="native.Text[3]")
- assert result.concept.concept_string == "native.Text"
+ result = InputStuffSpecsFactory.make_from_string(domain_code="native", stuff_spec_str="native.Text[3]")
+ assert result.concept.concept_ref == "native.Text"
assert result.multiplicity == 3
def test_concept_not_found_raises_error(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test that an invalid concept code raises ConceptLibraryConceptNotFoundError."""
with pytest.raises(ConceptLibraryError):
- InputStuffSpecsFactory.make_from_string(domain="nonexistent", stuff_spec_str="nonexistent.InvalidConcept")
+ InputStuffSpecsFactory.make_from_string(domain_code="nonexistent", stuff_spec_str="nonexistent.InvalidConcept")
def test_concept_not_found_with_multiplicity_raises_error(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test that an invalid concept code with multiplicity raises ConceptLibraryConceptNotFoundError."""
with pytest.raises(ConceptLibraryError):
- InputStuffSpecsFactory.make_from_string(domain="nonexistent", stuff_spec_str="nonexistent.InvalidConcept[5]")
+ InputStuffSpecsFactory.make_from_string(domain_code="nonexistent", stuff_spec_str="nonexistent.InvalidConcept[5]")
def test_empty_string_raises_value_error(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test that an empty string raises InputStuffSpecsFactorySyntaxError."""
with pytest.raises(InputStuffSpecsFactoryError, match="Invalid input stuff spec string") as exc_info:
- InputStuffSpecsFactory.make_from_string(domain="native", stuff_spec_str="")
+ InputStuffSpecsFactory.make_from_string(domain_code="native", stuff_spec_str="")
# This error is raised directly without a cause
assert exc_info.value.__cause__ is None
@@ -129,55 +129,55 @@ class TestMakeInputRequirementsFromString:
# The regex will match "native.Text[abc]" as concept="native.Text[abc]", multiplicity=None
# This will then fail during concept validation with ConceptCodeError
with pytest.raises(InputStuffSpecsFactoryError) as exc_info:
- InputStuffSpecsFactory.make_from_string(domain="native", stuff_spec_str="native.Text[abc]")
+ InputStuffSpecsFactory.make_from_string(domain_code="native", stuff_spec_str="native.Text[abc]")
assert exc_info.value.__cause__ is not None
assert isinstance(exc_info.value.__cause__, ConceptStringError)
def test_multiplicity_zero_in_brackets(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test parsing a concept string with 0 in brackets."""
- result = InputStuffSpecsFactory.make_from_string(domain="native", stuff_spec_str="native.Text[0]")
+ result = InputStuffSpecsFactory.make_from_string(domain_code="native", stuff_spec_str="native.Text[0]")
assert isinstance(result, StuffSpec)
- assert result.concept.concept_string == "native.Text"
+ assert result.concept.concept_ref == "native.Text"
assert result.multiplicity == 0
def test_return_type(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test that the method returns an StuffSpec instance."""
- result = InputStuffSpecsFactory.make_from_string(domain="native", stuff_spec_str="native.Text")
+ result = InputStuffSpecsFactory.make_from_string(domain_code="native", stuff_spec_str="native.Text")
assert isinstance(result, StuffSpec)
def test_concept_attribute_access(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test that the returned StuffSpec has proper concept attributes."""
- result = InputStuffSpecsFactory.make_from_string(domain="native", stuff_spec_str="native.Text[5]")
+ result = InputStuffSpecsFactory.make_from_string(domain_code="native", stuff_spec_str="native.Text[5]")
assert hasattr(result, "concept")
assert hasattr(result, "multiplicity")
- assert result.concept.concept_string == "native.Text"
+ assert result.concept.concept_ref == "native.Text"
assert result.concept.code == "Text"
def test_edge_case_very_long_number(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test parsing with a very long number in brackets."""
- result = InputStuffSpecsFactory.make_from_string(domain="native", stuff_spec_str="native.Text[999999]")
+ result = InputStuffSpecsFactory.make_from_string(domain_code="native", stuff_spec_str="native.Text[999999]")
assert result.multiplicity == 999999
- assert result.concept.concept_string == "native.Text"
+ assert result.concept.concept_ref == "native.Text"
def test_whitespace_not_trimmed(self, load_empty_library: Callable[[], None]):
load_empty_library()
"""Test that whitespace is not automatically trimmed."""
# Whitespace should cause domain validation to fail
with pytest.raises(InputStuffSpecsFactoryError) as exc_info:
- InputStuffSpecsFactory.make_from_string(domain="native", stuff_spec_str=" native.Text")
+ InputStuffSpecsFactory.make_from_string(domain_code="native", stuff_spec_str=" native.Text")
assert exc_info.value.__cause__ is not None
assert isinstance(exc_info.value.__cause__, ConceptStringError)
# Trailing whitespace should cause concept code validation to fail
with pytest.raises(InputStuffSpecsFactoryError) as exc_info:
- InputStuffSpecsFactory.make_from_string(domain="native", stuff_spec_str="native.Text ")
+ InputStuffSpecsFactory.make_from_string(domain_code="native", stuff_spec_str="native.Text ")
assert exc_info.value.__cause__ is not None
assert isinstance(exc_info.value.__cause__, ConceptStringError)
@@ -187,7 +187,7 @@ class TestMakeInputRequirementsFromString:
# "native.Text[5][10]" should match as concept="native.Text[5]", multiplicity=10
# This will fail during concept code validation
with pytest.raises(InputStuffSpecsFactoryError) as exc_info:
- InputStuffSpecsFactory.make_from_string(domain="native", stuff_spec_str="native.Text[5][10]")
+ InputStuffSpecsFactory.make_from_string(domain_code="native", stuff_spec_str="native.Text[5][10]")
assert exc_info.value.__cause__ is not None
assert isinstance(exc_info.value.__cause__, ConceptStringError)
@@ -196,19 +196,19 @@ class TestMakeInputRequirementsFromString:
"""Test that brackets at the start are part of the concept name."""
# This will fail during domain validation
with pytest.raises(InputStuffSpecsFactoryError) as exc_info:
- InputStuffSpecsFactory.make_from_string(domain="native", stuff_spec_str="[5]native.Text")
+ InputStuffSpecsFactory.make_from_string(domain_code="native", stuff_spec_str="[5]native.Text")
assert exc_info.value.__cause__ is not None
assert isinstance(exc_info.value.__cause__, ConceptStringError)
@pytest.mark.parametrize(
- ("domain", "stuff_spec_str", "expected_concept_string", "expected_multiplicity", "description"),
+ ("domain_code", "stuff_spec_str", "expected_concept_ref", "expected_multiplicity", "description"),
CONCEPT_CODE_RESOLUTION_TEST_CASES,
)
def test_concept_code_resolution(
self,
- domain: str,
+ domain_code: str,
stuff_spec_str: str,
- expected_concept_string: str,
+ expected_concept_ref: str,
expected_multiplicity: int | bool | None,
description: str,
load_empty_library: Callable[[], None],
@@ -221,33 +221,33 @@ class TestMakeInputRequirementsFromString:
"""
load_empty_library()
result = InputStuffSpecsFactory.make_from_string(
- domain=domain,
+ domain_code=domain_code,
stuff_spec_str=stuff_spec_str,
)
assert isinstance(result, StuffSpec)
- assert result.concept.concept_string == expected_concept_string, f"Failed: {description}"
+ assert result.concept.concept_ref == expected_concept_ref, f"Failed: {description}"
assert result.multiplicity == expected_multiplicity, f"Failed: {description}"
@pytest.mark.parametrize(
- ("domain", "stuff_spec_str", "expected_concept_string", "expected_multiplicity"),
+ ("domain_code", "stuff_spec_str", "expected_concept_ref", "expected_multiplicity"),
EXPLICIT_DOMAIN_IN_STRING_TEST_CASES,
)
def test_explicit_domain_in_string(
self,
- domain: str,
+ domain_code: str,
stuff_spec_str: str,
- expected_concept_string: str,
+ expected_concept_ref: str,
expected_multiplicity: int | bool | None,
load_empty_library: Callable[[], None],
):
"""Test that explicitly specifying a domain in the requirement string works correctly."""
load_empty_library()
result = InputStuffSpecsFactory.make_from_string(
- domain=domain,
+ domain_code=domain_code,
stuff_spec_str=stuff_spec_str,
)
assert isinstance(result, StuffSpec)
- assert result.concept.concept_string == expected_concept_string
+ assert result.concept.concept_ref == expected_concept_ref
assert result.multiplicity == expected_multiplicity
diff --git a/tests/unit/pipelex/core/stuffs/data.py b/tests/unit/pipelex/core/stuffs/data.py
index 7b41b56b6..a9bc788f6 100644
--- a/tests/unit/pipelex/core/stuffs/data.py
+++ b/tests/unit/pipelex/core/stuffs/data.py
@@ -114,7 +114,7 @@ TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, Stuff]] = [
stuff_name="stuff_name",
concept=ConceptFactory.make(
concept_code="MyConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for unit tests",
structure_class_name="MyConcept",
),
@@ -135,7 +135,7 @@ TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, Stuff]] = [
stuff_code="stuff_code",
concept=ConceptFactory.make(
concept_code="MyConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for unit tests",
structure_class_name="MyConcept",
),
@@ -162,7 +162,7 @@ TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, Stuff]] = [
stuff_code="stuff_code",
concept=ConceptFactory.make(
concept_code="MyConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for unit tests",
structure_class_name="MyConcept",
),
@@ -210,7 +210,7 @@ TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, Stuff]] = [
stuff_code="stuff_code",
stuff_name="stuff_name",
concept=ConceptFactory.make(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="MyConceptNotNativeText",
description="Test concept for unit tests",
structure_class_name="MyConceptNotNativeText",
@@ -248,7 +248,7 @@ TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, Stuff]] = [
stuff_code="stuff_code",
stuff_name="stuff_name",
concept=ConceptFactory.make(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="MyConceptNotNativeText",
description="Test concept for unit tests",
structure_class_name="MyConceptNotNativeText",
@@ -277,7 +277,7 @@ TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, Stuff]] = [
stuff_name="stuff_name",
concept=ConceptFactory.make(
concept_code="MyConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for unit tests",
structure_class_name="MyConcept",
),
@@ -301,7 +301,7 @@ TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, Stuff]] = [
stuff_code="stuff_code",
concept=ConceptFactory.make(
concept_code="MyConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for unit tests",
structure_class_name="MyConcept",
),
@@ -331,7 +331,7 @@ TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, Stuff]] = [
stuff_name="stuff_name",
concept=ConceptFactory.make(
concept_code="MyConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for unit tests",
structure_class_name="MyConcept",
),
@@ -363,7 +363,7 @@ TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, Stuff]] = [
stuff_code="stuff_code",
concept=ConceptFactory.make(
concept_code="MyConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for unit tests",
structure_class_name="MyConcept",
),
@@ -393,7 +393,7 @@ TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, Stuff]] = [
stuff_code="stuff_code",
concept=ConceptFactory.make(
concept_code="MyConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for unit tests",
structure_class_name="MyConcept",
),
@@ -441,7 +441,7 @@ TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, Stuff]] = [
stuff_code="stuff_code",
concept=ConceptFactory.make(
concept_code="MyConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for unit tests",
structure_class_name="MyConcept",
),
@@ -492,7 +492,7 @@ SEARCH_DOMAIN_TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, l
stuff_code="stuff_code",
concept=ConceptFactory.make(
concept_code="AnotherConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for search domains",
structure_class_name="AnotherConcept",
),
@@ -514,7 +514,7 @@ SEARCH_DOMAIN_TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, l
stuff_code="stuff_code",
concept=ConceptFactory.make(
concept_code="AnotherConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for search domains",
structure_class_name="AnotherConcept",
),
@@ -543,7 +543,7 @@ SEARCH_DOMAIN_TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, l
stuff_code="stuff_code",
concept=ConceptFactory.make(
concept_code="AnotherConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for search domains",
structure_class_name="AnotherConcept",
),
@@ -570,7 +570,7 @@ SEARCH_DOMAIN_TEST_CASES: list[tuple[str, StuffContentOrData, str | None, str, l
stuff_code="stuff_code",
concept=ConceptFactory.make(
concept_code="AnotherConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for search domains",
structure_class_name="AnotherConcept",
),
diff --git a/tests/unit/pipelex/core/stuffs/test_special_args.py b/tests/unit/pipelex/core/stuffs/test_special_args.py
index bd3fcc572..68e67a7ff 100644
--- a/tests/unit/pipelex/core/stuffs/test_special_args.py
+++ b/tests/unit/pipelex/core/stuffs/test_special_args.py
@@ -53,7 +53,7 @@ class TestSpecialArgsStuff:
These don't conflict because internal metadata fields use underscore prefixes.
"""
load_empty_library()
- domain = "test"
+ domain_code = "test"
concept_library = get_concept_library()
# Create a ConceptBlueprint with a structure containing the field name
@@ -69,7 +69,7 @@ class TestSpecialArgsStuff:
# Make a Concept using ConceptFactory
concept = ConceptFactory.make_from_blueprint(
- domain=domain,
+ domain_code=domain_code,
concept_code=f"Concept{field_name.replace('_', '').title()}",
blueprint_or_string_description=concept_blueprint,
)
diff --git a/tests/unit/pipelex/core/stuffs/test_stuff_content_factory.py b/tests/unit/pipelex/core/stuffs/test_stuff_content_factory.py
index bdea9f274..ef387685b 100644
--- a/tests/unit/pipelex/core/stuffs/test_stuff_content_factory.py
+++ b/tests/unit/pipelex/core/stuffs/test_stuff_content_factory.py
@@ -15,25 +15,25 @@ from pipelex.core.stuffs.text_content import TextContent
class TestCases:
# Test cases for TextContent with string content
TEXT_STRING_BLUEPRINT: ClassVar[dict[str, Any]] = {
- "concept_string": f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}",
+ "concept_ref": f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}",
"content": "The Dawn of Ultra-Rapid Transit: NextGen High-Speed Trains Redefine Travel",
}
# Test cases for TextContent with dict content
TEXT_DICT_BLUEPRINT: ClassVar[dict[str, Any]] = {
- "concept_string": f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}",
+ "concept_ref": f"{SpecialDomain.NATIVE}.{NativeConceptCode.TEXT}",
"content": {"text": "Sample text content"},
}
# Test cases for native concept without prefix (should work)
TEXT_NO_PREFIX_BLUEPRINT: ClassVar[dict[str, Any]] = {
- "concept_string": f"{NativeConceptCode.TEXT}",
+ "concept_ref": f"{NativeConceptCode.TEXT}",
"content": {"text": "Text content without native prefix"},
}
# Test cases for registered class (using actual registered class)
REGISTERED_CLASS_BLUEPRINT: ClassVar[dict[str, Any]] = {
- "concept_string": "test.MockRegisteredContent",
+ "concept_ref": "test.MockRegisteredContent",
"content": {"title": "Test Question", "description": "What are aerodynamic features?"},
}
diff --git a/tests/unit/pipelex/core/stuffs/test_stuff_factory_implicit_memory.py b/tests/unit/pipelex/core/stuffs/test_stuff_factory_implicit_memory.py
index 217c9d36b..673c38d85 100644
--- a/tests/unit/pipelex/core/stuffs/test_stuff_factory_implicit_memory.py
+++ b/tests/unit/pipelex/core/stuffs/test_stuff_factory_implicit_memory.py
@@ -31,7 +31,7 @@ def setup_test_concept(load_test_library: Callable[[list[Path]], None]):
# Create the concept
concept = ConceptFactory.make(
concept_code="MyConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for unit tests",
structure_class_name="MyConcept",
)
@@ -40,7 +40,7 @@ def setup_test_concept(load_test_library: Callable[[list[Path]], None]):
# Create a concept that is not native.Text but initiable by str
concept_not_native_text = ConceptFactory.make(
- domain="test_domain",
+ domain_code="test_domain",
concept_code="MyConceptNotNativeText",
description="Test concept for unit tests",
structure_class_name="MyConceptNotNativeText",
@@ -51,7 +51,7 @@ def setup_test_concept(load_test_library: Callable[[list[Path]], None]):
# Create AnotherConcept for search domain tests
concept_another = ConceptFactory.make(
concept_code="AnotherConcept",
- domain="test_domain",
+ domain_code="test_domain",
description="Test concept for search domains",
structure_class_name="AnotherConcept",
)
@@ -60,8 +60,8 @@ def setup_test_concept(load_test_library: Callable[[list[Path]], None]):
yield concept
# Cleanup after test
- concept_library.remove_concepts_by_concept_strings(
- concept_strings=["test_domain.MyConcept", "test_domain.MyConceptNotNativeText", "test_domain.AnotherConcept"]
+ concept_library.remove_concepts_by_concept_refs(
+ concept_refs=["test_domain.MyConcept", "test_domain.MyConceptNotNativeText", "test_domain.AnotherConcept"]
)
@@ -116,11 +116,11 @@ class TestStuffFactoryImplicitMemory:
class TestStuffFactoryImplicitMemoryWithSearchDomains:
"""Test StuffFactory with search_domains parameter.
- This tests that search_domains correctly resolves concepts.
+ This tests that search_domain_codes correctly resolves concepts.
"""
@pytest.mark.parametrize(
- ("test_name", "stuff_content_or_data", "stuff_name", "stuff_code", "search_domains", "expected_stuff"),
+ ("test_name", "stuff_content_or_data", "stuff_name", "stuff_code", "search_domain_codes", "expected_stuff"),
SEARCH_DOMAIN_TEST_CASES,
)
def test_search_domain_case(
@@ -130,7 +130,7 @@ class TestStuffFactoryImplicitMemoryWithSearchDomains:
stuff_content_or_data: StuffContentOrData,
stuff_name: str | None,
stuff_code: str,
- search_domains: list[str],
+ search_domain_codes: list[str],
expected_stuff: Stuff,
):
log.info(f"Testing search domain case: {test_name}")
@@ -139,7 +139,7 @@ class TestStuffFactoryImplicitMemoryWithSearchDomains:
name=stuff_name,
code=stuff_code,
stuff_content_or_data=stuff_content_or_data,
- search_domains=search_domains,
+ search_domain_codes=search_domain_codes,
)
pretty_print(result, title=f"Result for test case: {test_name}")
@@ -155,7 +155,7 @@ class TestStuffFactoryImplicitMemoryErrors:
"""
@pytest.mark.parametrize(
- ("test_name", "stuff_content_or_data", "stuff_name", "stuff_code", "search_domains", "expected_exception", "error_match"),
+ ("test_name", "stuff_content_or_data", "stuff_name", "stuff_code", "search_domain_codes", "expected_exception", "error_match"),
ERROR_TEST_CASES,
)
def test_error_case(
@@ -165,7 +165,7 @@ class TestStuffFactoryImplicitMemoryErrors:
stuff_content_or_data: StuffContentOrData,
stuff_name: str | None,
stuff_code: str,
- search_domains: list[str] | None,
+ search_domain_codes: list[str] | None,
expected_exception: type[Exception],
error_match: str,
):
@@ -177,5 +177,5 @@ class TestStuffFactoryImplicitMemoryErrors:
name=stuff_name,
code=stuff_code,
stuff_content_or_data=stuff_content_or_data,
- search_domains=search_domains,
+ search_domain_codes=search_domain_codes,
)
diff --git a/tests/unit/pipelex/tools/misc/test_toml_utils.py b/tests/unit/pipelex/tools/misc/test_toml_utils.py
index 46f3fab04..baff9a362 100644
--- a/tests/unit/pipelex/tools/misc/test_toml_utils.py
+++ b/tests/unit/pipelex/tools/misc/test_toml_utils.py
@@ -46,7 +46,7 @@ description = "Test"
def test_validate_toml_file_trailing_space_after_triple_quotes(self, tmp_path: Path) -> None:
"""Test detection of trailing whitespace after triple quotes."""
- toml_content = '''domain = "test"
+ toml_content = '''domain_code = "test"
[pipe.test_pipe]
type = "PipeLLM"
@@ -64,7 +64,7 @@ Output this only: "test"
# Create content with explicit mixed line endings - use binary mode to ensure exact control
toml_file = tmp_path / "mixed_endings.toml"
# Write content with mixed line endings directly in binary mode
- mixed_content = b'domain = "test"\r\\description = "Test"\nextra = "value"\n'
+ mixed_content = b'domain_code = "test"\r\\description = "Test"\nextra = "value"\n'
toml_file.write_bytes(mixed_content)
def test_load_toml_from_path_no_validation_by_default(self, tmp_path: Path) -> None:
@@ -144,7 +144,7 @@ Output: "test"
def test_validate_toml_file_pipe_condition_real_case(self, tmp_path: Path) -> None:
"""Test the exact scenario from pipe_condition_2.toml with trailing space after triple quotes."""
- toml_content = '''domain = "test_pipe_condition_2"
+ toml_content = '''domain_code = "test_pipe_condition_2"
description = "Simple test for PipeCondition functionality using expression"
[concept]