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.
Documentation update 1 (#423)
Thomas Hebrard01750d782196
diff --git a/.blackboxrules b/.blackboxrulesindex 9f0a61293..23c6f20aa 100644--- a/.blackboxrules+++ b/.blackboxrules@@ -1,6 +1,4 @@<!-- BEGIN_PIPELEX_RULES -->-# Pipelex Rules-## Guide to write or edit pipelines using the Pipelex language in .plx files- Always first write your "plan" in natural language, then transcribe it in pipelex.@@ -127,16 +125,16 @@ For concepts with structured fields, define them inline using TOML syntax:description = "A commercial document issued by a seller to a buyer"[concept.Invoice.structure]-invoice_number = "The unique invoice identifier"+invoice_number = "The unique invoice identifier" # This will be optional by defaultissue_date = { type = "date", description = "The date the invoice was issued", required = true }total_amount = { type = "number", description = "The total invoice amount", required = true }-vendor_name = "The name of the vendor"-line_items = { type = "list", item_type = "text", description = "List of items", required = false }+vendor_name = "The name of the vendor" # This will be optional by default+line_items = { type = "list", item_type = "text", description = "List of items" }```**Supported inline field types:** `text`, `integer`, `boolean`, `number`, `date`, `list`, `dict`-**Field properties:** `type`, `description`, `required` (default: true), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)+**Field properties:** `type`, `description`, `required` (default: false), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)**Simple syntax** (creates required text field):```plx@@ -145,7 +143,7 @@ field_name = "Field description"**Detailed syntax** (with explicit properties):```plx-field_name = { type = "text", description = "Field description", required = false, default_value = "default" }+field_name = { type = "text", description = "Field description", default_value = "default" }```**3. Python StructuredContent Class (For Advanced Features)**diff --git a/.cursor/rules/write_pipelex.mdc b/.cursor/rules/write_pipelex.mdcindex 2d977d3af..c64d617ee 100644--- a/.cursor/rules/write_pipelex.mdc+++ b/.cursor/rules/write_pipelex.mdc@@ -131,16 +131,16 @@ For concepts with structured fields, define them inline using TOML syntax:description = "A commercial document issued by a seller to a buyer"[concept.Invoice.structure]-invoice_number = "The unique invoice identifier"+invoice_number = "The unique invoice identifier" # This will be optional by defaultissue_date = { type = "date", description = "The date the invoice was issued", required = true }total_amount = { type = "number", description = "The total invoice amount", required = true }-vendor_name = "The name of the vendor"-line_items = { type = "list", item_type = "text", description = "List of items", required = false }+vendor_name = "The name of the vendor" # This will be optional by default+line_items = { type = "list", item_type = "text", description = "List of items" }```**Supported inline field types:** `text`, `integer`, `boolean`, `number`, `date`, `list`, `dict`-**Field properties:** `type`, `description`, `required` (default: true), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)+**Field properties:** `type`, `description`, `required` (default: false), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)**Simple syntax** (creates required text field):```plx@@ -149,7 +149,7 @@ field_name = "Field description"**Detailed syntax** (with explicit properties):```plx-field_name = { type = "text", description = "Field description", required = false, default_value = "default" }+field_name = { type = "text", description = "Field description", default_value = "default" }```**3. Python StructuredContent Class (For Advanced Features)**diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.mdindex 9f0a61293..23c6f20aa 100644--- a/.github/copilot-instructions.md+++ b/.github/copilot-instructions.md@@ -1,6 +1,4 @@<!-- BEGIN_PIPELEX_RULES -->-# Pipelex Rules-## Guide to write or edit pipelines using the Pipelex language in .plx files- Always first write your "plan" in natural language, then transcribe it in pipelex.@@ -127,16 +125,16 @@ For concepts with structured fields, define them inline using TOML syntax:description = "A commercial document issued by a seller to a buyer"[concept.Invoice.structure]-invoice_number = "The unique invoice identifier"+invoice_number = "The unique invoice identifier" # This will be optional by defaultissue_date = { type = "date", description = "The date the invoice was issued", required = true }total_amount = { type = "number", description = "The total invoice amount", required = true }-vendor_name = "The name of the vendor"-line_items = { type = "list", item_type = "text", description = "List of items", required = false }+vendor_name = "The name of the vendor" # This will be optional by default+line_items = { type = "list", item_type = "text", description = "List of items" }```**Supported inline field types:** `text`, `integer`, `boolean`, `number`, `date`, `list`, `dict`-**Field properties:** `type`, `description`, `required` (default: true), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)+**Field properties:** `type`, `description`, `required` (default: false), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)**Simple syntax** (creates required text field):```plx@@ -145,7 +143,7 @@ field_name = "Field description"**Detailed syntax** (with explicit properties):```plx-field_name = { type = "text", description = "Field description", required = false, default_value = "default" }+field_name = { type = "text", description = "Field description", default_value = "default" }```**3. Python StructuredContent Class (For Advanced Features)**diff --git a/.windsurfrules.md b/.windsurfrules.mdindex 9f0a61293..23c6f20aa 100644--- a/.windsurfrules.md+++ b/.windsurfrules.md@@ -1,6 +1,4 @@<!-- BEGIN_PIPELEX_RULES -->-# Pipelex Rules-## Guide to write or edit pipelines using the Pipelex language in .plx files- Always first write your "plan" in natural language, then transcribe it in pipelex.@@ -127,16 +125,16 @@ For concepts with structured fields, define them inline using TOML syntax:description = "A commercial document issued by a seller to a buyer"[concept.Invoice.structure]-invoice_number = "The unique invoice identifier"+invoice_number = "The unique invoice identifier" # This will be optional by defaultissue_date = { type = "date", description = "The date the invoice was issued", required = true }total_amount = { type = "number", description = "The total invoice amount", required = true }-vendor_name = "The name of the vendor"-line_items = { type = "list", item_type = "text", description = "List of items", required = false }+vendor_name = "The name of the vendor" # This will be optional by default+line_items = { type = "list", item_type = "text", description = "List of items" }```**Supported inline field types:** `text`, `integer`, `boolean`, `number`, `date`, `list`, `dict`-**Field properties:** `type`, `description`, `required` (default: true), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)+**Field properties:** `type`, `description`, `required` (default: false), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)**Simple syntax** (creates required text field):```plx@@ -145,7 +143,7 @@ field_name = "Field description"**Detailed syntax** (with explicit properties):```plx-field_name = { type = "text", description = "Field description", required = false, default_value = "default" }+field_name = { type = "text", description = "Field description", default_value = "default" }```**3. Python StructuredContent Class (For Advanced Features)**diff --git a/AGENTS.md b/AGENTS.mdindex 9f0a61293..23c6f20aa 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,6 +1,4 @@<!-- BEGIN_PIPELEX_RULES -->-# Pipelex Rules-## Guide to write or edit pipelines using the Pipelex language in .plx files- Always first write your "plan" in natural language, then transcribe it in pipelex.@@ -127,16 +125,16 @@ For concepts with structured fields, define them inline using TOML syntax:description = "A commercial document issued by a seller to a buyer"[concept.Invoice.structure]-invoice_number = "The unique invoice identifier"+invoice_number = "The unique invoice identifier" # This will be optional by defaultissue_date = { type = "date", description = "The date the invoice was issued", required = true }total_amount = { type = "number", description = "The total invoice amount", required = true }-vendor_name = "The name of the vendor"-line_items = { type = "list", item_type = "text", description = "List of items", required = false }+vendor_name = "The name of the vendor" # This will be optional by default+line_items = { type = "list", item_type = "text", description = "List of items" }```**Supported inline field types:** `text`, `integer`, `boolean`, `number`, `date`, `list`, `dict`-**Field properties:** `type`, `description`, `required` (default: true), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)+**Field properties:** `type`, `description`, `required` (default: false), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)**Simple syntax** (creates required text field):```plx@@ -145,7 +143,7 @@ field_name = "Field description"**Detailed syntax** (with explicit properties):```plx-field_name = { type = "text", description = "Field description", required = false, default_value = "default" }+field_name = { type = "text", description = "Field description", default_value = "default" }```**3. Python StructuredContent Class (For Advanced Features)**diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ab40d62de..4a6688e78 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -361,13 +361,13 @@ This is all in the spirit of making Pipelex a declarative language, where you exWe've completely redesigned how LLMs are configured and accessed in Pipelex, making it more flexible and easier to get started:-- **Get started in seconds** with [Pipelex Inference](pages/configuration/config-technical/inference-backend-config.md): Use a single API key to access all major LLM providers (OpenAI, Anthropic, Google, Mistral, and more)+- **Get started in seconds** with [Pipelex Inference](home/7-configuration/config-technical/inference-backend-config.md): Use a single API key to access all major LLM providers (OpenAI, Anthropic, Google, Mistral, and more)- **Flexible backend configuration**: Configure multiple inference backends (Azure OpenAI, Amazon Bedrock, Vertex AI, etc.) through simple TOML files in `.pipelex/inference/`-- **Smart model routing**: Automatically route models to the right backend using [routing profiles](pages/configuration/config-technical/inference-backend-config.md#routing-profiles) with pattern matching+- **Smart model routing**: Automatically route models to the right backend using [routing profiles](home/7-configuration/config-technical/inference-backend-config.md#routing-profiles) with pattern matching- **User-friendly aliases**: Define shortcuts like `best-claude` → `claude-4.1-opus` with optional fallback chains- **Cost-aware model specs**: Each model includes detailed pricing, capabilities, and constraints for better cost management-For complete details, see the [Inference Backend Configuration](pages/configuration/config-technical/inference-backend-config.md) documentation.+For complete details, see the [Inference Backend Configuration](home/7-configuration/config-technical/inference-backend-config.md) documentation.### Addeddiff --git a/CLAUDE.md b/CLAUDE.mdindex 9f0a61293..23c6f20aa 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -1,6 +1,4 @@<!-- BEGIN_PIPELEX_RULES -->-# Pipelex Rules-## Guide to write or edit pipelines using the Pipelex language in .plx files- Always first write your "plan" in natural language, then transcribe it in pipelex.@@ -127,16 +125,16 @@ For concepts with structured fields, define them inline using TOML syntax:description = "A commercial document issued by a seller to a buyer"[concept.Invoice.structure]-invoice_number = "The unique invoice identifier"+invoice_number = "The unique invoice identifier" # This will be optional by defaultissue_date = { type = "date", description = "The date the invoice was issued", required = true }total_amount = { type = "number", description = "The total invoice amount", required = true }-vendor_name = "The name of the vendor"-line_items = { type = "list", item_type = "text", description = "List of items", required = false }+vendor_name = "The name of the vendor" # This will be optional by default+line_items = { type = "list", item_type = "text", description = "List of items" }```**Supported inline field types:** `text`, `integer`, `boolean`, `number`, `date`, `list`, `dict`-**Field properties:** `type`, `description`, `required` (default: true), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)+**Field properties:** `type`, `description`, `required` (default: false), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)**Simple syntax** (creates required text field):```plx@@ -145,7 +143,7 @@ field_name = "Field description"**Detailed syntax** (with explicit properties):```plx-field_name = { type = "text", description = "Field description", required = false, default_value = "default" }+field_name = { type = "text", description = "Field description", default_value = "default" }```**3. Python StructuredContent Class (For Advanced Features)**diff --git a/Makefile b/Makefileindex c7684cf2b..348132ee4 100644--- a/Makefile+++ b/Makefile@@ -458,7 +458,7 @@ check-TODOs: envdocs: env$(call PRINT_TITLE,"Serving documentation with mkdocs")- $(VENV_MKDOCS) serve -a 127.0.0.1:8000 --watch docs+ $(VENV_MKDOCS) serve -a 127.0.0.1:8000 -f $(CURDIR)/mkdocs.yml --watch $(CURDIR)/docs -sdocs-check: env$(call PRINT_TITLE,"Checking documentation build with mkdocs")diff --git a/README.md b/README.mdindex bcd312894..074eaaabc 100644--- a/README.md+++ b/README.md@@ -46,7 +46,7 @@ pipelex initTo use AI models, you need an API key:- **Free Pipelex API Key**: Join our [Discord community](https://go.pipelex.com/discord) and request your **free API key** (no credit card required) in the [🔑・free-api-key](https://discord.com/channels/1369447918955921449/1418228010431025233) channel.-- **Bring your own API keys**: OpenAI, Anthropic, Google, Mistral)+- **Bring your own API keys**: OpenAI, Anthropic, Google, Mistral- **Local AI**: Ollama, vLLM, LM Studio, llama.cpp... any endpoint based on the OpenAI API or not, as you can plug-in your own non-standard APIs.See [Configure AI Providers](https://docs.pipelex.com/pages/setup/configure-ai-providers/) for details.diff --git a/docs/CODE_OF_CONDUCT.md b/docs/CODE_OF_CONDUCT.mdindex a9abffea9..7e3ea63d8 100644--- a/docs/CODE_OF_CONDUCT.md+++ b/docs/CODE_OF_CONDUCT.md@@ -2,4 +2,4 @@title: Code of Conduct------8<-- "../CODE_OF_CONDUCT.md"\ No newline at end of file+--8<-- "CODE_OF_CONDUCT.md"\ No newline at end of filediff --git a/docs/pages/advanced-customization/content-generator-injection.md b/docs/home/10-advanced-customizations/content-generator-injection.mdsimilarity index 100%rename from docs/pages/advanced-customization/content-generator-injection.mdrename to docs/home/10-advanced-customizations/content-generator-injection.mddiff --git a/docs/pages/advanced-customization/index.md b/docs/home/10-advanced-customizations/index.mdsimilarity index 100%rename from docs/pages/advanced-customization/index.mdrename to docs/home/10-advanced-customizations/index.mddiff --git a/docs/pages/advanced-customization/observer-provider-injection.md b/docs/home/10-advanced-customizations/observer-provider-injection.mdsimilarity index 100%rename from docs/pages/advanced-customization/observer-provider-injection.mdrename to docs/home/10-advanced-customizations/observer-provider-injection.mddiff --git a/docs/pages/advanced-customization/pipe-router-injection.md b/docs/home/10-advanced-customizations/pipe-router-injection.mdsimilarity index 100%rename from docs/pages/advanced-customization/pipe-router-injection.mdrename to docs/home/10-advanced-customizations/pipe-router-injection.mddiff --git a/docs/pages/advanced-customization/pipeline-tracker-injection.md b/docs/home/10-advanced-customizations/pipeline-tracker-injection.mdsimilarity index 100%rename from docs/pages/advanced-customization/pipeline-tracker-injection.mdrename to docs/home/10-advanced-customizations/pipeline-tracker-injection.mddiff --git a/docs/home/10-advanced-customizations/plugin-injection.md b/docs/home/10-advanced-customizations/plugin-injection.mdnew file mode 100644index 000000000..dad784bac--- /dev/null+++ b/docs/home/10-advanced-customizations/plugin-injection.md@@ -0,0 +1,4 @@+# Content Generator Injection++!!! warning "Under Construction"+ This section is currently under development.diff --git a/docs/pages/advanced-customization/reporting-delegate-injection.md b/docs/home/10-advanced-customizations/reporting-delegate-injection.mdsimilarity index 100%rename from docs/pages/advanced-customization/reporting-delegate-injection.mdrename to docs/home/10-advanced-customizations/reporting-delegate-injection.mddiff --git a/docs/pages/advanced-customization/secrets-provider-injection.md b/docs/home/10-advanced-customizations/secrets-provider-injection.mdsimilarity index 100%rename from docs/pages/advanced-customization/secrets-provider-injection.mdrename to docs/home/10-advanced-customizations/secrets-provider-injection.mddiff --git a/docs/pages/advanced-customization/storage-provider-injection.md b/docs/home/10-advanced-customizations/storage-provider-injection.mdsimilarity index 100%rename from docs/pages/advanced-customization/storage-provider-injection.mdrename to docs/home/10-advanced-customizations/storage-provider-injection.mddiff --git a/docs/pages/advanced-customization/template-provider-injection.md b/docs/home/10-advanced-customizations/template-provider-injection.mdsimilarity index 100%rename from docs/pages/advanced-customization/template-provider-injection.mdrename to docs/home/10-advanced-customizations/template-provider-injection.mddiff --git a/docs/pages/writing-workflows/character_sheet.png b/docs/home/2-get-started/images/character_sheet.pngsimilarity index 100%rename from docs/pages/writing-workflows/character_sheet.pngrename to docs/home/2-get-started/images/character_sheet.pngdiff --git a/docs/pages/writing-workflows/extracted_character_metadata.png b/docs/home/2-get-started/images/extracted_character_metadata.pngsimilarity index 100%rename from docs/pages/writing-workflows/extracted_character_metadata.pngrename to docs/home/2-get-started/images/extracted_character_metadata.pngdiff --git a/docs/pages/writing-workflows/structured_character_sheet.png b/docs/home/2-get-started/images/structured_character_sheet.pngsimilarity index 100%rename from docs/pages/writing-workflows/structured_character_sheet.pngrename to docs/home/2-get-started/images/structured_character_sheet.pngdiff --git a/docs/pages/writing-workflows/structured_character_sheet_json.png b/docs/home/2-get-started/images/structured_character_sheet_json.pngsimilarity index 100%rename from docs/pages/writing-workflows/structured_character_sheet_json.pngrename to docs/home/2-get-started/images/structured_character_sheet_json.pngdiff --git a/docs/home/2-get-started/pipe-builder.md b/docs/home/2-get-started/pipe-builder.mdnew file mode 100644index 000000000..063a32819--- /dev/null+++ b/docs/home/2-get-started/pipe-builder.md@@ -0,0 +1,114 @@+---+title: "Generate Workflows with Pipe Builder"+---++++## Install++```bash+pip install pipelex+```+```bash+pipelex init+```++To use AI models, you need API key(s):++- The `PIPELEX_INFERENCE_API_KEY` key provides access to all the AI models. To get your key, join our [Discord community](https://go.pipelex.com/discord), then request your **free API key** (no credit card required, limited time offer) in the [🔑・free-api-key](https://discord.com/channels/1369447918955921449/1418228010431025233) channel.+- You can also use other AI routing services like [BlackBox AI](https://docs.blackbox.ai/), or you can bring your own API keys (OpenAI, Anthropic, Google, Mistral, etc.), or run local AI (no key needed).+See [Configure AI Providers](../../home/5-setup/configure-ai-providers.md) for details. If you are using non-standard APIs, that's OK too, don't hesitate to join our [Discord](https://go.pipelex.com/discord) for guidance, Pipelex provides dependency injections for the API portals, [See here for more information](../10-advanced-customizations/plugin-injection.md)++# Generate workflows with Pipe Builder++The fastest way to create production-ready AI workflows is with the Pipe Builder. Just describe what you want, and Pipelex generates complete, validated pipelines.++```bash+pipelex build pipe "Take a CV and Job offer in PDF, analyze if they match and generate 5 questions for the interview"+```++The pipe builder generates a complete production-ready script in our Pipelex language, saved as a `.plx` file including domain definition, concepts, and the multiple _pipe_ steps to take to achieve the goal. It has also generated a file `inputs.json`, describing the form of the **mandatory** inputs for running the pipe.++!!! tip "Pipe Builder Requirements"+ For now, the pipe builder requires access to **Claude 4.5 Sonnet**, either through Pipelex Inference, or using your own key through Anthropic, Amazon Bedrock or BlackboxAI. Don't hesitate to join our [Discord](https://go.pipelex.com/discord) to get a key, otherwise, you can also create the workflows yourself, following our [documentation guide](./write-workflows-manually.md).+++## Run your pipeline++**Option 1: CLI**++```bash+pipelex run results/cv_match.plx --inputs inputs.json+```++The `--inputs` file should be a JSON dictionary where keys are input variable names and values are the input data. Learn more on how to provide the inputs of a pipe: [Providing Inputs to Pipelines](../../home/6-build-reliable-ai-workflows/pipes/provide-inputs.md)++**Option 2: Python**++This requires having the `.plx` file or your pipe inside the directory where the Python file is located.++```python+import json+from pipelex.pipeline.execute import execute_pipeline+from pipelex.pipelex import Pipelex++# Initialize Pipelex+Pipelex.make()++# Load the inputs from the JSON file+with open("inputs.json", "r", encoding="utf-8") as json_file:+ inputs = json.load(json_file)++# Execute the pipeline+pipe_output = await execute_pipeline(+ pipe_code="analyze_cv_and_prepare_interview",+ inputs=inputs+)++print(pipe_output.main_stuff)++```++## Easily iterate on your pipe++Now, thanks to our Pipelex language, you can easily edit the pipeline, even if you're not a coder. Better yet, you can get assisted in making changes with the help of your favorite AI coding assistant. To that end, we have prepared comprehensive rules meant for the most popular AI coding assistants. You can install those rules with one call:++```bash+pipelex kit rules+```++This installs Pipelex rules for `Cursor`, `Claude Code`, `OpenAI Codex`, `GitHub Copilot`, `Windsurf`, and `Blackbox AI`.++Now refine your pipeline with natural language directly in your AI assistant's chatbot:++- "Include confidence scores between 0 and 100 in the match analysis"+- "Write a recap email at the end"+- "Split the first pipe into 2 more detailed pipe"++## IDE Support++We **highly** recommend installing our own extension for PLX files into your IDE of choice. You can find it in the [Open VSX Registry](https://open-vsx.org/extension/Pipelex/pipelex) and download it directly using [this link](https://open-vsx.org/api/Pipelex/pipelex/0.2.1/file/Pipelex.pipelex-0.2.1.vsix). It's coming soon to the VS Code marketplace too and if you are using Cursor, Windsurf or another VS Code fork, you can search for it directly in your extensions tab.++## Examples++[Cookbook Examples](../../home/4-cookbook-examples/index.md) - Real-world patterns and use cases++---++## Next Steps++Now that you know how to generate workflows with the Pipe Builder, explore these resources:++**Learn how to Write Workflows yourself**++- [:material-pencil: Write Workflows Manually](./write-workflows-manually.md){ .md-button .md-button--primary }+- [:material-book-open-variant: Build Reliable AI Workflows](../6-build-reliable-ai-workflows/kick-off-a-pipelex-workflow-project.md){ .md-button .md-button--primary }++**Explore Examples:**++- [Cookbook Examples](../../home/4-cookbook-examples/index.md) - Real-world patterns and use cases++**Configure Your Setup:**++- [Configure AI Providers](../../home/5-setup/configure-ai-providers.md) - API keys, local AI, model providers+- [Project Organization](../../home/5-setup/project-organization.md) - Structure your Pipelex projectsdiff --git a/docs/home/2-get-started/write-workflows-manually.md b/docs/home/2-get-started/write-workflows-manually.mdnew file mode 100644index 000000000..7f87cf868--- /dev/null+++ b/docs/home/2-get-started/write-workflows-manually.md@@ -0,0 +1,349 @@+# Writing Workflows++Ready to dive deeper? This section shows you how to manually create pipelines and understand the `.plx` language.++!!! tip "Prefer Automated Workflow Generation?"+ If you have access to **Claude 4.5 Sonnet** (via Pipelex Inference, Anthropic, Amazon Bedrock, or BlackBox AI), you can use our **pipe builder** to generate workflows from natural language descriptions. See the [Pipe Builder guide](./pipe-builder.md) to learn how to use `pipelex build pipe` commands. This tutorial is for those who want to write workflows manually or understand the `.plx` language in depth.++## Write Your First Pipeline++Let's build a **character generator** to understand the basics.+Create a `.plx` file anywhere in your project (we recommend a `pipelines` directory):++`character.plx`+```plx+domain = "characters" # domain of existance of your pipe++[pipe]+[pipe.create_character] # Declare the pipe and give it a code name+type = "PipeLLM" # Specify the type: Here, PipeLLM can provide LLM/vLLM calls.+description = "Creates a character." # Give it a description in natural language+output = "Text" # Specify the output of the pipe: Here its will be plain text.+prompt = """ # write your prompt+You are a book writer. Your task is to create a character.+Think of it and then output the character description.+"""+```++This pipeline is a simple LLM call without any input, with the provided prompt and will output a `TextContent` object. See more about native concepts [here](../6-build-reliable-ai-workflows/concepts/define_your_concepts.md)++### Run Your First Pipelex Script++**CLI:**++```bash+pipelex run create_character+```++**Python:**++Create a Python file to execute the pipeline:++`character.py`+```python+from pipelex.pipeline.execute import execute_pipeline+from pipelex.pipelex import Pipelex++# Initialize pipelex to load your pipeline libraries+Pipelex.make()++pipe_output = await execute_pipeline(+ pipe_code="create_character",+)++print(pipe_output.main_stuff_as_str) # `main_stuff_as_str` is allowed here because the output is a `TextContent`+```++Then run the python file.++```bash+python character.py+```++### Get Your First Pipelex Result++++As you might notice, this is plain text, and nothing is structured. Now we are going to see how to output a structured object instead of plain text.++## Generate Structured Outputs++Let's create a rigorously structured `Character` object instead of plain text. We need to create the concept `Character`. The concept names MUST be in PascalCase. [Learn more about defining concepts](../6-build-reliable-ai-workflows/concepts/define_your_concepts.md)++### Option 1: Define the Structure in your `.plx` file++Define structures directly in your `.plx` file:++```plx+[concept.Character] # Declare the concept by giving it a name.+description = "A character in a fiction story" # Give it a description in natural language.++[concept.Character.structure] # Define the structure+name = "The character's name" # First attribute: name, with the description in natural language "The character's name"+age = { type = "integer", description = "The character's age", required = true } # Second attribute: age, that is mandatory.+gender = "The character's gender" # Third attribute: "gender"+description = "A description of the character" # Fourth attribute: "description"+```++### Now use your structured concept in your pipe++Specify that the output of your Pipellm is a `Character` object:++`characters.plx`+```plx+domain = "characters"++[concept.Character]+description = "A character in a fiction story"++[concept.Character.structure]+name = "The character's name"+age = { type = "integer", description = "The character's age", required = true }+gender = "The character's gender"+description = "A description of the character"++[pipe]+[pipe.create_character]+type = "PipeLLM"+description = "Create a character. Get a structured result."+output = "Character" # <- This is the output concept for your pipe+prompt = """+You are a book writer. Your task is to create a character.+Think of it and then output the character description.+"""+```++!!! tip "Concept Naming"+ The concept name matches the class name (`Character`), so Pipelex automatically links them.++!!! tip "Semantic Clarity"+ Defining concepts removes ambiguity—"character" could mean a letter or symbol, but here it clearly means a fictional person.+++### Option 2: Define the Structure using Pydantic BaseModel++Using [Pydantic BaseModel](https://docs.pydantic.dev/latest/) syntax:++`characters.py`+```python+from pipelex.core.stuffs.structured_content import StructuredContent++# Define the structure of your output here+# This class MUST be a subclass of StructuredContent+class Character(StructuredContent):+ name: str+ age: int+ gender: str+ description: str+```++!!! tip "Keep Structure Files Clean"+ Keep your `StructuredContent` classes in dedicated files with minimal module-level code. Pipelex imports these modules during auto-discovery, so any module-level code will be executed.++Learn more in [Inline Structures](../6-build-reliable-ai-workflows/concepts/inline-structures.md) or [Python StructuredContent Classes](../6-build-reliable-ai-workflows/concepts/python-classes.md).++### Use your Structured Concept in Your Pipe++Specify that the output of your Pipellm is a `Character` object:++`characters.plx`+```plx+domain = "characters"++[concept]+Character = "A character in a fiction story" # <- Declare your concept by giving it the same name as the python class++[pipe]+[pipe.create_character]+type = "PipeLLM"+description = "Create a character. Get a structured result."+output = "Character" # <- This is the output concept for your pipe+prompt = """+You are a book writer. Your task is to create a character.+Think of it and then output the character description.+"""+```++!!! tip "Concept Naming"+ The concept name matches the class name (`Character`), so Pipelex automatically links them.++!!! tip "Semantic Clarity"+ Defining concepts removes ambiguity—"character" could mean a letter or symbol, but here it clearly means a fictional person.++#### Run Your Pipeline++The output is now a structured `Character` instance:++++### Add variables in your prompt++Let's process existing characters and extract metadata from their descriptions. Let's imagine, that I have already an instance of the class `Character`. I would like to use it in a prompt in order to process that information, and extract some of the information.++For example, I would like to create and instance of `CharacterMetadata`, that contains the `name`, `age`, and height if it was provided in the description of the character.+++```plx+domain = "characters"++[concept.Character]+description = "A character in a fiction story"++[concept.Character.structure]+name = "The character's name"+age = { type = "integer", description = "The character's age", required = true }+gender = "The character's gender"+description = "A description of the character"++[concept.CharacterMetadata] # <- Declare the new concept+description = "Metadata of a character"++[concept.CharacterMetadata.structure] # <- Declare its structure+name = "The character's name"+age = { type = "integer", description = "The character's age", required = true }+height = { type = "number", description = "The characters' height" }++[pipe]+[pipe.extract_character_advanced]+type = "PipeLLM"+description = "Get character information from a description."+inputs = { character = "Character" } # <- These inputs are usable in the prompt+output = "CharacterMetadata"+prompt = """+You are given a text description of a character.+Your task is to extract specific data from the following description.++@character+"""+```++!!! tip "Template Syntax"+ Our template syntax is based on [Jinja2](https://jinja.palletsprojects.com/en/stable/). Use `@` prefix for tagging a variable in the prompt. Learn more about prompting with Pipelex in the [PipeLLM documentation](../6-build-reliable-ai-workflows/pipes/pipe-operators/PipeLLM.md).++!!! tip "Template Variables"+ `@character.description` grabs the `character` stuff from the instance and uses its `description` attribute.++Learn more about Jinja in the [PipeLLM documentation](../../home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeLLM.md).++#### Execute from Python++`run_pipe.py`+```python+from pipelex.pipeline.execute import execute_pipeline+from pipelex.pipelex import Pipelex++from character_model import CharacterMetadata++Pipelex.make()++inputs = {+ "character": {+ "concept": "character.Character",+ "content": {+ "name": "Elias",+ "age": 38,+ "gender": "man",+ "occupation": "explorer",+ "description": "Elias Varrin is a 38-year-old man, standing at approximately 1.85 meters tall, with a lean, weathered frame shaped by decades of travel through remote and often unforgiving landscapes. His name, though not widely known, carries weight among historians, explorers, and those who trade in whispered legends. Elias has piercing storm-gray eyes that scan every environment with sharp precision, and his ash-blond hair—flecked with early streaks of grey—is usually tucked beneath a wide-brimmed, timeworn hat."+ }+ }+}++# Run the pipe with loaded inputs+pipe_output = await execute_pipeline(+ pipe_code="extract_character_advances",+ inputs=inputs,+)++# Get the result as a properly typed instance+print(pipe_output)+```++### How to type the output ?++You can get an instance of the python class `CharacterMetadata` if you have created the concept with python:++`character_model.py`+```python+from pipelex.core.stuffs.structured_content import StructuredContent++# input class+class Character(StructuredContent):+ name: str+ age: int+ gender: str+ occupation: str+ description: str++# output class+class CharacterMetadata(StructuredContent):+ name: str+ age: int+ height: float+```++`run_pipe.py`+```python+from pipelex.pipeline.execute import execute_pipeline+from pipelex.pipelex import Pipelex++from character_model import CharacterMetadata++Pipelex.make()++inputs = {+ "character": {+ "concept": "character.Character",+ "content": {+ "name": "Elias",+ "age": 38,+ "gender": "man",+ "occupation": "explorer",+ "description": "Elias Varrin is a 38-year-old man, standing at approximately 1.85 meters tall, with a lean, weathered frame shaped by decades of travel through remote and often unforgiving landscapes. His name, though not widely known, carries weight among historians, explorers, and those who trade in whispered legends. Elias has piercing storm-gray eyes that scan every environment with sharp precision, and his ash-blond hair—flecked with early streaks of grey—is usually tucked beneath a wide-brimmed, timeworn hat."+ }+ }+}++# Run the pipe with loaded inputs+pipe_output = await execute_pipeline(+ pipe_code="extract_character_advances",+ inputs=inputs,+)++# Get the result as a properly typed instance+extracted_metadata = pipe_output.main_stuff_as(content_type=CharacterMetadata)+print(extracted_metadata)+```++#### Get Result++++# Next Steps++Now that you understand the basics, explore more:++**Learn More about the PipeLLM:**++- [LLM Configuration: play with the models](../../home/6-build-reliable-ai-workflows/configure-ai-llm-to-optimize-workflows.md) - Optimize cost and quality+- [Full configuration of the PipeLLM](../../home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeLLM.md)++**Learn more about Pipelex (domains, project structure, best practices...)**++- [Build Reliable AI Workflows](../../home/6-build-reliable-ai-workflows/kick-off-a-pipelex-workflow-project.md) - Deep dive into pipeline design+- [Cookbook Examples](../../home/4-cookbook-examples/index.md) - Real-world examples and patterns++**Learn More about the other pipes**++- [Pipe Operators](../../home/6-build-reliable-ai-workflows/pipes/pipe-operators/index.md) - PipeLLM, PipeExtract, PipeCompose, and more+- [Pipe Controllers](../../home/6-build-reliable-ai-workflows/pipes/pipe-controllers/index.md) - PipeSequence, PipeParallel, PipeBatch, PipeCondition++**Explore Tools:**++- [Pipe Builder](../../home/9-tools/pipe-builder.md) - Generate pipelines from natural language+- [Kit Commands](../../home/9-tools/kit.md) - Manage agent rules and migrations+- [CLI Commands](../../home/9-tools/cli.md) - Command-line interface reference++**Configure:**++- [Inference Backend](../../home/7-configuration/config-technical/inference-backend-config.md) - Configure model providersdiff --git a/docs/manifesto.md b/docs/home/3-understand-pipelex/manifesto.mdsimilarity index 100%rename from docs/manifesto.mdrename to docs/home/3-understand-pipelex/manifesto.mddiff --git a/docs/pages/pipelex-paradigm-for-repeatable-ai-workflows/index.md b/docs/home/3-understand-pipelex/pipelex-paradigm/index.mdsimilarity index 100%rename from docs/pages/pipelex-paradigm-for-repeatable-ai-workflows/index.mdrename to docs/home/3-understand-pipelex/pipelex-paradigm/index.mddiff --git a/docs/pages/cookbook-examples/extract-dpe.md b/docs/home/4-cookbook-examples/extract-dpe.mdsimilarity index 100%rename from docs/pages/cookbook-examples/extract-dpe.mdrename to docs/home/4-cookbook-examples/extract-dpe.mddiff --git a/docs/pages/cookbook-examples/extract-gantt.md b/docs/home/4-cookbook-examples/extract-gantt.mdsimilarity index 100%rename from docs/pages/cookbook-examples/extract-gantt.mdrename to docs/home/4-cookbook-examples/extract-gantt.mddiff --git a/docs/pages/cookbook-examples/extract-generic.md b/docs/home/4-cookbook-examples/extract-generic.mdsimilarity index 100%rename from docs/pages/cookbook-examples/extract-generic.mdrename to docs/home/4-cookbook-examples/extract-generic.mddiff --git a/docs/pages/cookbook-examples/extract-proof-of-purchase.md b/docs/home/4-cookbook-examples/extract-proof-of-purchase.mdsimilarity index 100%rename from docs/pages/cookbook-examples/extract-proof-of-purchase.mdrename to docs/home/4-cookbook-examples/extract-proof-of-purchase.mddiff --git a/docs/pages/cookbook-examples/extract-table.md b/docs/home/4-cookbook-examples/extract-table.mdsimilarity index 100%rename from docs/pages/cookbook-examples/extract-table.mdrename to docs/home/4-cookbook-examples/extract-table.mddiff --git a/docs/pages/cookbook-examples/hello-world.md b/docs/home/4-cookbook-examples/hello-world.mdsimilarity index 100%rename from docs/pages/cookbook-examples/hello-world.mdrename to docs/home/4-cookbook-examples/hello-world.mddiff --git a/docs/pages/cookbook-examples/index.md b/docs/home/4-cookbook-examples/index.mdsimilarity index 100%rename from docs/pages/cookbook-examples/index.mdrename to docs/home/4-cookbook-examples/index.mddiff --git a/docs/pages/cookbook-examples/invoice-extractor.md b/docs/home/4-cookbook-examples/invoice-extractor.mdsimilarity index 100%rename from docs/pages/cookbook-examples/invoice-extractor.mdrename to docs/home/4-cookbook-examples/invoice-extractor.mddiff --git a/docs/pages/cookbook-examples/simple-ocr.md b/docs/home/4-cookbook-examples/simple-ocr.mdsimilarity index 100%rename from docs/pages/cookbook-examples/simple-ocr.mdrename to docs/home/4-cookbook-examples/simple-ocr.mddiff --git a/docs/pages/cookbook-examples/write-screenplay.md b/docs/home/4-cookbook-examples/write-screenplay.mdsimilarity index 100%rename from docs/pages/cookbook-examples/write-screenplay.mdrename to docs/home/4-cookbook-examples/write-screenplay.mddiff --git a/docs/pages/cookbook-examples/write-tweet.md b/docs/home/4-cookbook-examples/write-tweet.mdsimilarity index 100%rename from docs/pages/cookbook-examples/write-tweet.mdrename to docs/home/4-cookbook-examples/write-tweet.mddiff --git a/docs/pages/setup/configure-ai-providers.md b/docs/home/5-setup/configure-ai-providers.mdsimilarity index 81%rename from docs/pages/setup/configure-ai-providers.mdrename to docs/home/5-setup/configure-ai-providers.mdindex 3560576c3..bc016b940 100644--- a/docs/pages/setup/configure-ai-providers.md+++ b/docs/home/5-setup/configure-ai-providers.md@@ -94,7 +94,7 @@ enabled = true# Enable any providers you have keys for```-See [Inference Backend Configuration](../configuration/config-technical/inference-backend-config.md) for all options.+See [Inference Backend Configuration](../../home/7-configuration/config-technical/inference-backend-config.md) for all options.### Option 3: Local AI (No API Keys Required)@@ -119,7 +119,7 @@ Run AI models locally without any API keys. This is perfect if you:- **LM Studio**: User-friendly local model interface- **llama.cpp**: Lightweight C++ inference-Configure these in `.pipelex/inference/backends.toml`. See our [Inference Backend Configuration](../configuration/config-technical/inference-backend-config.md) for details.+Configure these in `.pipelex/inference/backends.toml`. See our [Inference Backend Configuration](../../home/7-configuration/config-technical/inference-backend-config.md) for details.---@@ -142,7 +142,7 @@ This creates a `.pipelex/` directory with:└── routing_profiles.toml # Model routing configuration```-Learn more in our [Inference Backend Configuration](../configuration/config-technical/inference-backend-config.md) guide.+Learn more in our [Inference Backend Configuration](../../home/7-configuration/config-technical/inference-backend-config.md) guide.---@@ -150,11 +150,11 @@ Learn more in our [Inference Backend Configuration](../configuration/config-techNow that you have your backend configured:-1. **Organize your project**: [Project Organization](project-organization.md)-2. **Learn the concepts**: [Writing Workflows Tutorial](../writing-workflows/index.md)+1. **Organize your project**: [Project Organization](./project-organization.md)+2. **Learn the concepts**: [Writing Workflows Tutorial](../../home/2-get-started/pipe-builder.md)3. **Explore examples**: [Cookbook Repository](https://github.com/Pipelex/pipelex-cookbook)-4. **Deep dive**: [Build Reliable AI Workflows](../build-reliable-ai-workflows-with-pipelex/kick-off-a-pipelex-workflow-project.md)+4. **Deep dive**: [Build Reliable AI Workflows](../../home/6-build-reliable-ai-workflows/kick-off-a-pipelex-workflow-project.md)!!! tip "Advanced Configuration"- For detailed backend configuration options, see [Inference Backend Configuration](../configuration/config-technical/inference-backend-config.md).+ For detailed backend configuration options, see [Inference Backend Configuration](../../home/7-configuration/config-technical/inference-backend-config.md).diff --git a/docs/pages/setup/project-organization.md b/docs/home/5-setup/project-organization.mdsimilarity index 72%rename from docs/pages/setup/project-organization.mdrename to docs/home/5-setup/project-organization.mdindex 42f9fc27e..674fab8ba 100644--- a/docs/pages/setup/project-organization.md+++ b/docs/home/5-setup/project-organization.md@@ -35,14 +35,14 @@ your_project/└── pipelex.toml```-Learn more in our [Project Structure documentation](../build-reliable-ai-workflows-with-pipelex/kick-off-a-pipelex-workflow-project.md).+Learn more in our [Project Structure documentation](../../home/6-build-reliable-ai-workflows/kick-off-a-pipelex-workflow-project.md).---## Prerequisites- **Python**: Version 3.10 or above-- **API Access**: One of the three options from [Configure AI Providers](configure-ai-providers.md) (Pipelex Inference, your own keys, or local AI)+- **API Access**: One of the three options from [Configure AI Providers](./configure-ai-providers.md) (Pipelex Inference, your own keys, or local AI)---@@ -50,8 +50,8 @@ Learn more in our [Project Structure documentation](../build-reliable-ai-workfloNow that you understand project organization:-1. **Start building**: [Get Started](../../index.md)-2. **Learn the concepts**: [Writing Workflows Tutorial](../writing-workflows/index.md)+1. **Start building**: [Get Started](../../home/2-get-started/pipe-builder.md)+2. **Learn the concepts**: [Writing Workflows Tutorial](../../home/2-get-started/pipe-builder.md)3. **Explore examples**: [Cookbook Repository](https://github.com/Pipelex/pipelex-cookbook)-4. **Deep dive**: [Build Reliable AI Workflows](../build-reliable-ai-workflows-with-pipelex/kick-off-a-pipelex-workflow-project.md)+4. **Deep dive**: [Build Reliable AI Workflows](../../home/6-build-reliable-ai-workflows/kick-off-a-pipelex-workflow-project.md)diff --git a/docs/pages/setup/telemetry.md b/docs/home/5-setup/telemetry.mdsimilarity index 93%rename from docs/pages/setup/telemetry.mdrename to docs/home/5-setup/telemetry.mdindex c31ff9ffa..a9e7ce433 100644--- a/docs/pages/setup/telemetry.md+++ b/docs/home/5-setup/telemetry.md@@ -65,7 +65,7 @@ export DO_NOT_TRACK=1You can change your telemetry settings at any time:-1. **Via configuration file**: Edit `.pipelex/telemetry.toml` directly (see [Telemetry Configuration](../configuration/config-practical/telemetry-config.md))+1. **Via configuration file**: Edit `.pipelex/telemetry.toml` directly (see [Telemetry Configuration](../../home/7-configuration/config-practical/telemetry-config.md))2. **Trigger the prompt again**: Delete `.pipelex/telemetry.toml`, and the prompt will appear next time you run a command## Privacy@@ -77,5 +77,5 @@ We take your privacy seriously:- All telemetry can be completely disabled- Our telemetry infrastructure uses PostHog, hosted in the EU-For detailed configuration options, see [Telemetry Configuration](../configuration/config-practical/telemetry-config.md).+For detailed configuration options, see [Telemetry Configuration](../../home/7-configuration/config-practical/telemetry-config.md).diff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/adapt-to-llm-prompting-style-openai-anthropic-mistral.md b/docs/home/6-build-reliable-ai-workflows/adapt-to-llm-prompting-style-openai-anthropic-mistral.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/adapt-to-llm-prompting-style-openai-anthropic-mistral.mdrename to docs/home/6-build-reliable-ai-workflows/adapt-to-llm-prompting-style-openai-anthropic-mistral.mddiff --git a/docs/home/6-build-reliable-ai-workflows/concepts/define_your_concepts.md b/docs/home/6-build-reliable-ai-workflows/concepts/define_your_concepts.mdnew file mode 100644index 000000000..e5c4e1eb9--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/concepts/define_your_concepts.md@@ -0,0 +1,132 @@+# Defining Your Concepts++Concepts are the foundation of reliable AI workflows. They define what flows through your pipes—not just as data types, but as meaningful pieces of knowledge with clear boundaries and validation rules.++## Writing Concept Definitions++Every concept starts with a natural language definition. This definition serves two audiences: developers who build with your pipeline, and the LLMs that process your knowledge.++### Basic Concept Definition++The simplest way to define a concept is with a descriptive sentence:++```plx+[concept]+Invoice = "A commercial document issued by a seller to a buyer"+Employee = "A person employed by an organization"+ProductReview = "A customer's evaluation of a product or service"+```++!!! important "Concept Naming Convention"+ Concept names **MUST** be in `PascalCase` (also known as UpperCamelCase). Each word starts with a capital letter, with no underscores or hyphens.++ **Valid concept names:**+ ```plx+ ✅ Invoice+ ✅ ProductReview+ ✅ CustomerFeedback+ ✅ InvoiceLineItem+ ```++ **Invalid concept names:**+ ```plx+ ❌ invoice # Not PascalCase+ ❌ product_review # snake_case not allowed+ ❌ Product-Review # Hyphens not allowed+ ❌ productReview # camelCase not allowed (must start with capital)+ ```++Those concepts will be Text-based by default. If you want to use sutrctured output, you need to create a Python class for the concept, or declare the structure directly in the concept definition.++**Key principles for concept definitions:**++1. **Define what it is, not what it's for**+ ```plx+ # ❌ Wrong: includes usage context+ TextToSummarize = "Text that needs to be summarized"++ # ✅ Right: defines the essence+ Article = "A written composition on a specific topic"+ ```++2. **Use singular forms**+ ```plx+ # ❌ Wrong: plural form+ Invoices = "Commercial documents from sellers"++ # ✅ Right: singular form+ Invoice = "A commercial document issued by a seller to a buyer"+ ```++3. **Avoid unnecessary adjectives**+ ```plx+ # ❌ Wrong: includes subjective qualifier+ LongArticle = "A lengthy written composition"++ # ✅ Right: neutral description+ Article = "A written composition on a specific topic"+ ```++### Organizing Related Concepts++Group concepts that naturally belong together in the same domain. A domain acts as a namespace for a set of related concepts and pipes, helping you organize and reuse your pipeline components. You can learn more about them in [Understanding Domains](../domain.md).++```plx+# finance.plx+domain = "finance"+description = "Financial document processing"++[concept]+Invoice = "A commercial document issued by a seller to a buyer"+Receipt = "Proof of payment for goods or services"+PurchaseOrder = "A buyer's formal request to purchase goods or services"+PaymentTerms = "Conditions under which payment is to be made"+LineItem = "An individual item or service listed in a financial document"+```++## Get Started with Inline Structures++To add structure to your concepts, the simplest approach is using **inline structures** directly in your `.plx` files:++```plx+[concept.Invoice]+description = "A commercial document issued by a seller to a buyer"++[concept.Invoice.structure]+invoice_number = "The unique invoice identifier"+issue_date = { type = "date", description = "The date the invoice was issued" }+total_amount = { type = "number", description = "The total invoice amount" }+vendor_name = "The name of the vendor"+```++This automatically generates a fully-typed Pydantic model with validation—no Python code needed!++**For complete details on inline structures, field types, and all features, see [Inline Structures](inline-structures.md).**++### Alternative: Python Classes++For advanced features like custom validation, computed properties, or reusable business logic, you can create explicit Python classes.++**Learn more in [Python StructuredContent Classes](python-classes.md).**++## Refining Concepts++You can create more specific versions of existing concepts through refinement. For example, an `Invoice` is a specific kind of `PDF`:++```plx+[concept.Invoice]+description = "A commercial document issued by a seller to a buyer"+refines = "PDF"+```++The refined concept inherits the structure of the base concept while adding semantic specificity.++**For complete details on refinement, see [Refining Concepts](refining-concepts.md).**++## Native Concepts++Pipelex includes several built-in native concepts that cover common data types: `Text`, `Image`, `PDF`, `TextAndImages`, `Number`, `Page`, `Dynamic`, and `Anything`.++These concepts are automatically available in all pipelines—no setup required. You can use them directly in your pipes or refine them to create more specific concepts.++**For complete details on all native concepts and their structures, see [Native Concepts](native-concepts.md).**diff --git a/docs/home/6-build-reliable-ai-workflows/concepts/inline-structures.md b/docs/home/6-build-reliable-ai-workflows/concepts/inline-structures.mdnew file mode 100644index 000000000..09b46cd13--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/concepts/inline-structures.md@@ -0,0 +1,191 @@+# Inline Structure Definition++Define structured concepts directly in your `.plx` files using pipelex syntax. This is the **recommended approach** for most use cases, offering rapid development without Python boilerplate.++For an introduction to concepts themselves, see [Define Your Concepts](define_your_concepts.md). For advanced features requiring Python classes, see [Python StructuredContent Classes](python-classes.md).++## Quick Example++```plx+domain = "finance"++[concept.Invoice]+description = "A commercial document issued by a seller to a buyer"++[concept.Invoice.structure]+invoice_number = "The unique invoice identifier"+issue_date = { type = "date", description = "The date the invoice was issued", required = true }+total_amount = { type = "number", description = "The total invoice amount", required = true }+vendor_name = "The name of the vendor"+line_items = { type = "list", item_type = "text", description = "List of items in the invoice", required = false }+```++Behind the scenes, Pipelex automatically generates a fully-typed Pydantic model with validation—all from TOML.++!!! warning "Important: Generated classes are not accessible"+ When you define an inline structure, Pipelex generates a Python class **behind the scenes**. However, **you do not have direct access to this generated class** in your Python code.++ This means:++ - You **cannot** import the generated class+ - You **cannot** use it for type hints in your Python code+ - You **cannot** access it when working with `PipeOutput` objects++ The class exists only for runtime validation. If you need to type your Python variables or access the class directly, use [Python StructuredContent Classes](python-classes.md) instead.++!!! warning "Important: No nested concepts (For Now)"+ Inline structures **cannot reference other custom concepts** as field types. You can only use basic types (text, integer, boolean, etc.) and native concepts.++ **Not allowed:**+ ```plx+ [concept.Address.structure]+ street = "Street address"++ [concept.Company.structure]+ headquarters = { type = "Address" } # ❌ Cannot use custom concept+ ```++ If you need nested structures, use [Python StructuredContent Classes](python-classes.md).++## Field Properties++Each field can specify:++- **type**: The data type (required for detailed definitions)+- **description**: Human-readable description+- **default_value**: Default value if not provided+- **choices**: For `enum`-like fields, a list of valid values+- **item_type**: For `list` fields, the type of list items+- **key_type** and **value_type**: For `dict` fields, the types of keys and values++## Supported Field Types++Inline structures support these field types:++### text++String values. Use for any text content.++```plx+[concept.Person.structure]+email = { type = "text", description = "Email address" }+```++!!! tip "Simple Syntax Shorthand"+ When you write `field_name = "description"`, Pipelex automatically creates a **text** field with:++ - **type**: `text`+ - **description**: The string you provided++ This is a shorthand for the most common case: text fields.+ This will put the field as optional by default, and not required.++### integer++Whole numbers (no decimals). Use for counts, IDs, ages, etc.++```plx+[concept.Product.structure]+product_id = { type = "integer", description = "Unique product ID" }+quantity = { type = "integer", description = "Stock quantity", default_value = 0 }+```++### boolean++True/false values. Use for flags, states, toggles.++```plx+[concept.Account.structure]+is_active = { type = "boolean", description = "Account status" }+is_verified = { type = "boolean", description = "Email verified", default_value = false }+```++### number++Numeric values (integers or floats). Use for prices, measurements, scores.++```plx+[concept.Invoice.structure]+total_amount = { type = "number", description = "Total amount" }+tax_rate = { type = "number", description = "Tax rate as decimal", default_value = 0.0 }+```++### date++Date and datetime values. Pipelex handles date parsing automatically.++```plx+[concept.Event.structure]+event_date = { type = "date", description = "Event date and time" }+created_at = { type = "date", description = "Creation timestamp" }+```++### list++Arrays/lists of items. **Must specify `item_type`** to indicate what the list contains.++```plx+[concept.Project.structure]+tags = { type = "list", item_type = "text", description = "Project tags" }+milestones = { type = "list", item_type = "text", description = "Milestone names" }+scores = { type = "list", item_type = "number", description = "Test scores" }+```++### dict++Dictionaries/maps with key-value pairs. **Must specify `key_type` and `value_type`**.++```plx+[concept.Configuration.structure]+settings = { type = "dict", key_type = "text", value_type = "text", description = "Config settings" }+metadata = { type = "dict", key_type = "text", value_type = "number", description = "Numeric metadata" }+```++## Choice Fields (Enums)++For fields that should only accept specific values, use the `choices` property. When using `choices`, you don't need to specify a `type`.++```plx+[concept.Task.structure]+title = "Task title"+priority = { choices = ["low", "medium", "high"], description = "Task priority level" }+status = { choices = ["todo", "in_progress", "done"], description = "Current status", default_value = "todo" }+```++## Required Fields++By default, **all fields are optional** (`required = false`). To make a field mandatory, explicitly set `required = true`:++```plx+[concept.User.structure]+username = { type = "text", description = "Username", required = true }+email = { type = "text", description = "Email address", required = true }+bio = { type = "text", description = "User bio" } # Optional (default)+```++In this example, `username` and `email` are mandatory, while `bio` is optional.++## When to Use Inline Structures++Use inline structures when:++- ✅ You need simple structured data with basic field types+- ✅ You want rapid prototyping without Python boilerplate+- ✅ Runtime validation is sufficient (you don't need type hints in Python)+- ✅ Your structures don't require nested custom concepts++Use Python classes when:++- ✅ You need custom validation logic or computed properties+- ✅ You want type hints and IDE autocomplete in your Python code+- ✅ You need nested structures or complex relationships+- ✅ You want to access the class directly in `PipeOutput`++See [Python StructuredContent Classes](python-classes.md) for advanced features.++## Related Documentation++- [Define Your Concepts](define_your_concepts.md) - Learn about concept semantics and naming+- [Python StructuredContent Classes](python-classes.md) - Advanced features with Python+- [Writing Workflows Tutorial](../../2-get-started/pipe-builder.md) - Get started with structured outputs+diff --git a/docs/home/6-build-reliable-ai-workflows/concepts/native-concepts.md b/docs/home/6-build-reliable-ai-workflows/concepts/native-concepts.mdnew file mode 100644index 000000000..2c86ab14a--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/concepts/native-concepts.md@@ -0,0 +1,277 @@+# Native Concepts++Pipelex includes several built-in native concepts that cover common data types in AI workflows. These concepts come with predefined structures and are automatically available in all pipelines—no setup required.++For an introduction to concepts, see [Define Your Concepts](define_your_concepts.md).++## What Are Native Concepts?++Native concepts are ready-to-use building blocks for AI workflows. They represent common data types you'll frequently work with: text, images, PDFs, numbers, and combinations thereof.++**Key characteristics:**++- **Pre-defined**: Built into Pipelex, no need to declare them+- **Structured**: Each has a corresponding Python data model+- **Universal**: Available across all pipelines and domains+- **Extensible**: You can refine them to create more specific concepts++## Available Native Concepts++Here are all the native concepts you can use out of the box:++| Concept | Description | Content Class Name |+|-----------------|-------------|---------------------|+| `Text` | A text | `TextContent` |+| `Image` | An image | `ImageContent` |+| `PDF` | A PDF document | `PDFContent` |+| `TextAndImages` | Text with its associated images | `TextAndImagesContent` |+| `Number` | A number | `NumberContent` |+| `Page` | A document page with text, images, and optional page view | `PageContent` |+| `Dynamic` | A dynamic concept that adapts to context | `DynamicContent` |+| `Anything` | Any type of content | *No specific implementation* |++## Native Concept Structures++Each native concept has a corresponding Python structure that defines its data model. Understanding these structures helps you work with the data they contain.++### TextContent++The simplest native concept:++```python+class TextContent(StuffContent):+ text: str+```++**Use for:** Plain text outputs, summaries, descriptions, etc.++### ImageContent++Represents an image with optional metadata:++```python+class ImageContent(StuffContent):+ url: str+ source_prompt: Optional[str] = None+ caption: Optional[str] = None+ base_64: Optional[str] = None+```++**Fields:**+- `url`: Location of the image (file path or URL)+- `source_prompt`: The prompt used to generate the image (if applicable)+- `caption`: Descriptive text for the image+- `base_64`: Base64-encoded image data (alternative to URL)++**Use for:** Photos, generated images, diagrams, screenshots.++### PDFContent++Represents a PDF document:++```python+class PDFContent(StuffContent):+ url: str+```++**Fields:**+- `url`: Location of the PDF file (file path or URL)++**Use for:** Contracts, invoices, reports, any PDF document.++### NumberContent++Represents numeric values:++```python+class NumberContent(StuffContent):+ number: Union[int, float]+```++**Use for:** Counts, calculations, metrics, scores.++### TextAndImagesContent++Combines text with one or more images:++```python+class TextAndImagesContent(StuffContent):+ text: Optional[TextContent]+ images: Optional[List[ImageContent]]+```++**Use for:** Rich content combining text and visuals, extracted document content, reports with diagrams.++### PageContent++Represents a document page with both content and visual representation:++```python+class PageContent(StructuredContent):+ text_and_images: TextAndImagesContent+ page_view: Optional[ImageContent] = None+```++**Fields:**+- `text_and_images`: The extracted text and embedded images from the page+- `page_view`: A screenshot or rendering of the entire page++**Use for:** Document pages extracted by `PipeExtract`, individual pages from multi-page documents.++### DynamicContent++A flexible concept that adapts to context:++```python+class DynamicContent(StuffContent):+ # Dynamic content that can adapt to context+ # Structure is flexible and determined at runtime+ pass+```++**Use for:** Workflows where the content structure isn't known in advance.++### Anything++!!! note "Special Concepts"+ `Anything` is referenced in the native concept definitions but does not have specific implementations. It is handled through the generic content system and is primarily used as semantic markers.++## Using Native Concepts++Native concepts can be used directly in your pipeline definitions without any additional setup:++### In Pipe Inputs++```plx+[pipe.analyze_document]+type = "PipeLLM"+description = "Analyze a PDF document"+inputs = { document = "PDF" }+output = "Text"+prompt = "Analyze this document and provide a summary"+```++### In Pipe Outputs++```plx+[pipe.process_image]+type = "PipeLLM"+description = "Describe an image"+inputs = { photo = "Image" }+output = "Text"+prompt = "Describe what you see in this image"+```++### With Page Content++The `Page` concept is particularly useful with `PipeExtract`:++```plx+[pipe.extract_pages]+type = "PipeExtract"+description = "Extract content from a document"+inputs = { document = "PDF" }+output = "Page"+```++This extracts each page with both its text/images and a visual representation.++### In Complex Workflows++```plx+[pipe.create_report]+type = "PipeSequence"+description = "Generate a report with text and images"+inputs = { data = "Text" }+output = "TextAndImages"+steps = [+ { pipe = "analyze_data", result = "analysis" },+ { pipe = "create_charts", result = "charts" },+ { pipe = "combine_content", result = "report" }+]+```++## Refining Native Concepts++You can create more specific concepts by refining native ones—for example, creating an `Invoice` concept that refines `PDF` or a `ProductPhoto` that refines `Image`. This gives you semantic clarity while inheriting the native concept's structure.++**For complete details on refinement syntax, type compatibility, limitations, best practices, and future features, see [Refining Concepts](refining-concepts.md).**++## When to Use Native Concepts++Use native concepts directly when:++- ✅ Working with simple, unstructured data+- ✅ The native structure is sufficient for your needs+- ✅ You want maximum interoperability across pipes+- ✅ Prototyping and quick experiments++Refine native concepts when:++- ✅ You need semantic specificity (e.g., `Invoice` vs `PDF`)+- ✅ You want to add custom structure on top of the base structure+- ✅ Building domain-specific workflows+- ✅ Need type safety for specific document types++## Common Patterns++### Text Processing++```plx+[pipe.summarize]+type = "PipeLLM"+description = "Summarize any text"+inputs = { content = "Text" }+output = "Text"+prompt = "Summarize this content: @content"+```++### Document Extraction++```plx+[pipe.extract_pages]+type = "PipeExtract"+description = "Extract content from a document"+inputs = { document = "PDF" }+output = "Page[]"++[pipe.analyze_page]+type = "PipeLLM"+description = "Analyze a page"+inputs = { page = "Page[]" }+output = "Text"+prompt = """Analyze those pages:+@pages+"""++[pipe.extract_and_analyze]+type = "PipeSequence"+description = "Extract and analyze a PDF"+inputs = { document = "PDF" }+output = "Text"+steps = [+ { pipe = "extract_pages", result = "pages" },+ { pipe = "analyze_pages", result = "analysis" }+]+```++### Multi-Modal Processing++```plx+[pipe.analyze_with_context]+type = "PipeLLM"+description = "Analyze image with text context"+inputs = { image = "Image", context = "Text" }+output = "Text"+prompt = "Given this context: $context++Analyze this image: $image"+```++## Related Documentation++- [Define Your Concepts](define_your_concepts.md) - Learn about concept semantics+- [Inline Structures](inline-structures.md) - Add structure to refined concepts+- [Python StructuredContent Classes](python-classes.md) - Advanced customization+- [Writing Workflows Tutorial](../../2-get-started/pipe-builder.md) - Use native concepts in pipelines+diff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/structuring-concepts.md b/docs/home/6-build-reliable-ai-workflows/concepts/python-classes.mdsimilarity index 55%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/structuring-concepts.mdrename to docs/home/6-build-reliable-ai-workflows/concepts/python-classes.mdindex 30f8604fe..66665f123 100644--- a/docs/pages/build-reliable-ai-workflows-with-pipelex/structuring-concepts.md+++ b/docs/home/6-build-reliable-ai-workflows/concepts/python-classes.md@@ -1,116 +1,10 @@-# Structuring Concepts+# Python StructuredContent Classes-Pipelex offers two ways to add structure to your concepts: **inline TOML structures** and **Python classes**. This guide helps you choose the right approach and shows you how to use both effectively.+For advanced features beyond inline structures, create explicit Python classes that inherit from `StructuredContent`. This approach gives you full Pydantic power with custom validation, computed properties, and reusable business logic.-For an introduction to concepts themselves, see [Define Your Concepts](define_your_concepts.md).+For most use cases, start with [Inline Structures](inline-structures.md) first. This guide shows when and how to use Python classes for more advanced needs.-## Quick Comparison--| Approach | Best For | Advantages | Limitations |-|----------|----------|------------|-------------|-| **Inline TOML** | Most use cases, prototyping | Fast, single-file, no boilerplate | No custom validation or methods |-| **Python Class** | Complex validation, computed properties | Full Pydantic power, IDE support | More files, more code |--## Inline Structure Definition--Define structured concepts directly in your `.plx` files using TOML syntax. This is the **recommended approach** for most use cases.--### Quick Example--```plx-domain = "finance"--[concept.Invoice]-description = "A commercial document issued by a seller to a buyer"--[concept.Invoice.structure]-invoice_number = "The unique invoice identifier"-issue_date = { type = "date", description = "The date the invoice was issued", required = true }-total_amount = { type = "number", description = "The total invoice amount", required = true }-vendor_name = "The name of the vendor"-line_items = { type = "list", item_type = "text", description = "List of items in the invoice", required = false }-```--Behind the scenes, Pipelex automatically generates a fully-typed Pydantic model with validation—all from TOML.--### Supported Field Types--Inline structures support these field types:--- **text**: String values-- **integer**: Whole numbers-- **boolean**: True/false values-- **number**: Numeric values (integers or floats)-- **date**: Date and datetime values-- **list**: Arrays/lists (specify `item_type`)-- **dict**: Dictionaries (specify `key_type` and `value_type`)--### Field Properties--Each field can specify:--- **type**: The data type (required for detailed definitions)-- **description**: Human-readable description-- **required**: Whether the field is mandatory (default: `true`)-- **default_value**: Default value if not provided-- **choices**: For enum-like fields, a list of valid values-- **item_type**: For list fields, the type of list items-- **key_type** and **value_type**: For dict fields, the types of keys and values--### Simple vs Detailed Syntax--**Simple syntax** (creates required text field):--```plx-[concept.Person.structure]-name = "The person's full name"-email = "The person's email address"-```--**Detailed syntax** (explicit properties):--```plx-[concept.Employee.structure]-employee_id = { type = "integer", description = "Unique employee identifier", required = true }-department = { type = "text", description = "Department name", required = false, default_value = "General" }-is_active = { type = "boolean", description = "Employment status", required = false, default_value = true }-```--You can mix both styles in the same structure.--### Complex Field Examples--**List Fields:**--```plx-[concept.Project.structure]-name = "Project name"-tags = { type = "list", item_type = "text", description = "Project tags", required = false }-team_members = { type = "list", item_type = "text", description = "Team member names", required = true }-```--**Dictionary Fields:**--```plx-[concept.Configuration.structure]-app_name = "Application name"-settings = { type = "dict", key_type = "text", value_type = "text", description = "Configuration settings", required = false }-```--**Choice Fields (Enums):**--```plx-[concept.Task.structure]-title = "Task title"-priority = { choices = ["low", "medium", "high"], description = "Task priority level", required = true }-status = { choices = ["todo", "in_progress", "done"], description = "Current status", default_value = "todo" }-```--## Python StructuredContent Classes--For advanced features, create explicit Python classes that inherit from `StructuredContent`.--### When to Use Python Classes+## When to Use Python ClassesUse Python classes when you need:@@ -121,7 +15,7 @@ Use Python classes when you need:5. **Advanced typing** - `Literal`, complex unions, etc.6. **Better IDE support** - Full autocomplete and type checking-### Basic Python Class Example+## Basic Python Class Example```pythonfrom pipelex.core.stuffs.structured_content import StructuredContent@@ -144,7 +38,7 @@ Classes inheriting from `StructuredContent` are automatically discovered and reg**Best practice:** Keep your `StructuredContent` classes in dedicated modules (e.g., `*_struct.py` files) with minimal module-level code, or ensure module-level code is safe to execute during discovery.-### With Custom Validation+## With Custom Validation```pythonfrom pipelex.core.stuffs.structured_content import StructuredContent@@ -167,7 +61,7 @@ class Invoice(StructuredContent):return v```-### With Computed Properties+## With Computed Properties```pythonfrom datetime import datetime@@ -193,54 +87,6 @@ class Subscription(StructuredContent):return months * self.monthly_price```-## Advantages of Inline Structures--Inline structures offer several benefits:--### Rapid Development--- **Single File**: Keep concepts, structures, and pipes all in one `.plx` file-- **No Context Switching**: No need to jump between `.plx` and `.py` files-- **Quick Iteration**: Modify structures instantly without managing separate files--### Simplicity--- **Declarative Syntax**: Straightforward TOML that's easy to read and write-- **No Boilerplate**: No need for Python imports, class definitions, or field declarations-- **Automatic Registration**: Generated classes are automatically discovered--### Type Safety--- **Pydantic Models**: Full Pydantic v2 models behind the scenes-- **Runtime Validation**: Automatic validation of structured outputs from LLMs-- **Type Hints**: Generated classes include proper type annotations--## Limitations of Inline Structures--### What Inline Structures Cannot Do--Inline structures cannot provide:--- **Custom validators** - No `@field_validator` decorators-- **Computed properties** - No `@property` methods-- **Custom methods** - No class methods or instance methods-- **Complex validation** - No cross-field validation logic-- **Nested custom concepts** - Cannot reference other custom concepts as field types (coming soon)-- **Advanced Pydantic features** - No custom serializers, model validators, etc.--### Concept Refinement Restrictions--Currently, inline structures can only be used for concepts that:--- Don't refine other concepts, OR-- Refine native concepts only: `Text`, `Image`, `PDF`, `TextAndImages`, `Number`, `Page`--### Tooling Limitations--- **Limited IDE autocomplete** compared to explicit Python classes-- **No static type checking** with `mypy` or `pyright`-- **Less refactoring support** in IDEs-## Using AI to Create Python ClassesModern AI coding assistants like Cursor AI and GitHub Copilot can generate `StructuredContent` classes instantly, making the transition from inline structures to Python classes fast and easy.@@ -383,49 +229,32 @@ class Product(StructuredContent):## Recommendations-The inline structure feature is a **practical solution for the majority of use cases**. Use it to:--- Get started quickly without Python overhead-- Keep all pipeline logic in one place-- Iterate rapidly during development-- Still get full type safety and validation--When your needs grow, **Python `StructuredContent` classes offer more power and flexibility**.-### Guidelines-- ✅ **Use inline structures** for straightforward data models+- ✅ **Start with inline structures** for straightforward data models- ✅ **Use inline structures** during prototyping and early development- ✅ **Use inline structures** for domain-specific models with simple validation-- ✅ **Use Python classes** when you need custom validation logic+- ✅ **Upgrade to Python classes** when you need custom validation logic- ✅ **Use Python classes** for reusable, shared data models- ✅ **Use Python classes** when you need computed properties or methods- ✅ **Use Python classes** for complex type relationshipsRemember: You can always start with inline structures and migrate to Python classes later. The migration is straightforward, and AI assistants can help you make the transition quickly.-## Future Roadmap+### The Pragmatic Approach-### Nested Custom Concepts (Coming Soon)--Soon, you'll be able to reference other custom concepts as field types in inline structures:+The inline structure feature is a **practical solution for the majority of use cases**. Use it to:-```plx-[concept.Address.structure]-street = "Street address"-city = "City name"-postal_code = "Postal or ZIP code"--[concept.Company.structure]-name = "Company name"-headquarters = { type = "Address", description = "Company headquarters", required = true }-```+- Get started quickly without Python overhead+- Keep all pipeline logic in one place+- Iterate rapidly during development+- Still get full type safety and validation-This will enable building complex, nested data models entirely within `.plx` files.+When your needs grow, **Python `StructuredContent` classes offer more power and flexibility**.## Related Documentation+- [Inline Structures](inline-structures.md) - Fast prototyping with TOML- [Define Your Concepts](define_your_concepts.md) - Learn about concept semantics and naming-- [Writing Workflows Tutorial](../writing-workflows/index.md) - Get started with structured outputs-- [Design and Run Pipelines](design_and_run_pipelines.md) - Use structured concepts in pipes+- [Writing Workflows Tutorial](../../2-get-started/pipe-builder.md) - Get started with structured outputsdiff --git a/docs/home/6-build-reliable-ai-workflows/concepts/refining-concepts.md b/docs/home/6-build-reliable-ai-workflows/concepts/refining-concepts.mdnew file mode 100644index 000000000..b91a29600--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/concepts/refining-concepts.md@@ -0,0 +1,278 @@+# Refining Concepts++Concept refinement allows you to create more specific versions of existing concepts while inheriting their structure. This provides semantic clarity and type safety for domain-specific workflows.++## What is Concept Refinement?++Refinement is the process of creating a specialized concept from a more general one. When you refine a concept, the new concept:++- **Inherits the structure** of the base concept+- **Adds semantic specificity** to clarify its purpose++Think of it as creating a subtype: an `Invoice` is a specific kind of `PDF`, and a `Photo` is a specific kind of `Image`.++## Why Refine Concepts?++### 1. Semantic Clarity++Refined concepts make your pipeline's intent explicit:++```plx+# ❌ Less clear+[pipe.process_invoice]+inputs = { invoice = "PDF" }++# ✅ More clear+[pipe.process_invoice]+inputs = { invoice = "Invoice" }+```++### 2. Self-Documenting Code++```plx+[pipe.extract_contract_terms]+type = "PipeLLM"+description = "Extract key terms from a contract"+inputs = { contract = "Contract" } # Clear what type of document is expected+output = "ContractTerms"+```++### 3. Domain-Specific Workflows++Build pipelines tailored to specific use cases:++```plx+domain = "finance"++[concept.Invoice]+description = "A commercial invoice"+refines = "PDF"++[concept.Receipt]+description = "Proof of payment"+refines = "PDF"++[pipe.process_invoice]+type = "PipeLLM"+inputs = { invoice = "Invoice" }+output = "InvoiceData"+# ... invoice-specific processing++[pipe.process_receipt]+type = "PipeLLM"+inputs = { receipt = "Receipt" }+output = "ReceiptData"+# ... receipt-specific processing+```++### 4. Type Validation++Using specific concept names helps catch errors early:++```plx+[pipe.analyze_invoice]+inputs = { invoice = "Invoice" } # Only accepts Invoice+output = "Analysis"+```++## Current Limitations++!!! warning "You can only refine native concepts (For Now)"+ Currently, you can **only refine [native concepts](native-concepts.md)**. Refining custom concepts will be supported in a future release++!!! warning "No structure on refined concepts (For Now)"+ When you refine a concept, you **cannot** add an inline structure or specify a `structure_class_name`. This limitation will be lifted in future releases.++ **Not allowed:**+ ```plx+ [concept.Invoice]+ description = "A commercial invoice"+ refines = "PDF"+ structure_class_name = "InvoiceModel" # ❌ Not allowed++ [concept.Invoice.structure] # ❌ Not allowed+ invoice_number = "Invoice ID"+ ```++ **Allowed:**+ ```plx+ [concept.Invoice]+ description = "A commercial invoice"+ refines = "PDF" # ✅ Inherits PDFContent structure+ ```++## Basic Refinement Syntax++Define a refined concept using the `refines` field:++```plx+[concept.ConceptName]+description = "Description of the refined concept"+refines = "NativeConceptName"+```++### Refining PDF++```plx+[concept.Invoice]+description = "A commercial document issued by a seller to a buyer"+refines = "PDF"++[concept.Contract]+description = "A legally binding agreement between parties"+refines = "PDF"+```++Both concepts inherit the `PDFContent` structure (with a `url` field) but represent semantically distinct document types.++### Refining Image++```plx+[concept.ProductPhoto]+description = "A photograph of a product for marketing purposes"+refines = "Image"++[concept.Screenshot]+description = "A screen capture image"+refines = "Image"+```++Each inherits `ImageContent` structure (url, caption, base_64, etc.) with specific semantic meaning.++### Refining Text++```plx+[concept.Article]+description = "A written composition on a specific topic"+refines = "Text"++[concept.Summary]+description = "A condensed version of a longer text"+refines = "Text"+```++## Type Compatibility++Understanding how refined concepts interact with pipe inputs is crucial.++### How Refinement Affects Type Checking++!!! important "Key Rule"+ A pipe that accepts a **native concept** will **NOT** accept concepts that refine it.++ ```plx+ [pipe.extract_text]+ inputs = { document = "PDF" } # Only accepts PDF, not Invoice or Contract+ ```++ If you want a pipe to accept both a native concept and its refinements, you must explicitly define the pipe to accept the refined concepts or use a more general approach.++### Practical Example++```plx+[concept.Invoice]+refines = "PDF"++[concept.Contract]+refines = "PDF"++# This pipe only accepts generic PDFs+[pipe.extract_from_pdf]+type = "PipeExtract"+inputs = { document = "PDF" }+output = "Page"++# This pipe only accepts Invoices+[pipe.process_invoice]+type = "PipeLLM"+inputs = { invoice = "Invoice" }+output = "InvoiceData"++# This pipe only accepts Contracts+[pipe.process_contract]+type = "PipeLLM"+inputs = { contract = "Contract" }+output = "ContractData"+```++In this setup:++- `extract_from_pdf` expects exactly `PDF` (not `Invoice` or `Contract`)+- `process_invoice` expects exactly `Invoice`+- `process_contract` expects exactly `Contract`++## Best Practices++### 1. Choose Meaningful Names++```plx+# ❌ Avoid generic or vague names+[concept.Document1]+refines = "PDF"++# ✅ Use specific, descriptive names+[concept.Invoice]+refines = "PDF"+```++### 2. Write Clear Descriptions++```plx+# ❌ Too vague+[concept.Invoice]+description = "A document"+refines = "PDF"++# ✅ Clear and specific+[concept.Invoice]+description = "A commercial document issued by a seller to a buyer, detailing products or services provided and payment terms"+refines = "PDF"+```++### 3. Don't Over-Refine++```plx+# ❌ Too specific, creates unnecessary complexity+[concept.SmallInvoice]+description = "An invoice under $100"+refines = "PDF"++[concept.LargeInvoice]+description = "An invoice over $1000"+refines = "PDF"++# ✅ Keep it general, handle specifics in processing logic+[concept.Invoice]+description = "A commercial invoice"+refines = "PDF"+```++## When to Refine vs. When to Create New Concepts++### Refine When:++- ✅ Your concept is semantically a specific type of a native concept+- ✅ The native structure is sufficient for your needs+- ✅ You want to inherit existing validation and behavior+- ✅ You're building domain-specific workflows with clear document/content types++**Example:**+```plx+[concept.Invoice] # Clearly a type of PDF+refines = "PDF"+```++### Create New Concept When:++- ✅ Your concept needs custom structure with multiple fields+- ✅ Your concept doesn't naturally fit any native concept+- ✅ You need complex validation or computed properties+++## Related Documentation++- [Define Your Concepts](define_your_concepts.md) - Introduction to concepts+- [Native Concepts](native-concepts.md) - Complete guide to native concepts+- [Inline Structures](inline-structures.md) - Add structure to concepts+- [Python StructuredContent Classes](python-classes.md) - Advanced customization+diff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/configure-ai-llm-to-optimize-workflows.md b/docs/home/6-build-reliable-ai-workflows/configure-ai-llm-to-optimize-workflows.mdsimilarity index 96%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/configure-ai-llm-to-optimize-workflows.mdrename to docs/home/6-build-reliable-ai-workflows/configure-ai-llm-to-optimize-workflows.mdindex 4105d5324..7e115c727 100644--- a/docs/pages/build-reliable-ai-workflows-with-pipelex/configure-ai-llm-to-optimize-workflows.md+++ b/docs/home/6-build-reliable-ai-workflows/configure-ai-llm-to-optimize-workflows.md@@ -10,7 +10,7 @@ The system provides three main concepts for LLM configuration:- LLM Presets- Model Deck-For complete details about the inference backend configuration system, see the [Inference Backend Configuration](../configuration/config-technical/inference-backend-config.md) documentation.+For complete details about the inference backend configuration system, see the [Inference Backend Configuration](../../home/7-configuration/config-technical/inference-backend-config.md) documentation.## LLM Handles (Aliases)diff --git a/docs/home/6-build-reliable-ai-workflows/domain.md b/docs/home/6-build-reliable-ai-workflows/domain.mdnew file mode 100644index 000000000..d2b1486c7--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/domain.md@@ -0,0 +1,176 @@+# Understanding Domains++A domain in Pipelex is a **semantic namespace** that organizes related concepts and pipes. It's declared at the top of every `.plx` file and serves as an identifier for grouping related functionality.++## What is a Domain?++A domain is defined by three properties:++- **`code`** (required) - The unique identifier for the domain (must be snake_case)+- **`description`** (optional) - A human-readable description of the domain's purpose+- **`system_prompt`** (optional) - A default system prompt for all PipeLLM operators in bundles using this domain++## Declaring a Domain++Every `.plx` file must declare its domain at the beginning:++```plx+domain = "invoice_processing"+description = "Tools for extracting, validating, and processing invoice documents"+system_prompt = "You are an expert in financial document analysis and invoice processing."+```++!!! important "Domain Code Naming Convention"+ Domain codes **MUST** be in `snake_case` (lowercase with underscores). Use descriptive names that clearly indicate the domain's purpose.++ **Valid domain codes:**+ ```plx+ ✅ domain = "finance"+ ✅ domain = "invoice_processing"+ ✅ domain = "medical_records"+ ✅ domain = "customer_service"+ ```++ **Invalid domain codes:**+ ```plx+ ❌ domain = "Finance" # No uppercase+ ❌ domain = "invoice-processing" # No hyphens+ ❌ domain = "INVOICE_PROCESSING" # No all caps+ ❌ domain = "invoiceProcessing" # camelCase not allowed+ ```++## How Domains Work++### Concept Namespacing++Every concept defined in a bundle belongs to the domain declared in that bundle. The full identifier for a concept is:++```+domain_code.ConceptName+```++**Example:**++```plx+domain = "finance"++[concept]+Invoice = "A commercial document for a sale"+Payment = "A financial transaction"+```++This creates two concepts:+- `finance.Invoice`+- `finance.Payment`++### Domain as Namespace++The domain code prevents naming conflicts. Multiple bundles can define concepts with the same name if they're in different domains:++```plx+# finance.plx+domain = "finance"+[concept]+Report = "A financial report"+```++```plx+# marketing.plx+domain = "marketing"+[concept]+Report = "A marketing campaign report"+```++Result: Two different concepts (`finance.Report` and `marketing.Report`) with no conflict.++### Multiple Bundles, Same Domain++Multiple `.plx` files can declare the same domain. They all contribute to that domain's namespace:++```plx+# finance_invoices.plx+domain = "finance"+[concept]+Invoice = "..."+```++```plx+# finance_payments.plx+domain = "finance"+[concept]+Payment = "..."+```++Both files contribute to the `finance` domain, creating:+- `finance.Invoice`+- `finance.Payment`++## Using Domains++### In Bundle Files++**Same-domain references** (no prefix needed):++```plx+domain = "finance"++[concept]+Invoice = "A commercial document"++[pipe.process_invoice]+type = "PipeLLM"+inputs = { invoice = "Invoice" } # Same domain, no prefix+output = "Text"+prompt = "Process this invoice: @invoice"+```++**Cross-domain references** (prefix required):++```plx+domain = "accounting"++[pipe.reconcile]+type = "PipeLLM"+inputs = { invoice = "finance.Invoice" } # Different domain, needs prefix+output = "Report"+prompt = "Reconcile this invoice: @invoice"+```++### In Python Code++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+ name="invoice_123",+ content=invoice_data+)+```++## System Prompt Inheritance++When you set a `system_prompt` at the domain level, it applies to all `PipeLLM` operators in bundles that declare that domain:++```plx+domain = "medical_records"+system_prompt = "You are a medical records specialist with expertise in HIPAA compliance."++[pipe.extract_diagnosis]+type = "PipeLLM"+# Automatically inherits the domain's system_prompt+inputs = { record = "MedicalRecord" }+output = "Diagnosis"+prompt = "Extract the primary diagnosis: @record"+```++Individual pipes can override the domain system prompt by defining their own `system_prompt` field.++## Related Documentation++- [Pipelex Bundle Specification](./pipelex-bundle-specification.md) - How domains are declared in bundles+- [Kick off a Pipelex Workflow Project](./kick-off-a-pipelex-workflow-project.md) - Getting started+- [Define Your Concepts](./concepts/define_your_concepts.md) - Creating concepts within domains+- [Designing Pipelines](./pipes/index.md) - Building pipes within domainsdiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/kick-off-a-pipelex-workflow-project.md b/docs/home/6-build-reliable-ai-workflows/kick-off-a-pipelex-workflow-project.mdsimilarity index 55%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/kick-off-a-pipelex-workflow-project.mdrename to docs/home/6-build-reliable-ai-workflows/kick-off-a-pipelex-workflow-project.mdindex 7e9343fe0..c31aee0c3 100644--- a/docs/pages/build-reliable-ai-workflows-with-pipelex/kick-off-a-pipelex-workflow-project.md+++ b/docs/home/6-build-reliable-ai-workflows/kick-off-a-pipelex-workflow-project.md@@ -4,9 +4,8 @@A pipeline in Pipelex is a collection of related concepts and pipes. Start by creating a PLX file in your project:+`tutorial.plx````plx-# tutorial.plx-domain = "tutorial"description = "My first Pipelex library"system_prompt = "You are a helpful assistant."@@ -38,92 +37,12 @@ This creates a simple Q&A pipeline with:The `domain` property is the most important part of your pipeline file. It groups all your concepts and pipes into a single, easy to read bundle.-## What Are Domains?--A domain in Pipelex represents a topic or area of functionality within your pipeline. Every pipeline file must specify its domain, which helps organize and categorize your pipes and concepts.--### Domain in Practice+!!! info "Learn More About Domains"+ Domains are a core concept in Pipelex that organize your pipelines, concepts, and pipes into semantic namespaces. For a comprehensive guide on domains, see [Understanding Domains](./domain.md).-When you create a pipeline file (`.plx`), you always start by declaring its domain:--```plx-domain = "finance" # The domain name for this file-description = "Financial document processing" # Optional description-system_prompt = "You are an expert financial analyst." # Optional system prompt for all PipeLLM in this domain-```--A domain consists of:--1. **Pipeline File** (`.plx`)- ```plx- domain = "finance"-- [concept]- Invoice = "A commercial document for a sale of products or services"- InvoiceSummary = "A summary of an invoice with key details"-- [pipe]- [pipe.summarize_invoice]- type = "PipeLLM"- description = "Summarize an invoice to extract key information"- inputs = { invoice = "finance.Invoice" }- output = "finance.InvoiceSummary"- ```--2. **Python Models** (`.py`)- ```python- from pipelex.core.stuffs.structured_content import StructuredContent- from pydantic import Field- from typing import List- from datetime import date-- class Invoice(StructuredContent):- invoice_number: str- vendor: str- customer: str- total_amount: float = Field(ge=0)- issue_date: date- line_items: List[str]-- class InvoiceSummary(StructuredContent):- vendor: str- total_amount: float- is_overdue: bool- ```--### Best Practices--1. **Naming**- - Use clear, descriptive domain names.- - Keep names lowercase and simple.- - Use names that reflect the purpose (e.g., "finance", "legal", "content_creation").--2. **Organization**- - One domain per topic/functionality.- - Use `_struct.py` suffix for structure files (`finance.plx` -> `finance_struct.py`).- - Keep related concepts within the same domain.- - Place your `.plx` files anywhere in your project - Pipelex automatically discovers them.- - Keep `.pipelex/` configuration directory at repository root.--3. **Documentation**- - Always add a description to your domain.- - Document concepts clearly.- - Include examples where helpful.--### Using Domains--When using a domain in your code, you refer to concepts with `domain.ConceptName`:--```python-from pipelex.core.stuffs.stuff_factory import StuffFactory--# The concept_code combines domain and concept names-invoice_stuff = StuffFactory.make_from_concept_string(- concept_string="finance.Invoice", # domain.ConceptName- name="invoice_123",- content=invoice_data # dictionary or Invoice object-)-```+See more about designing pipes in [Designing Pipelines](./pipes/index.md).+See more about concepts in [Define Your Concepts](./concepts/define_your_concepts.md)+See more about domains in [Understanding Domains](./domain.md)## File Naming Conventions@@ -134,6 +53,8 @@ Consistent naming makes your pipeline code discoverable and maintainable:- Match the domain name when possible: domain "legal" → `legal.plx`- For multi-word domains, use underscores: domain "customer_service" → `customer_service.plx`+See more about pipelex bundle specification in [Pipelex Bundle Specification](./pipelex-bundle-specification.md)+### Python Model Files- It is recommended to name structure files with a `_struct.py` suffix: `legal.plx` → `legal_struct.py`- Pipelex will automatically discover and load structure classes from all Python files in your project (excluding common directories like `.venv`, `.git`, etc.)diff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/llm-structured-generation-config.md b/docs/home/6-build-reliable-ai-workflows/llm-structured-generation-config.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/llm-structured-generation-config.mdrename to docs/home/6-build-reliable-ai-workflows/llm-structured-generation-config.mddiff --git a/docs/home/6-build-reliable-ai-workflows/pipe-builder.md b/docs/home/6-build-reliable-ai-workflows/pipe-builder.mdnew file mode 100644index 000000000..e7bc7301d--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/pipe-builder.md@@ -0,0 +1,170 @@+# Pipe Builder++Pipelex provides powerful tools to automatically generate complete, working pipelines from natural language requirements. This feature leverages AI to translate your ideas into fully functional pipeline code, dramatically speeding up development.++!!! tip "Pipe Builder Requirements"+ For now, the pipe builder requires access to **Claude 4.5 Sonnet**, either through Pipelex Inference, or using your own key through Anthropic, Amazon Bedrock or BlackboxAI. Don't hesitate to join our [Discord](https://go.pipelex.com/discord) to get a key or see [Configure AI Providers](../../home/5-setup/configure-ai-providers.md) for details. Otherwise, you can also create the workflows yourself, following our [documentation guide](./kick-off-a-pipelex-workflow-project.md).++## Overview++The pipeline creation system can generate pipelines in different modes depending on your needs - from quick one-shot generation to validated, production-ready pipelines that have been automatically tested and fixed.++## Build Pipe++Generate a validated pipeline with automatic fixing of deterministic issues:++```bash+pipelex build pipe "BRIEF IN NATURAL LANGUAGE" [OPTIONS]+```++This command runs a validation/fix loop to ensure the generated pipeline is correct and runnable. It automatically detects and corrects common issues.++**What Gets Generated:**++The build command creates two essential files:++1. **`.plx` file** - Your complete pipeline definition with concepts and pipes+2. **`inputs.json` template** - A pre-filled template showing the inputs your pipeline expects++After generation, you can fill in the `inputs.json` template with your actual data and run the pipeline. For detailed guidance on preparing and formatting inputs, see [Providing Inputs to Pipelines](./pipes/provide-inputs.md).++**Example:**++```bash+pipelex build pipe "Take a photo as input, and render the opposite of the photo" \+ -o results/photo_inverter.plx+```++**Options:**++- `--output, -o`: Output path for generated PLX file+- `--no-output`: Skip saving the pipeline to file++## Quick Start Example++The simplest way to create a pipeline is to use the `build pipe` command with a clear description:++```bash+pipelex build pipe "Given an expense report, apply company rules and validate compliance"+```++This will:++1. Analyze your requirements+2. Generate a complete pipeline with appropriate concepts and pipes+3. Validate the pipeline for correctness+4. Fix any deterministic issues automatically+5. Save the working pipeline++## Best Practices++When creating pipelines with natural language:++**Be Specific About Inputs and Outputs:**++- ✅ Good: "Take a PDF invoice as input and extract the total amount, vendor name, and date"+- ❌ Vague: "Process invoices"++**Describe the Transformation:**++- ✅ Good: "Analyze sentiment of customer reviews and categorize as positive, negative, or neutral"+- ❌ Vague: "Do something with reviews"++**Mention Data Types When Relevant:**++- ✅ Good: "Extract text from a PDF, then summarize it into 3 bullet points"+- ❌ Unclear: "Summarize documents"++## What Gets Generated++When you run a build command, Pipelex automatically creates:++- **Domain definition**: The namespace for your pipeline+- **Concepts**: Structured data types for inputs and outputs+- **Pipes**: The processing steps and LLM operations+- **Python structures**: When structured output is needed (saved alongside the `.plx` file with `_struct.py` suffix)++All generated pipelines follow Pipelex best practices and conventions automatically.++## Next Steps++After generating your pipeline:++1. **Review the generated `.plx` file** to understand the structure+2. **Test the pipeline** using the generated example code+3. **Iterate if needed** by modifying the natural language description and regenerating+4. **Customize** the pipeline by editing the `.plx` file directly for fine-tuning++## How It Works++The Pipe Builder is itself a Pipelex pipeline (`builder.pipe_builder`) that transforms your natural language brief into a complete, validated pipeline through a multi-stage process, demonstrating the power and flexibility of the framework. Here's what happens under the hood:++### 1. Draft the Plan++The builder analyzes your brief and creates a pseudo-code plan describing:+- The sequence of pipes needed+- Input and output variables for each step+- Where structured outputs are needed+- Which orchestration controllers to use (Sequence, Batch, Parallel, Condition)++### 2. Define Concepts++From the plan, the builder identifies and defines the concepts (data types) needed:+- Analyzes what inputs and outputs are required+- Creates concept definitions with clear descriptions+- Determines which concepts need structure vs. simple text+- Reuses concepts where possible (e.g., "Article" instead of "LongArticle", "ShortArticle")++### 3. Structure Concepts++For concepts that need structure, the builder:+- Designs field definitions with appropriate types (text, integer, boolean, number, date, list, dict)+- Determines which fields are required vs. optional+- Creates inline structures or Python classes as needed++### 4. Draft and Review Flow++The builder designs the complete flow architecture:+- Maps out pipe controllers (PipeSequence, PipeBatch, PipeParallel, PipeCondition)+- Assigns pipe operators (PipeLLM, PipeExtract, PipeImgGen) to specific tasks+- Ensures variables flow correctly through the memory system+- Reviews the flow for consistency and fixes any issues++### 5. Design Pipe Signatures++Creates the contracts for each pipe:+- Assigns unique pipe codes (snake_case, verb-based)+- Defines inputs and outputs with proper concept types+- Handles multiplicity (single items, lists, fixed-size arrays)+- Identifies pipe dependencies++### 6. Detail Pipe Specifications++For each pipe signature, generates the complete specification:+- **PipeLLM**: Creates prompts and configures LLM settings+- **PipeExtract**: Sets up document/image extraction+- **PipeImgGen**: Configures image generation from prompts+- **PipeSequence**: Defines step-by-step execution+- **PipeBatch**: Sets up concurrent processing over lists+- **PipeParallel**: Orchestrates concurrent different pipes+- **PipeCondition**: Creates conditional branching logic++### 7. Create Domain and Assemble++Finally, the builder:+- Names the domain based on your brief+- Assembles all concepts and pipes into a complete bundle+- Generates the `.plx` file with proper syntax+- Creates Python structure files (`*_struct.py`) when needed+- Validates the pipeline and fixes deterministic issues++## Explore the Source++Want to see how the Pipe Builder works internally? Check out the source code:++- **Main pipeline**: [`pipelex/builder/builder.plx`](https://github.com/pipelex/pipelex/tree/main/pipelex/builder/builder.plx)+- **Pipe design**: [`pipelex/builder/pipe/pipe_design.plx`](https://github.com/pipelex/pipelex/tree/main/pipelex/builder/pipe/pipe_design.plx)+- **Concept building**: [`pipelex/builder/concept/concept.plx`](https://github.com/pipelex/pipelex/tree/main/pipelex/builder/concept/concept.plx)++The Pipe Builder is a great example of a complex, multi-stage Pipelex pipeline in action.+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.mdnew file mode 100644index 000000000..868ce65da--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/pipelex-bundle-specification.md@@ -0,0 +1,244 @@+# Pipelex Bundle Specification++A **Pipelex bundle** is the fundamental unit of organization in Pipelex. It's a single `.plx` file that defines a cohesive set of concepts and pipes for a specific domain of work.++## What is a Pipelex Bundle?++A Pipelex bundle (`.plx` file) brings together:++- **Domain declaration** - The semantic namespace for all concepts and pipes in this bundle+- **Concepts** - The knowledge structures that flow through your pipes (optional)+- **Pipes** - The processing units that transform and manipulate your concepts (optional)++Think of a bundle as a self-contained module that solves a specific problem domain. For example, you might have:++- `invoice_processing.plx` - Bundle for invoice extraction and validation+- `marketing.plx` - Bundle for generating marketing content+- `document_analysis.plx` - Bundle for analyzing documents++## Bundle Structure++Every Pipelex bundle follows this structure:++```plx+# 1. Domain Declaration (MANDATORY)+domain = "domain_name"+description = "Description of what this domain handles"++# 2. Optional: Main Pipe Declaration+main_pipe = "pipe_code"++# 3. Concept Definitions (OPTIONAL)+[concept]+ConceptName1 = "Description"+ConceptName2 = "Description"++# 4. Pipe Definitions (OPTIONAL)+[pipe]+[pipe.pipe_code]+type = "PipeLLM"+# ... pipe configuration++[pipe.pipe_code_2]+...+```++### 1. Domain Declaration (MANDATORY)++Every bundle **must** declare a domain. Only the `domain` field is mandatory; all other fields are optional:++```plx+domain = "invoice_processing"+description = "Tools for extracting and validating invoice data"+source = "path/to/invoice_processing.plx"+system_prompt = "You are an expert in financial document processing."+main_pipe = "extract_and_validate_invoice"+```++**Bundle Header Fields:**++- **`domain`** (required) - The unique identifier for this bundle's namespace+- **`description`** (Optional) - A human-readable description of what this bundle does+- **`source`** (Optional) - The file path of the bundle (usually set automatically)+- **`system_prompt`** (Optional) - A system prompt that applies to all `PipeLLM` operators in this bundle+- **`main_pipe`** (Optional) - The default pipe to execute when no specific pipe is requested when running the bundle (covered in section 2)++**Why domains matter:**++- Domains create unique namespaces for your concepts and pipes+- They prevent naming conflicts when multiple bundles define concepts with the same name+- They enable organized, modular pipeline architecture++Learn more about domains in [Understanding Domains](./domain.md).++**About `system_prompt`:**++When you define a `system_prompt` at the bundle level, it automatically applies to every `PipeLLM` operator in the bundle. This is useful for setting domain-specific context:++```plx+domain = "medical_records"+system_prompt = "You are a medical records specialist with expertise in HIPAA compliance and clinical documentation."++[pipe.extract_diagnosis]+type = "PipeLLM"+# This pipe will automatically use the bundle's system_prompt+inputs = { record = "MedicalRecord" }+output = "Diagnosis"+prompt = "Extract the primary diagnosis from this medical record: @record"+```++Individual pipes can override the bundle's system prompt by defining their own `system_prompt` field.++**About `main_pipe`:**++You can specify a default pipe to execute when no specific pipe is requested:++```plx+domain = "invoice_processing"+main_pipe = "extract_and_validate_invoice"+```++**How `main_pipe` works:**++- When executing a bundle without specifying a `pipe_code`, Pipelex runs the `main_pipe`+- If no `main_pipe` is specified, you must explicitly provide the `pipe_code` when executing+- The `main_pipe` value must reference a pipe defined in the same bundle++See more about executing pipes in [Executing Pipelines](./pipes/executing-pipelines.md).++### 3. Concept Definitions (OPTIONAL)++Concepts define the knowledge structures in your domain. While optional, most bundles define at least a few concepts (See more about concepts in [Define Your Concepts](./concepts/define_your_concepts.md)):++```plx+[concept]+Invoice = "A commercial document issued by a seller to a buyer"+Vendor = "A company or individual that provides goods or services"+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:++```+domain_name.ConceptName+```++For example, if your domain is `invoice_processing`, the concept `Invoice` has the full identifier:++```+invoice_processing.Invoice+```++This full identifier is how other bundles reference your concepts.++### 4. Pipe Definitions (OPTIONAL)++Pipes are the processing units that transform data. Like concepts, they're optional:++```plx+[pipe.extract_invoice]+type = "PipeExtract"+description = "Extract text and images from an invoice PDF"+inputs = { document = "PDF" }+output = "Page"+```+See more about designing pipes in [Designing Pipelines](./pipes/index.md).++## Referencing Concepts: When to Use Domain Prefixes++Understanding when to use domain 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:++```plx+domain = "invoice_processing"++[concept]+Invoice = "A commercial document issued by a seller to a buyer"+ValidationResult = "Result of validating an invoice"++[pipe.validate_invoice]+type = "PipeLLM"+description = "Validate invoice data"+inputs = { invoice = "Invoice" } # ✅ No prefix needed+output = "ValidationResult" # ✅ No prefix needed+prompt = "Validate this invoice: @invoice"+```++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:++```plx+domain = "accounting"++[concept]+Payment = "A financial transaction recording money transfer"+ReconciliationReport = "Report of payment reconciliation"+```++```plx+[pipe.reconcile_payment]+type = "PipeLLM"+description = "Reconcile a payment with an invoice"+inputs = {+ invoice = "invoice_processing.Invoice", # ✅ Different domain, needs prefix+ payment = "Payment" # ✅ Same domain, no prefix+}+output = "ReconciliationReport"+prompt = """+Reconcile this payment with the invoice...+"""+```++## Bundles Working Together++One of Pipelex's strengths is how bundles can reference and build upon each other, creating modular, reusable pipeline architectures.++### Calling Pipes from Other Bundles++A pipe in one bundle can call a pipe from another bundle using the full pipe identifier:++```plx+domain = "accounts_payable"++[pipe.process_vendor_invoice]+type = "PipeSequence"+description = "Process a vendor invoice end-to-end"+inputs = { pdf_document = "PDF" }+output = "PaymentSchedule"+steps = [+ # Call pipe from invoice_processing domain+ { pipe = "invoice_processing.extract_invoice", result = "extracted_data" },++ # Call pipe from validation domain+ { pipe = "validation.validate_data", result = "validation_report" },++ # Call pipe from this domain (no prefix needed)+ { pipe = "schedule_payment", result = "payment_schedule" }+]++[pipe.schedule_payment]+type = "PipeLLM"+description = "Schedule payment based on invoice data"+inputs = {+ extracted_data = "invoice_processing.Invoice", # Concept from another domain+ validation_report = "validation.Report" # Concept from another domain+}+output = "PaymentSchedule"+prompt = "..."+```++## Related Documentation++- [Understanding Domains](./domain.md) - Deep dive into domain organization+- [Designing Pipelines](./pipes/index.md) - Learn how to design and compose pipes+- [Define Your Concepts](./concepts/define_your_concepts.md) - Complete guide to concept definitions+- [Kick off a Pipelex Workflow Project](./kick-off-a-pipelex-workflow-project.md) - Start a new project+diff --git a/docs/home/6-build-reliable-ai-workflows/pipes/executing-pipelines.md b/docs/home/6-build-reliable-ai-workflows/pipes/executing-pipelines.mdnew file mode 100644index 000000000..afe0d2df9--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/pipes/executing-pipelines.md@@ -0,0 +1,125 @@+# Executing Pipelines++Once your pipes are defined in `.plx` files, you can execute them in multiple ways:++## Option 1: Using the Pipelex CLI++First you can prepare the inputs for your pipeline in a JSON file.++```bash+pipelex build inputs path/to/my_pipe.plx+```++This will create a `inputs.json` file in the `results` directory, with the needed inputs for your pipeline. You can fill in the values for the inputs in the `results/inputs.json` file.++Then you can execute the pipeline with the CLI.++```bash+pipelex run path/to/my_pipe.plx --inputs results/inputs.json+```++See more about the CLI [here](../../../home/9-tools/cli.md).++## Option 2: Using the python method `execute_pipeline`++This function executes the specified pipe and waits for it to complete, returning the final output.++There are 2 ways of using the `execute_pipeline` method:++### Option 2.1: Using the pipe code++This requires your pipelex file to be in the current directory, that means it will be loaded in the library. You can use the `pipelex show pipes` command to list all the pipes available in your project.++```python+from pipelex.pipelex import Pipelex+from pipelex.pipeline.execute import execute_pipeline++# First, initialize Pipelex (this loads all pipeline definitions)+Pipelex.make()++# Execute the pipeline and wait for the result+pipe_output = await execute_pipeline(+ pipe_code="description_to_tagline",+ inputs={+ "description": {+ "concept": "ProductDescription",+ "content": "EcoClean Pro is a revolutionary biodegradable cleaning solution that removes 99.9% of germs while being completely safe for children and pets. Made from plant-based ingredients.",+ },+ },+)+```++### Option 2.2: Using the pipelex bundle content++You can directly pass to the `execute_pipeline` method the content of your pipelex file and the necessary inputs.++```python+from pipelex.pipelex import Pipelex+from pipelex.pipeline.execute import execute_pipeline++my_pipe_content = """+domain = "marketing"+description = "Marketing content generation domain"++# 1. Define the concepts used in our pipes+[concept]+ProductDescription = "A description of a product's features and benefits"+Tagline = "A catchy marketing tagline"++# 2. Define the pipe that does the work+[pipe.generate_tagline]+type = "PipeLLM"+description = "Generate a catchy tagline for a product"+inputs = { description = "ProductDescription" }+output = "Tagline"+prompt = "Product Description: @description \n Generate a catchy tagline based on the above description. The tagline should be memorable, concise, and highlight the key benefit.+"""+pipe_output = await execute_pipeline(+ plx_content=my_pipe_content,+ pipe_code="description_to_tagline",+ inputs={+ "description": {+ "concept": "ProductDescription",+ "content": "EcoClean Pro is a revolutionary biodegradable cleaning solution that removes 99.9% of germs while being completely safe for children and pets. Made from plant-based ingredients.",+ },+ },+)+```++!!! note "Using the pipe code"+ If your `plx_content` contains a `main_pipe` property (See more about the [Pipelex Bundle Specification](../pipelex-bundle-specification.md)), there is no need to provide the `pipe_code` parameter, the pipe that will be executed will be the one defined by `main_pipe` property. However if it doesn't, you must to provide the `pipe_code` parameter.++ If you provide the `pipe_code` and your `plx_content` does contain a `main_pipe` property, the pipe_code will be the one to be executed.++## Option 3: Using the Pipelex API++Pipelex has an API, see more about it [here](https://pipelex.github.io/pipelex-api/).++# Background Execution with `start_pipeline`++For more complex scenarios where you need asynchronous control, use `start_pipeline`. This function immediately returns a `pipeline_run_id` and an `asyncio.Task`, allowing you to run pipelines in the background.++```python+from pipelex.pipelex import Pipelex+from pipelex.pipeline.start import start_pipeline++Pipelex.make()++# Start the pipeline without waiting+pipeline_run_id, task = await start_pipeline(+ pipe_code="description_to_tagline",+ inputs={+ "description": {+ "concept": "ProductDescription",+ "content": "...",+ },+ },+)++print(f"Pipeline started with ID: {pipeline_run_id}")++# Do other work while the pipeline runs...++# Wait for completion when ready+pipe_output = await task+```diff --git a/docs/home/6-build-reliable-ai-workflows/pipes/index.md b/docs/home/6-build-reliable-ai-workflows/pipes/index.mdnew file mode 100644index 000000000..90dc5eea3--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/pipes/index.md@@ -0,0 +1,149 @@+# Designing Pipelines++In Pipelex, a pipeline is not just a rigid sequence of steps; it's a dynamic and intelligent workflow built by composing individual, reusable components called **pipes**. This approach allows you to break down complex AI tasks into manageable, testable, and reliable units.++This guide provides an overview of how to design your pipelines.++## The Building Blocks: Pipes++A pipeline is composed of pipes. There are two fundamental types of pipes you will use to build your workflows:++* **[Pipe Operators](./pipe-operators/index.md)**: These are the "workers" of your pipeline. They perform concrete actions like calling an LLM (`PipeLLM`), extracting text from a document (`PipeExtract`), or running a Python function (`PipeFunc`). Each operator is a specialized tool designed for a specific task.+* **[Pipe Controllers](./pipe-controllers/index.md)**: These are the "managers" of your pipeline. They don't perform tasks themselves but orchestrate the execution flow of other pipes. They define the logic of your workflow, such as running pipes in sequence (`PipeSequence`), in parallel (`PipeParallel`), or based on a condition (`PipeCondition`).++## Designing a Pipeline: Composition in PLX++The most common way to design a pipeline is by defining and composing pipes in a `.plx` configuration file. This provides a clear, declarative way to see the structure of your workflow.++Each pipe, whether it's an operator or a controller, is defined in its own `[pipe.<pipe_code>]` table. The `<pipe_code>` becomes the unique identifier for that pipe.++!!! important "Pipe Code Naming Convention"+ Pipe codes **MUST** be in `snake_case` (lowercase with underscores). Use descriptive names that clearly indicate what the pipe does.++ **Valid pipe codes:**+ ```plx+ ✅ [pipe.generate_tagline]+ ✅ [pipe.extract_invoice]+ ✅ [pipe.validate_and_process]+ ✅ [pipe.send_email]+ ```++ **Invalid pipe codes:**+ ```plx+ ❌ [pipe.GenerateTagline] # PascalCase not allowed+ ❌ [pipe.generateTagline] # camelCase not allowed+ ❌ [pipe.generate-tagline] # Hyphens not allowed+ ❌ [pipe.GENERATE_TAGLINE] # All caps not allowed+ ```++Let's look at a simple example. Imagine we want a workflow that:+1. Takes a product description.+2. Generates a short, catchy marketing tagline for it.++We can achieve this with a `PipeLLM` operator.++`marketing_pipeline.plx`+```plx+domain = "marketing"+description = "Marketing content generation domain"++# 1. Define the concepts used in our pipes+[concept]+ProductDescription = "A description of a product's features and benefits"+Tagline = "A catchy marketing tagline"++# 2. Define the pipe that does the work+[pipe.generate_tagline]+type = "PipeLLM"+description = "Generate a catchy tagline for a product"+inputs = { description = "ProductDescription" }+output = "Tagline"+prompt = """+Product Description:+@description++Generate a catchy tagline based on the above description.+The tagline should be memorable, concise, and highlight the key benefit.+"""+```++This defines a single-step pipeline. The pipe `generate_tagline` takes a `ProductDescription` as input and outputs a `Tagline` (both are native Text concepts, see more about native concepts [here](../concepts/native-concepts.md)).++The inputs specified will be required before the pipe is executed. Those inputs should be stored in the [Working Memory](working-memory.md).++The output concept is very important. Indeed, the output of your pipe will be corresponding to the concept you specify. If the concept is structured, the output will be a structured object. If the concept is native, the output will be a string.++### Understanding the Pipe Contract++Every pipe defines a **contract** through its `inputs` and `output` fields. This contract is fundamental to how Pipelex ensures reliability in your workflows:++* **`inputs`**: This dictionary defines the **mandatory and necessary** data that must be present in the [Working Memory](working-memory.md) before the pipe can execute. Each key in the dictionary becomes a variable name that you can reference in your pipe's logic (e.g., in prompts), and each value specifies the concept type that the data must conform to. If any required input is missing or doesn't match the expected concept, the pipeline will fail a clear error message.+You can specify multiple inputs by using a list of concepts. For example, `inputs = { description = "ProductDescription", keywords = "Keyword[]" }` will require a `ProductDescription` and a list of `Keyword`s. (See more about [Understanding Multiplicity](./understanding-multiplicity.md) for details.)++* **`output`**: This field declares what the pipe will produce. The output will always be an instance of the specified concept. The structure and type of the output depend on the concept definition (See more about concepts [here](../concepts/native-concepts.md)).+ * You can specify **multiple outputs** using bracket notation (e.g., `Keyword[]` for a variable list, or `Image[3]` for exactly 3 images)++### Multi-Step Workflows++To create a multi-step workflow, you use a controller. The `PipeSequence` controller is the most common one. It executes a series of pipes in a specific order.+++`marketing_pipeline.plx`+```plx+domain = "marketing"+description = "Marketing content generation domain"++# 1. Define the concepts used in our pipes+[concept]+ProductDescription = "A description of a product's features and benefits"+Tagline = "A catchy marketing tagline"++# 2. Define the first step of your pipe+[pipe.generate_tagline]+type = "PipeLLM"+description = "Generate a catchy tagline for a product"+inputs = { description = "ProductDescription" }+output = "Tagline"+prompt = """+Product Description:+@description++Generate a catchy tagline based on the above description.+The tagline should be memorable, concise, and highlight the key benefit.+"""++# 3. Define the second step of your pipe+[pipe.extract_keywords_from_tagline]+type = "PipeLLM"+description = "Extract keywords from a tagline"+inputs = { tagline = "Tagline" }+output = "Keyword[]"+prompt = """+Extract the most relevant keywords from the following tagline. Focus on features, benefits, and unique selling points:++@tagline++"""++# 4. Define the controller that orchestrates the two steps+[pipe.description_to_tagline]+type = "PipeSequence"+description = "From product description to tagline"+inputs = { description = "ProductDescription" }+output = "Tagline"+steps = [+ { pipe = "generate_tagline", result = "tagline" },+ { pipe = "extract_keywords_from_tagline", result = "keywords" },+]+```++!!! note "Multiple Outputs"+ The `[]` bracket notation in `output = "Keyword[]"` allows the LLM to generate as many keywords as it finds relevant. For a comprehensive guide on controlling how many items pipes produce or accept, see [Understanding Multiplicity](./understanding-multiplicity.md).+++This defines a two-step pipeline. The `PipeSequence` controller `description_to_tagline` takes a `ProductDescription` as input and outputs a `Tagline`. The first step is `generate_tagline` which generates a `Tagline` from the `ProductDescription`. The second step is `extract_keywords_from_tagline` which extracts keywords from the `Tagline`.++See here all the different operators, see [Pipe Operators](./pipe-operators/index.md).+See here all the different controllers, see [Pipe Controllers](./pipe-controllers/index.md).++See more about the possibilities in designing your pipelines in the [Pipelex Bundle Specification](../pipelex-bundle-specification.md).\ No newline at end of filediff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeBatch.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeBatch.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeBatch.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeBatch.mddiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeCondition.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeCondition.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeCondition.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeCondition.mddiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeParallel.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeParallel.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeParallel.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeParallel.mddiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeSequence.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeSequence.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeSequence.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeSequence.mddiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/index.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-controllers/index.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/index.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/pipe-controllers/index.mddiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeCompose.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeCompose.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeCompose.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeCompose.mddiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeExtract.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeExtract.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeExtract.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeExtract.mddiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeFunc.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeFunc.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeFunc.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeFunc.mddiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeImgGen.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeImgGen.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeImgGen.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeImgGen.mddiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeLLM.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeLLM.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeLLM.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeLLM.mddiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/index.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/index.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/index.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/pipe-operators/index.mddiff --git a/docs/home/6-build-reliable-ai-workflows/pipes/pipe-output.md b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-output.mdnew file mode 100644index 000000000..8fc5ad331--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/pipes/pipe-output.md@@ -0,0 +1,181 @@+# Pipe Output++When you execute a pipeline, each pipe produces a `Stuff` that is automatically stored in the [Working Memory](working-memory.md). The final output of the pipeline execution is accessible through a `PipeOutput` object.++## How Pipe Outputs Work++Every pipe in your pipeline creates a **stuff** as its output. This stuff is a structured data container that holds:++A `Stuff` is a structured data container that holds:++- The concept that defines the structure+- The actual instance of the concept (text, structured data, images, etc.)++Each pipe's output is automatically added to the working memory with a name (specified by the `result` field in the [Pipe Sequence](./pipe-controllers/PipeSequence.md)).++The **main_stuff** is the final output produced by the last pipe in your pipeline.++## Accessing Pipeline Output++When you execute a pipeline, you receive a `PipeOutput` object:++```python+pipe_output = await execute_pipeline(+ pipe_code="process_invoice",+ inputs={...}+)+```++The `PipeOutput` object provides methods to extract and work with the main output.++## Extracting the Main Output++How you extract the main output depends on how the concept structure was defined.++### Option 1: Python Class Structure++If the output concept was defined as a Python class (inheriting from `StructuredContent`, see more here [Python StructuredContent Classes](../concepts/python-classes.md)), you can import the class and use it for type-safe extraction:++```python+from my_project.finance.finance_struct import Invoice++pipe_output = await execute_pipeline(+ pipe_code="extract_invoice",+ inputs={...}+)++# Extract with type safety+invoice = pipe_output.main_stuff_as(content_type=Invoice)+# invoice is now typed as Invoice with full IDE support+```++### Option 2: Inline Structure++If the output concept was defined with [inline structures](../concepts/inline-structures.md) directly in the `.plx` file, the generated class is not importable. Use the `PipeOutput` accessor methods instead:++```python+pipe_output = await execute_pipeline(+ pipe_code="extract_invoice",+ inputs={...}+)++# Access as dictionary-like structure+main_stuff = pipe_output.main_stuff+content = main_stuff.content # Access the content object++# Or for text outputs+text_content = pipe_output.main_stuff_as_text+text = pipe_output.main_stuff_as_str # Direct string access+```++## PipeOutput Accessor Methods++The `PipeOutput` class provides specialized methods for accessing different types of content:++### Generic Accessors++**`main_stuff`** - Returns the raw `Stuff` object containing the output:++```python+stuff = pipe_output.main_stuff+```++**`main_stuff_as(content_type)`** - Extracts content as a specific type:++```python+invoice = pipe_output.main_stuff_as(content_type=Invoice)+```++### List Accessors++**`main_stuff_as_list(item_type)`** - Returns a `ListContent` wrapper with typed items:++```python+invoice_list = pipe_output.main_stuff_as_list(item_type=Invoice)+# Access: invoice_list.items+```++**`main_stuff_as_items(item_type)`** - Returns the items directly as a Python list:++```python+invoices = pipe_output.main_stuff_as_items(item_type=Invoice)+# Direct list of Invoice objects+```++### Native Content Type Accessors++For native Pipelex concepts, use these convenience properties:++**`main_stuff_as_text`** - Returns `TextContent` object:++```python+text_content = pipe_output.main_stuff_as_text+```++This works only if the main_stuff is (or refines) a `TextContent` concept.++**`main_stuff_as_str`** - Returns the text as a string:++```python+text = pipe_output.main_stuff_as_str+```++This works only if the main_stuff is (or refines) a `TextContent` concept.++**`main_stuff_as_image`** - Returns `ImageContent` object:++```python+image = pipe_output.main_stuff_as_image+```++This works only if the main_stuff is (or refines) a `ImageContent` concept.++**`main_stuff_as_text_and_image`** - Returns `TextAndImagesContent` object:++```python+content = pipe_output.main_stuff_as_text_and_image+```++This works only if the main_stuff is (or refines) a `TextContent` and a `ImageContent` concept.++**`main_stuff_as_number`** - Returns `NumberContent` object:++```python+number = pipe_output.main_stuff_as_number+```++This works only if the main_stuff is (or refines) a `NumberContent` concept.++**`main_stuff_as_html`** - Returns `HtmlContent` object:++```python+html = pipe_output.main_stuff_as_html+```++This works only if the main_stuff is (or refines) a `HtmlContent` concept.++**`main_stuff_as_mermaid`** - Returns `MermaidContent` object:++```python+mermaid = pipe_output.main_stuff_as_mermaid+```++This works only if the main_stuff is (or refines) a `MermaidContent` concept.++## Working Memory Access++The `PipeOutput` object also provides access to the complete working memory:++```python+working_memory = pipe_output.working_memory+```++This allows you to access intermediate results from multi-step pipelines. See [Working Memory](working-memory.md) for details.++## Related Documentation++- [Working Memory](working-memory.md) - Understanding data flow between pipes+- [Executing Pipelines](executing-pipelines.md) - How to run pipelines+- [Inline Structures](../concepts/inline-structures.md) - Defining structures in `.plx` files+- [Python StructuredContent Classes](../concepts/python-classes.md) - Defining structures in Python+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.mdnew file mode 100644index 000000000..e09a7fa1a--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/pipes/provide-inputs.md@@ -0,0 +1,649 @@+# Providing Inputs to Pipelines++When running Pipelex pipelines, you need to provide input data that matches what your pipeline expects. This guide explains how to prepare and format inputs, whether you're using the CLI, Python API, or Pipelex Client.++## Preparing Inputs with the CLI++The Pipelex CLI can generate a template JSON file with all the required inputs for your pipeline:++```bash+pipelex build inputs path/to/my_pipe.plx+```++This creates a `results/inputs.json` file with the structure needed for your pipeline. You can then fill in the values and use it with:++```bash+pipelex run path/to/my_pipe.plx --inputs results/inputs.json+```++See more about the options of the CLI [here](../../../home/9-tools/cli.md).++!!! tip "Starting Point for Input Structure"+ Use `pipelex build inputs` to quickly understand what inputs your pipeline expects and generate a template to fill in.++## Understanding PipelineInputs Format++The `inputs` parameter uses **PipelineInputs** format - a smart, flexible way to provide data to your pipelines. Instead of forcing you into a rigid structure, PipelineInputs intelligently interprets your data based on how you provide it.++!!! tip "Working with Lists"+ When providing multiple items as input (lists) or expecting multiple outputs, understanding multiplicity is essential. See [Understanding Multiplicity](understanding-multiplicity.md) for a comprehensive guide on how Pipelex handles single items versus collections.++### TL;DR: How Input Formatting Works++**Case 1: Direct Content** - Provide the value directly (simplest)++- 1.1: String → `"my text"`+- 1.2: List of strings → `["text1", "text2"]`+- 1.3: StructuredContent object → `MyClass(arg1="value")`+- 1.4: List of StuffContent objects → `[MyClass(...), MyClass(...)]`+- 1.5: ListContent of StuffContent objects → `ListContent(items=[MyClass(...), MyClass(...)])`++**Case 2: Explicit Format** - Use `{"concept": "...", "content": "..."}` for control++- 2.1: String with concept → `{"concept": "Text", "content": "my text"}`+- 2.2: List of strings with concept → `{"concept": "Text", "content": ["text1", "text2"]}`+- 2.3: StructuredContent object with concept → `{"concept": "Invoice", "content": InvoiceObject}`+- 2.4: List of StructuredContent objects with concept → `{"concept": "Invoice", "content": [...]}`+- 2.5: Dictionary (structured data) → `{"concept": "Invoice", "content": {"field": "value"}}`+- 2.6: List of dictionaries → `{"concept": "Invoice", "content": [{...}, {...}]}`++!!! tip "Pro Tip for Text Inputs"+ For text inputs specifically, skip the verbose format. Just provide the string directly: `"text": "Hello"` instead of `"text": {"concept": "Text", "content": "Hello"}`++---++## Case 1: Direct Content Format++When you provide content directly (without the `concept` key), Pipelex intelligently infers the type.++### 1.1: Simple String (Text)++The simplest case - just provide a string directly:++**JSON Format:**+```json+{+ "inputs": {+ "my_text": "my text"+ }+}+```++**Python Format:**+```python+inputs = {+ "my_text": "my text"+}+```++**Result:** Automatically becomes `TextContent` with concept `native.Text`++### 1.2: List of Strings (Text List)++Provide multiple text items as a list:++**JSON Format:**+```json+{+ "inputs": {+ "my_texts": ["my text1", "my text2", "my text3"]+ }+}+```++**Python Format:**+```python+inputs = {+ "my_texts": ["my text1", "my text2", "my text3"]+}+```++**Result:** Becomes a `ListContent` containing multiple `TextContent` items++**Note:** The concept must be compatible with `native.Text` or an error will be raised.++### 1.3: StructuredContent Object++Provide a structured object directly (for Python clients):++```python+from my_project.domain.domain_struct import MyConcept, MySubClass++inputs = {+ "invoice_data": MyConcept(+ arg1="arg1",+ arg2=1,+ arg3=MySubClass(arg4="arg4")+ )+}+```++**What is StructuredContent?**++- `StructuredContent` is the base class for user-defined data structures in Pipelex+- You create your own classes by inheriting from `StructuredContent`+- These classes are defined in your project's Python files+- Learn more: [Python StructuredContent Classes](../concepts/python-classes.md)++**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 no concept is found → **Error**++### 1.4: List of StuffContent Objects++Provide multiple content objects in a plain Python list:++```python+inputs = {+ "invoice_list": [+ MyConcept(arg1="arg1", arg2=1, arg3=MySubClass(arg4="arg4")),+ MyConcept(arg1="arg1_2", arg2=2, arg3=MySubClass(arg4="arg4_2"))+ ]+}+```++**What it accepts:**++- Lists of `StructuredContent` objects (user-defined classes)+- Lists of native content objects (`TextContent`, `ImageContent`, etc.)++**Requirements:**++- All items must be of the same type+- Concept resolution follows the same rules as 1.3+- Creates a new `ListContent` wrapper internally++### 1.5: ListContent of StuffContent Objects++Provide an existing `ListContent` wrapper object (Python clients):++```python+from pipelex.core.stuffs.list_content import ListContent++inputs = {+ "invoice_list": ListContent(items=[+ MyConcept(arg1="arg1", arg2=1, arg3=MySubClass(arg4="arg4")),+ MyConcept(arg1="arg1_2", arg2=2, arg3=MySubClass(arg4="arg4_2"))+ ])+}+```++**Key Difference from Case 1.4:**++- Case 1.4: Plain Python list `[item1, item2]` → **Creates** a new `ListContent` wrapper+- Case 1.5: Already wrapped `ListContent(items=[item1, item2])` → **Uses** the wrapper directly++**Why Case 1.5 is Separate from Case 1.3:**++- `StructuredContent` and `ListContent` are **sibling classes** (both inherit from `StuffContent`)+- Case 1.3 handles user-defined structured data classes+- Case 1.5 handles list container wrappers+- They're at the same inheritance level, not parent-child++**Requirements:**++- All items within the `ListContent` must be `StuffContent` objects+- All items must be of the same type+- The `ListContent` cannot be empty+- Concept is inferred from the first item's class name (not from "ListContent")++---++## Case 2: Explicit Format (Concept and Content)++Use the explicit format `{"concept": "...", "content": "..."}` when you need precise control over concept selection or when working with domain-specific concepts.++### 2.1: Explicit String Input++**JSON Format:**+```json+{+ "inputs": {+ "text": {+ "concept": "Text",+ "content": "my text"+ }+ }+}+```++**Python Format:**+```python+inputs = {+ "text": {+ "concept": "Text",+ "content": "my text"+ }+}+```++**Concept Options:**++- `"Text"` or `"native.Text"` for native text+- Any custom concept that is strictly compatible with `native.Text`++### 2.2: Explicit List of Strings++**JSON Format:**+```json+{+ "inputs": {+ "documents": {+ "concept": "Text",+ "content": ["text1", "text2", "text3"]+ }+ }+}+```++**Result:** `ListContent` with multiple `TextContent` items++### 2.3: Structured Object with Concept++**JSON Format:**+```json+{+ "inputs": {+ "invoice_data": {+ "concept": "Invoice",+ "content": {+ "invoice_number": "INV-001",+ "amount": 1250.00,+ "date": "2025-10-20"+ }+ }+ }+}+```++**Python Format:**+```python+inputs = {+ "invoice_data": {+ "concept": "Invoice",+ "content": {+ "invoice_number": "INV-001",+ "amount": 1250.00,+ "date": "2025-10-20"+ }+ }+}+```++**Concept Resolution with Search Domains:**++When you specify a concept name without a domain 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 doesn't exist → **Error**: "Concept not found"++**Using Domain Prefix:**++```json+{+ "concept": "accounting.Invoice"+}+```++This explicitly tells Pipelex to use the `Invoice` concept from the `accounting` domain.++### 2.4: List of Structured Objects++**JSON Format:**+```json+{+ "inputs": {+ "invoices": {+ "concept": "Invoice",+ "content": [+ {+ "invoice_number": "INV-001",+ "amount": 1250.00+ },+ {+ "invoice_number": "INV-002",+ "amount": 890.00+ }+ ]+ }+ }+}+```++**Result:** `ListContent` with multiple structured content items++### 2.5: Dictionary Content++Provide structured data as a dictionary:++**JSON Format:**+```json+{+ "inputs": {+ "person": {+ "concept": "PersonInfo",+ "content": {+ "arg1": "something",+ "arg2": 1,+ "arg3": {+ "arg4": "something else"+ }+ }+ }+ }+}+```++The system will:++1. Find the concept structure (with domain resolution as explained above)+2. Validate the dictionary against the concept's structure+3. Create the appropriate content object++### 2.6: List of Dictionaries++**JSON Format:**+```json+{+ "inputs": {+ "people": {+ "concept": "PersonInfo",+ "content": [+ {+ "arg1": "something",+ "arg2": 1,+ "arg3": {"arg4": "something else"}+ },+ {+ "arg1": "something else",+ "arg2": 2,+ "arg3": {"arg4": "something else else"}+ }+ ]+ }+ }+}+```++### Using DictStuff Instances (Python Clients Only)++For Python clients, you can also pass `DictStuff` instances instead of plain dicts:++```python+from pipelex.client import PipelexClient+from pipelex.core.stuffs.stuff import DictStuff++client = PipelexClient(api_token="YOUR_API_KEY")++# Using DictStuff instance with dict content+response = await client.execute_pipeline(+ pipe_code="process_invoice",+ inputs={+ "invoice": DictStuff(+ concept="accounting.Invoice",+ content={+ "invoice_number": "INV-001",+ "amount": 1250.00,+ "date": "2025-10-20"+ }+ )+ }+)++# Using DictStuff instance with list of dicts+response = await client.execute_pipeline(+ pipe_code="process_invoices",+ inputs={+ "invoices": DictStuff(+ concept="accounting.Invoice",+ content=[+ {"invoice_number": "INV-001", "amount": 1250.00},+ {"invoice_number": "INV-002", "amount": 890.00}+ ]+ )+ }+)+```++---++## Search Domains Explained++When you reference a concept by name (like `"Invoice"` or `"PersonInfo"`), Pipelex needs to find it in your loaded domains.++### Automatic Search++```json+{+ "concept": "Invoice"+}+```++**What happens:**++1. Pipelex searches all available domains for a concept named `"Invoice"`+2. If found in **exactly one domain** → ✅ Uses that concept+3. If found in **multiple domains** → ❌ Error: "Ambiguous concept"+4. If **not found** → ❌ Error: "Concept not found"++### Explicit Domain Specification++To avoid ambiguity, specify the domain explicitly:++```json+{+ "concept": "accounting.Invoice"+}+```++**Format:** `"domain_name.ConceptName"`++This tells Pipelex exactly which concept to use, bypassing the search.++### Best Practices++- Use simple names (`"Invoice"`) when you have unique concept names across domains+- Use domain-prefixed names (`"accounting.Invoice"`) when:+ - You have concepts with the same name in different domains+ - You want to be explicit about which concept to use+ - You're building APIs that need to be unambiguous++---++## Common Input Patterns++### Pattern 1: Simple Text Input++```python+inputs = {+ "story": "Once upon a time...",+}+```++### Pattern 2: Native Content Types (PDF, Image)++```python+from pipelex.core.stuffs.pdf_content import PDFContent+from pipelex.core.stuffs.image_content import ImageContent++inputs = {+ "document": PDFContent(url="invoice.pdf"),+ "photo": ImageContent(url="photo.jpg"),+}+```++### Pattern 3: Custom Concepts with Explicit Format++```python+inputs = {+ "gantt_chart_image": {+ "concept": "gantt.GanttChartImage",+ "content": ImageContent(url="gantt.png"),+ }+}+```++### Pattern 4: Structured Data++```python+inputs = {+ "character": {+ "concept": "story.Character",+ "content": {+ "name": "Alice",+ "age": 30,+ "description": "A brave explorer"+ }+ }+}+```++### Pattern 5: Multiple Inputs with Mixed Formats++```python+from pipelex.core.stuffs.text_content import load_text_from_path++inputs = {+ # Simple string+ "client_instructions": "Focus on payment terms",++ # String loaded from file+ "contract_text": load_text_from_path("contract.txt"),++ # Explicit concept format+ "question": {+ "concept": "legal.Question",+ "content": "What are the fees?",+ },+}+```++---++## Complete Examples++### Example 1: Using JSON Inputs (CLI)++```json+{+ "inputs": {+ "text": "Analyze this contract for risks.",+ "category": {+ "concept": "Category",+ "content": {+ "name": "legal",+ "priority": "high"+ }+ },+ "options": ["option1", "option2", "option3"],+ "invoice": {+ "concept": "accounting.Invoice",+ "content": {+ "invoice_number": "INV-001",+ "amount": 1250.00+ }+ }+ }+}+```++### Example 2: Using Python Inputs++```python+from pipelex.core.stuffs.image_content import ImageContent++inputs = {+ # Direct string (Case 1.1)+ "topic": "A robot learning to love",++ # Native content type (Case 1.3)+ "photo": ImageContent(url="photo.jpg"),++ # Explicit format with custom concept (Case 2.3)+ "draft_tweet": {+ "concept": "social.DraftTweet",+ "content": "Check out this amazing framework!",+ },++ # List of strings (Case 1.2)+ "keywords": ["AI", "automation", "future"],+}+```++---++## Troubleshooting++### Error: "Concept not found"++If you see an error about a concept not being found, use the explicit format:++```python+# ❌ Won't work if MyType is a custom concept+inputs = {"data": my_value}++# ✅ Use explicit format+inputs = {+ "data": {+ "concept": "domain.MyType",+ "content": my_value,+ }+}+```++### Error: "Type mismatch"++Make sure the content type matches what your concept expects:++```python+# ❌ Wrong: passing a string when concept expects structured data+inputs = {+ "character": {+ "concept": "story.Character",+ "content": "Alice", # Should be a Character instance or dict+ }+}++# ✅ Correct: pass the right type+inputs = {+ "character": {+ "concept": "story.Character",+ "content": {"name": "Alice", "age": 30, "description": "..."},+ }+}+```++### Error: "Ambiguous concept"++When a concept name exists in multiple domains, specify the domain:++```python+# ❌ Ambiguous if "Invoice" exists in multiple domains+inputs = {+ "invoice": {+ "concept": "Invoice",+ "content": {...}+ }+}++# ✅ Specify the domain+inputs = {+ "invoice": {+ "concept": "accounting.Invoice",+ "content": {...}+ }+}+```++---++## Related Documentation++- [Executing Pipelines](./executing-pipelines.md) - Learn how to run pipelines with these inputs+- [Define Your Concepts](../concepts/define_your_concepts.md) - Understand concepts and their role+- [Understanding Multiplicity](understanding-multiplicity.md) - Working with single items vs. lists+- [Inline Structures](../concepts/inline-structures.md) - Create structured data types with inline syntax+- [Python StructuredContent Classes](../concepts/python-classes.md) - Advanced structured data with Pythondiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/understanding-multiplicity.md b/docs/home/6-build-reliable-ai-workflows/pipes/understanding-multiplicity.mdsimilarity index 100%rename from docs/pages/build-reliable-ai-workflows-with-pipelex/understanding-multiplicity.mdrename to docs/home/6-build-reliable-ai-workflows/pipes/understanding-multiplicity.mddiff --git a/docs/home/6-build-reliable-ai-workflows/pipes/working-memory.md b/docs/home/6-build-reliable-ai-workflows/pipes/working-memory.mdnew file mode 100644index 000000000..62a437f8e--- /dev/null+++ b/docs/home/6-build-reliable-ai-workflows/pipes/working-memory.md@@ -0,0 +1,46 @@+# Working Memory++The **Working Memory** is the mechanism that enables data flow between pipes in your pipeline. It acts as a **temporary** storage space that exists for the duration of a single pipeline run.++## How Data Flows Between Pipes++When you compose pipes together with [PipeControllers](./pipe-controllers/index.md), you need a way to pass data from one pipe to another. This is where the Working Memory comes in.++Consider our marketing pipeline example from the [Designing Pipelines](index.md) guide:++```plx+[pipe.description_to_tagline]+type = "PipeSequence"+description = "From product description to tagline"+inputs = { description = "ProductDescription" }+output = "Tagline"+steps = [+ { pipe = "generate_tagline", result = "tagline" },+ { pipe = "extract_keywords_from_tagline", result = "keywords" },+]+```++How does data get from `generate_tagline` to `extract_keywords_from_tagline`? This is handled by the Working Memory:++1. When a pipe in a sequence executes, its output is given a name using the `result` key (e.g., `result = "tagline"`).+2. This named result is placed into the Working Memory as a `Stuff`.+3. Subsequent pipes can then reference this data by its name in their `inputs` field (e.g., `inputs = { tagline = "Tagline" }`).++This mechanism allows you to chain pipes together, creating a flow of information through your pipeline.++## Working Memory Lifecycle++* **Creation**: The Working Memory is created at the start of a pipeline run.+* **Population**: Initial inputs are placed in the Working Memory before the first pipe executes.+* **Updates**: As each pipe completes, its output (named via the `result` field) is added to the Working Memory.+* **Access**: Any pipe can access data from the Working Memory by declaring it in their `inputs` field.+* **Disposal**: The Working Memory is cleared when the pipeline run completes.++## Best Practices++* **Meaningful Names**: Use descriptive names for your `result` values to make your pipeline easier to understand.+* **Clear Contracts**: Each pipe's `inputs` field clearly declares what data it needs from the Working Memory.+* **Fail Fast**: If a required input is missing from the Working Memory, the pipeline will fail immediately with a clear error message before the pipe executes.++For more information on how to execute pipelines and provide initial inputs to the Working Memory, see [Executing Pipelines](executing-pipelines.md).+diff --git a/docs/pages/configuration/config-advanced/feature-config.md b/docs/home/7-configuration/config-advanced/feature-config.mdsimilarity index 100%rename from docs/pages/configuration/config-advanced/feature-config.mdrename to docs/home/7-configuration/config-advanced/feature-config.mddiff --git a/docs/pages/configuration/config-pipeline-validation/dry-run-config.md b/docs/home/7-configuration/config-pipeline-validation/dry-run-config.mdsimilarity index 100%rename from docs/pages/configuration/config-pipeline-validation/dry-run-config.mdrename to docs/home/7-configuration/config-pipeline-validation/dry-run-config.mddiff --git a/docs/pages/configuration/config-pipeline-validation/static-validation-config.md b/docs/home/7-configuration/config-pipeline-validation/static-validation-config.mdsimilarity index 100%rename from docs/pages/configuration/config-pipeline-validation/static-validation-config.mdrename to docs/home/7-configuration/config-pipeline-validation/static-validation-config.mddiff --git a/docs/pages/configuration/config-practical/logging-config.md b/docs/home/7-configuration/config-practical/logging-config.mdsimilarity index 100%rename from docs/pages/configuration/config-practical/logging-config.mdrename to docs/home/7-configuration/config-practical/logging-config.mddiff --git a/docs/pages/configuration/config-practical/pipe-run-config.md b/docs/home/7-configuration/config-practical/pipe-run-config.mdsimilarity index 100%rename from docs/pages/configuration/config-practical/pipe-run-config.mdrename to docs/home/7-configuration/config-practical/pipe-run-config.mddiff --git a/docs/pages/configuration/config-practical/reporting-config.md b/docs/home/7-configuration/config-practical/reporting-config.mdsimilarity index 100%rename from docs/pages/configuration/config-practical/reporting-config.mdrename to docs/home/7-configuration/config-practical/reporting-config.mddiff --git a/docs/pages/configuration/config-practical/telemetry-config.md b/docs/home/7-configuration/config-practical/telemetry-config.mdsimilarity index 99%rename from docs/pages/configuration/config-practical/telemetry-config.mdrename to docs/home/7-configuration/config-practical/telemetry-config.mdindex 867be35b0..e29fd7bee 100644--- a/docs/pages/configuration/config-practical/telemetry-config.md+++ b/docs/home/7-configuration/config-practical/telemetry-config.md@@ -4,7 +4,7 @@Telemetry configuration is stored in `.pipelex/telemetry.toml`, separate from the main `pipelex.toml` configuration. This file is created automatically the first time you run a Pipelex command (after `pipelex init config`) and are prompted to choose your telemetry preference.-For a user-friendly introduction to telemetry, see [Telemetry Setup](../../setup/telemetry.md).+For a user-friendly introduction to telemetry, see [Telemetry Setup](../../../home/5-setup/telemetry.md).## Configuration File Locationdiff --git a/docs/pages/configuration/config-practical/tracker-config.md b/docs/home/7-configuration/config-practical/tracker-config.mdsimilarity index 100%rename from docs/pages/configuration/config-practical/tracker-config.mdrename to docs/home/7-configuration/config-practical/tracker-config.mddiff --git a/docs/pages/configuration/config-technical/aws-config.md b/docs/home/7-configuration/config-technical/aws-config.mdsimilarity index 81%rename from docs/pages/configuration/config-technical/aws-config.mdrename to docs/home/7-configuration/config-technical/aws-config.mdindex b4c464049..ce960ae16 100644--- a/docs/pages/configuration/config-technical/aws-config.md+++ b/docs/home/7-configuration/config-technical/aws-config.md@@ -42,9 +42,9 @@ When using `api_key_method = "secret_provider"`, Pipelex will:!!! warning "Secret Provider Requirements"To use the secret provider method, you must:- 1. Configure a secret provider in your project using the `SecretsProviderAbstract`: See more in the [Secrets](../../advanced-customization/secrets-provider-injection.md) documentation.- 2. Store your AWS credentials in your secret provider- 3. Ensure your secret provider is properly authenticated+1. Configure a secret provider in your project using the `SecretsProviderAbstract`: See more in the [Secrets](../../../home/10-advanced-customizations/secrets-provider-injection.md) documentation.+2. Store your AWS credentials in your secret provider+3. Ensure your secret provider is properly authenticated## Dependency Injection@@ -54,7 +54,7 @@ Pipelex uses dependency injection to manage AWS clients and credentials. You can- Override default credential providers- Mock AWS services for testing-For detailed information about dependency injection, including examples and best practices, see the [Dependency Injection](../../advanced-customization/index.md) documentation.+For detailed information about dependency injection, including examples and best practices, see the [Dependency Injection](../../../home/10-advanced-customizations/index.md) documentation.## Best Practicesdiff --git a/docs/pages/configuration/config-technical/cogt-config.md b/docs/home/7-configuration/config-technical/cogt-config.mdsimilarity index 100%rename from docs/pages/configuration/config-technical/cogt-config.mdrename to docs/home/7-configuration/config-technical/cogt-config.mddiff --git a/docs/pages/configuration/config-technical/inference-backend-config.md b/docs/home/7-configuration/config-technical/inference-backend-config.mdsimilarity index 100%rename from docs/pages/configuration/config-technical/inference-backend-config.mdrename to docs/home/7-configuration/config-technical/inference-backend-config.mddiff --git a/docs/pages/configuration/config-technical/library-config.md b/docs/home/7-configuration/config-technical/library-config.mdsimilarity index 100%rename from docs/pages/configuration/config-technical/library-config.mdrename to docs/home/7-configuration/config-technical/library-config.mddiff --git a/docs/pages/configuration/index.md b/docs/home/7-configuration/index.mdsimilarity index 100%rename from docs/pages/configuration/index.mdrename to docs/home/7-configuration/index.mddiff --git a/docs/pages/observer/data-extraction.md b/docs/home/8-analytics/data-extraction.mdsimilarity index 93%rename from docs/pages/observer/data-extraction.mdrename to docs/home/8-analytics/data-extraction.mdindex ccb8f3888..8d65a9187 100644--- a/docs/pages/observer/data-extraction.md+++ b/docs/home/8-analytics/data-extraction.md@@ -45,4 +45,4 @@ You can implement custom data extraction to:## Current Status: Work in Progress-See [Observer Provider Injection](../advanced-customization/observer-provider-injection.md) for implementation details.\ No newline at end of file+See [Observer Provider Injection](../../home/10-advanced-customizations/observer-provider-injection.md) for implementation details.\ No newline at end of filediff --git a/docs/pages/tools/cli.md b/docs/home/9-tools/cli.mdsimilarity index 91%rename from docs/pages/tools/cli.mdrename to docs/home/9-tools/cli.mdindex d97ec6499..2cd1177da 100644--- a/docs/pages/tools/cli.md+++ b/docs/home/9-tools/cli.md@@ -49,8 +49,8 @@ This command creates the `.pipelex/` directory with:**Related Configuration:**-- [Configure AI Providers](../setup/configure-ai-providers.md)-- [Inference Backend Configuration](../configuration/config-technical/inference-backend-config.md)+- [Configure AI Providers](../../home/5-setup/configure-ai-providers.md)+- [Inference Backend Configuration](../../home/7-configuration/config-technical/inference-backend-config.md)## Validate Commands@@ -171,8 +171,8 @@ All validation commands check:**Related Configuration:**-- [Static Validation Configuration](../configuration/config-pipeline-validation/static-validation-config.md)-- [Dry Run Configuration](../configuration/config-pipeline-validation/dry-run-config.md)+- [Static Validation Configuration](../../home/7-configuration/config-pipeline-validation/static-validation-config.md)+- [Dry Run Configuration](../../home/7-configuration/config-pipeline-validation/dry-run-config.md)## Show Commands@@ -267,7 +267,7 @@ pipelex show models anthropic --flat**Related Configuration:**-- [Inference Backend Configuration](../configuration/config-technical/inference-backend-config.md)+- [Inference Backend Configuration](../../home/7-configuration/config-technical/inference-backend-config.md)### Show Backends@@ -300,7 +300,7 @@ pipelex show backends --all**Related Configuration:**-- [Inference Backend Configuration](../configuration/config-technical/inference-backend-config.md)+- [Inference Backend Configuration](../../home/7-configuration/config-technical/inference-backend-config.md)- Backend configuration files: `.pipelex/inference/backends.toml`- Routing configuration: `.pipelex/inference/routing_profiles.toml`@@ -371,8 +371,9 @@ The output JSON contains the complete working memory after pipeline execution, i**Related Documentation:**-- [Executing Pipelines with Inputs](../build-reliable-ai-workflows-with-pipelex/executing-pipelines-with-inputs.md)-- [Design and Run Pipelines](../build-reliable-ai-workflows-with-pipelex/design_and_run_pipelines.md)+- [Executing Pipelines](../../home/6-build-reliable-ai-workflows/pipes/executing-pipelines.md)+- [Providing Inputs to Pipelines](../../home/6-build-reliable-ai-workflows/pipes/provide-inputs.md)+- [Design and Run Pipelines](../../home/6-build-reliable-ai-workflows/pipes/index.md)## Build Commands@@ -459,5 +460,5 @@ For complete documentation including all options and examples, see [Kit Commands- [Pipe Builder](pipe-builder.md) - Generate pipelines from natural language- [Kit Commands](kit.md) - Agent rules and migration management-- [Configure AI Providers](../setup/configure-ai-providers.md) - Set up LLM backends-- [Design and Run Pipelines](../build-reliable-ai-workflows-with-pipelex/design_and_run_pipelines.md) - Pipeline development guide+- [Configure AI Providers](../../home/5-setup/configure-ai-providers.md) - Set up LLM backends+- [Design and Run Pipelines](../../home/6-build-reliable-ai-workflows/pipes/index.md) - Pipeline development guidediff --git a/docs/pages/tools/kit.md b/docs/home/9-tools/kit.mdsimilarity index 100%rename from docs/pages/tools/kit.mdrename to docs/home/9-tools/kit.mddiff --git a/docs/pages/tools/logging.md b/docs/home/9-tools/logging.mdsimilarity index 100%rename from docs/pages/tools/logging.mdrename to docs/home/9-tools/logging.mddiff --git a/docs/pages/tools/pipe-builder.md b/docs/home/9-tools/pipe-builder.mdsimilarity index 95%rename from docs/pages/tools/pipe-builder.mdrename to docs/home/9-tools/pipe-builder.mdindex bb94a10e1..44ba22c71 100644--- a/docs/pages/tools/pipe-builder.md+++ b/docs/home/9-tools/pipe-builder.md@@ -191,7 +191,7 @@ After generating a pipeline:For more information on pipeline structure and customization, see:-- [Design and Run Pipelines](../build-reliable-ai-workflows-with-pipelex/design_and_run_pipelines.md)-- [Pipe Operators](../build-reliable-ai-workflows-with-pipelex/pipe-operators/index.md)-- [Pipe Controllers](../build-reliable-ai-workflows-with-pipelex/pipe-controllers/index.md)+- [Design and Run Pipelines](../../home/6-build-reliable-ai-workflows/pipes/index.md)+- [Pipe Operators](../../home/6-build-reliable-ai-workflows/pipes/pipe-operators/index.md)+- [Pipe Controllers](../../home/6-build-reliable-ai-workflows/pipes/pipe-controllers/index.md)diff --git a/docs/index.md b/docs/index.mdindex f2635ddc4..a83d9b5bf 100644--- a/docs/index.md+++ b/docs/index.md@@ -1,129 +1,64 @@----title: "Open-source AI workflows"+title: "What is Pipelex?"----# Build reliable AI workflows in minutes+# What is Pipelex?-## Install--```bash-pip install pipelex-pipelex init-```--To use AI models, you need API key(s):-- The `PIPELEX_INFERENCE_API_KEY` key provides access to all the AI models. To get your key, join our Discord community: [https://go.pipelex.com/discord](https://go.pipelex.com/discord), then request your **free API key** (no credit card required, limited time offer) in the [🔑・free-api-key](https://discord.com/channels/1369447918955921449/1418228010431025233) channel.-- You can also use other AI routing services like [BlackBox AI](https://docs.blackbox.ai/), or you can bring your own API keys (OpenAI, Anthropic, Google, Mistral, etc.), or run local AI (no key needed).-See [Configure AI Providers](pages/setup/configure-ai-providers.md) for details. If you are using non-standard APIs, that's OK too, don't hesitate to join our [Discord](https://go.pipelex.com/discord) for guidance.--## Generate your first Pipelex workflow--```bash-pipelex build pipe "Imagine a cute animal mascot for a startup based on its elevator pitch"-pipelex build pipe "Take a theme, write a joke about it, then roast the joke" --output results/self_roaster.plx-```--**Other useful use-cases for business:**--```bash-pipelex build pipe "Given an expense report, apply company rules" --output results/expense.plx-pipelex build pipe "Take a CV and Job offer in PDF, analyze if they match and generate 5 questions for the interview" --output results/cv_match.plx-```--Each of these commands generates a complete production-ready script in our Pipelex language, saved as `.plx` file including domain definition, concepts, and the multiple _pipe_ steps to take to achieve the goal.--!!! tip "Pipe Builder Requirements"- For now, the pipe builder requires access to **Claude 4.5 Sonnet**, either through Pipelex Inference, or using your own key through Anthropic, Amazon Bedrock or BlackboxAI. Don't hesitate to join our [Discord](https://go.pipelex.com/discord) to get a key, otherwise, you can also create the workflows yourself, following our [documentation guide](pages/writing-workflows/index.md).---## Run your pipeline--**CLI:**--```bash-# Run a pipe by code-pipelex run results/cv_match.plx --inputs inputs.json-pipelex run results/self_roaster.plx --inputs '{"theme": "the prisoner dilemma"}'-```--The `--inputs` file should be a JSON dictionary where keys are input variable names and values are the input data. For native concepts like Text, you can use strings directly. For structured types, provide objects matching the expected structure.--Learn more: [Executing Pipelines with Inputs](pages/build-reliable-ai-workflows-with-pipelex/executing-pipelines-with-inputs.md)--**Python:**--```python-import asyncio-from pipelex.pipeline.execute import execute_pipeline-from pipelex.pipelex import Pipelex-import json--async def run_pipeline():- with open("inputs.json", "r", encoding="utf-8") as json_file:- inputs = json.load(json_file)- pipe_output = await execute_pipeline(pipe_code="analyze_cv_and_prepare_interview", inputs=inputs)- print(pipe_output.main_stuff)--Pipelex.make()-asyncio.run(run_pipeline())-```--## Easily iterate on your pipe--Now, thanks to our Pipelex language, you can easily edit the pipeline, even if you're not a coder. Better yet, you can get assisted in making changes with the help of your favorite AI coding assistant. To that end, we have prepared comprehensive rules meant for the most popular AI coding assistants. You can install those rules with one call:+Pipelex is an open-source language that enables agents to build and run **repeatable AI workflows**. Instead of cramming everything into one complex prompt, you break tasks into focused steps, each pipe handling one clear transformation.-```bash-pipelex kit rules-```+Each pipe processes information using **Concepts** (typing with meaning) to ensure your pipelines make sense. The Pipelex language (`.plx` files) is simple and human-readable, even for non-technical users.-This installs Pipelex rules for Cursor, Claude Code, OpenAI Codex, GitHub Copilot, Windsurf, and Blackbox AI.+Each step can be structured and validated, so you benefit from the reliability of software, and the intelligence of AI.-Now refine your pipeline with natural language directly in your AI assistant's chatbot:+----- "Include confidence scores between 0 and 100 in the match analysis"-- "Write a recap email at the end"+## Key Features-## IDE Support+### 🔄 Repeatable AI Workflows+Build workflows that produce consistent, reliable results every time they run.-By the way, we **highly** recommend installing our own extension for PLX files into your IDE of choice. You can find it in the [Open VSX Registry](https://open-vsx.org/extension/Pipelex/pipelex) and download it directly using [this link](https://open-vsx.org/api/Pipelex/pipelex/0.2.1/file/Pipelex.pipelex-0.2.1.vsix). It's coming soon to the VS Code marketplace too and if you are using Cursor, Windsurf or another VS Code fork, you can search for it directly in your extensions tab.+### 🧩 Concept-Driven Design+Use semantic typing (Concepts) to ensure each step of your pipeline makes sense and connects logically.-## Examples+### 📝 Human-Readable Language+Write workflows in `.plx` files that are easy to read, edit, and maintain—even for non-developers.-Visit the-[](https://github.com/Pipelex/pipelex-cookbook/): you can clone it, fork it, play with it+### 🤖 AI-Assisted Development+Generate and iterate on workflows using natural language with your favorite AI coding assistant.+### 🔧 Production-Ready+Validate, test, and deploy AI workflows with the same confidence as traditional software.----## What is Pipelex?+## Why Pipelex?-Pipelex is an open-source language that enables agents to build and run **repeatable AI workflows**. Instead of cramming everything into one complex prompt, you break tasks into focused steps, each pipe handling one clear transformation.+Traditional AI applications often struggle with:-Each pipe processes information using **Concepts** (typing with meaning) to ensure your pipelines make sense. The Pipelex language (`.plx` files) is simple and human-readable, even for non-technical users.+- **Complexity**: One massive prompt trying to do everything+- **Unpredictability**: Different results each time+- **Maintenance**: Hard to debug and improve+- **Collaboration**: Difficult for teams to work together-Each step can be structured and validated, so you benefit from the reliability of software, and the intelligence of AI.+Pipelex solves these problems by:++- **Breaking down complexity** into focused, manageable steps+- **Ensuring consistency** through structured validation+- **Enabling iteration** with clear, editable workflows+- **Facilitating collaboration** with human-readable syntax---## Next Steps-**Learn More:**+Ready to get started?-- [Writing Workflows Tutorial](pages/writing-workflows/index.md) - Complete guide with examples-- [Cookbook Examples](pages/cookbook-examples/index.md) - Real-world patterns-- [Build Reliable AI Workflows](pages/build-reliable-ai-workflows-with-pipelex/kick-off-a-pipelex-workflow-project.md) - Deep dive+- [:material-rocket-launch: Get Started](./home/2-get-started/pipe-builder.md){ .md-button .md-button--primary }+- [:material-book-open: Read the Manifesto](./home/3-understand-pipelex/manifesto.md){ .md-button }+- [:material-lightbulb: Explore the Paradigm](./home/3-understand-pipelex/pipelex-paradigm/index.md){ .md-button }-**Understand the Philosophy:**--- [:material-book-open: Read the Manifesto](manifesto.md){ .md-button .equal-width }-- [:material-lightbulb: Explore the Paradigm](pages/pipelex-paradigm-for-repeatable-ai-workflows/index.md){ .md-button .equal-width }--**Configure:**--- [Configure AI Providers](pages/setup/configure-ai-providers.md) - API keys, local AI, model providers-- [Project Organization](pages/setup/project-organization.md) - Structure your Pipelex projects+**Explore Examples:**[](https://github.com/Pipelex/pipelex-cookbook/)-diff --git a/docs/pages/api/index.md b/docs/pages/api/index.mddeleted file mode 100644index a9497acb4..000000000--- a/docs/pages/api/index.md+++ /dev/null@@ -1,934 +0,0 @@-# Pipelex API Guide--This guide covers everything you need to know about using the Pipelex API to execute pipelines with flexible input formats.--## Table of Contents--1. [Quick Reference](#quick-reference)-2. [Execute Pipeline](#execute-pipeline)-3. [Input Format: PipelineInputs](#input-format-pipelineinputs)- - [Case 1: Direct Content Format](#case-1-direct-content-format)- - [Case 2: Explicit Format (Concept and Content)](#case-2-explicit-format-concept-and-content)-4. [Search Domains Explained](#search-domains-explained)-5. [PLX Content: Execute Pipelines Inline](#plx-content-execute-pipelines-inline)-6. [Error Handling](#error-handling)-7. [Best Practices](#best-practices)-8. [Client Libraries](#client-libraries)-------## Base URL--```-https://api.pipelex.ai/api/v1-```--## Authentication--Include your API key in the Authorization header:--```-Authorization: Bearer YOUR_API_KEY-```-------## Quick Reference--### Input Formats at a Glance--```json-// 1. Simple text (Case 1.1)-{ "text": "Hello, world!" }--// 2. List of text (Case 1.2)-{ "documents": ["text1", "text2", "text3"] }--// 3. Explicit format (Case 2.1)-{ "text": { "concept": "Text", "content": "Hello!" } }--// 4. Structured data (Case 2.5)-{ "invoice": { "concept": "Invoice", "content": { "number": "001", "amount": 100 } } }--// 5. Domain-prefixed concept (Case 2.5)-{ "data": { "concept": "accounting.Invoice", "content": { ... } } }--// 6. DictStuff instance (Python clients only)-DictStuff(concept="Invoice", content={...})-```--### Key Points--✅ **DO:** Use direct strings for text: `{"text": "Hello"}`-❌ **DON'T:** Over-complicate text: `{"text": {"concept": "Text", "content": "Hello"}}`--✅ **DO:** Specify domain when ambiguous: `"accounting.Invoice"`-❌ **DON'T:** Use generic names when you have duplicates: `"Invoice"`--✅ **DO:** Use `plx_content` for dynamic pipelines-❌ **DON'T:** Use both `pipe_code` and `plx_content` together-------## Execute Pipeline--Execute a Pipelex pipeline with flexible inputs.--**Endpoint:** `POST /pipeline/{pipe_code}/execute`--**Path Parameters:**--- `pipe_code` (string, required): The code identifying the pipeline to execute--**Request Body:**--```json-{- "inputs": {- "input_name": "simple text or object"- },- "output_name": null,- "output_multiplicity": null,- "dynamic_output_concept_code": null,- "plx_content": null-}-```--**Request Fields:**--- `inputs` (PipelineInputs): Flexible input format - see [Input Format: PipelineInputs](#input-format-pipelineinputs) below-- `output_name` (string, optional): Name for the output slot-- `output_multiplicity` (string, optional): Output multiplicity setting-- `dynamic_output_concept_code` (string, optional): Override output concept-- `plx_content` (string, optional): Inline pipeline definition - see [PLX Content](#plx-content-execute-pipelines-inline)--**Response:**--```json-{- "status": "success",- "message": null,- "error": null,- "pipeline_run_id": "abc123...",- "created_at": "2025-10-20T12:00:00Z",- "pipeline_state": "COMPLETED",- "finished_at": "2025-10-20T12:00:05Z",- "pipe_output": {- "working_memory": {- "root": { ... },- "aliases": { ... }- },- "pipeline_run_id": "abc123..."- },- "main_stuff_name": "result"-}-```-------## Input Format: PipelineInputs--Run your pipeline with flexible inputs that adapt to your needs. Pipelex supports multiple formats for providing inputs, making it easy to work with simple text, structured data, or complex objects.--### What is PipelineInputs?--The `inputs` field uses **PipelineInputs** format - a smart, flexible way to provide data to your pipelines. Instead of forcing you into a rigid structure, PipelineInputs intelligently interprets your data based on how you provide it.--### How Input Formatting Works--**Case 1: Direct Content** - Provide the value directly (simplest)--- 1.1: String → `"my text"`-- 1.2: List of strings → `["text1", "text2"]`-- 1.3: StructuredContent object → `MyClass(arg1="value")`-- 1.4: List of StuffContent objects → `[MyClass(...), MyClass(...)]`-- 1.5: ListContent of StuffContent objects → `ListContent(items=[MyClass(...), MyClass(...)])`--**Note:** Cases 1.3 and 1.5 are at the same level - both handle content types that inherit from `StuffContent`, but for different purposes (custom classes vs. list wrappers).--**Case 2: Explicit Format** - Use `{"concept": "...", "content": "..."}` for control (plain dict or DictStuff instance)--- 2.1: String with concept → `{"concept": "Text", "content": "my text"}`-- 2.2: List of strings with concept → `{"concept": "Text", "content": ["text1", "text2"]}`-- 2.3: StructuredContent object with concept → `{"concept": "Invoice", "content": InvoiceObject}`-- 2.4: List of StructuredContent objects with concept → `{"concept": "Invoice", "content": [...]}`-- 2.5: Dictionary (structured data) → `{"concept": "Invoice", "content": {"field": "value"}}`-- 2.6: List of dictionaries → `{"concept": "Invoice", "content": [{...}, {...}]}`--**Pro Tip:** For **text inputs specifically**, skip the verbose format. Just provide the string directly: `"text": "Hello"` instead of `"text": {"concept": "Text", "content": "Hello"}`-------## Case 1: Direct Content Format--When you provide content directly (without the `concept` key), Pipelex intelligently infers the type.--### 1.1: Simple String (Text)--The simplest case - just provide a string directly:--```json-{- "inputs": {- "my_text": "my text"- }-}-```--**Result:** Automatically becomes `TextContent` with concept `native.Text`--### 1.2: List of Strings (Text List)--Provide multiple text items as a list:--```json-{- "inputs": {- "my_texts": ["my text1", "my text2", "my text3"]- }-}-```--**Result:** Becomes a `ListContent` containing multiple `TextContent` items--**Note:** The concept must be compatible with `native.Text` or an error will be raised.--### 1.3: StructuredContent Object--Provide a structured object directly (for Python clients):--```python-# Python client example-from my_project.domain.domain_struct import MyConcept, MySubClass--inputs = {- "invoice_data": MyConcept(arg1="arg1", arg2=1, arg3=MySubClass(arg4="arg4"))-}-```--**What is StructuredContent?**--- `StructuredContent` is the base class for user-defined data structures in Pipelex-- You create your own classes by inheriting from `StructuredContent`-- These classes are defined in your project's Python files-- Learn more: [Python StructuredContent Classes](../build-reliable-ai-workflows-with-pipelex/define_your_concepts.md#3-python-structuredcontent-classes)--**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 no concept is found → **Error**--### 1.4: List of StuffContent Objects--Provide multiple content objects in a plain Python list:--```python-# Python client example-inputs = {- "invoice_list": [- MyConcept(arg1="arg1", arg2=1, arg3=MySubClass(arg4="arg4")),- MyConcept(arg1="arg1_2", arg2=2, arg3=MySubClass(arg4="arg4_2"))- ]-}-```--**What it accepts:**--- Lists of `StructuredContent` objects (user-defined classes)-- Lists of native content objects (`TextContent`, `ImageContent`, etc.)--**Requirements:**--- All items must be of the same type-- Concept resolution follows the same rules as 1.3-- Creates a new `ListContent` wrapper internally--### 1.5: ListContent of StuffContent Objects--Provide an existing `ListContent` wrapper object (Python clients):--```python-# Python client example-from pipelex.core.stuffs.list_content import ListContent--inputs = {- "invoice_list": ListContent(items=[- MyConcept(arg1="arg1", arg2=1, arg3=MySubClass(arg4="arg4")),- MyConcept(arg1="arg1_2", arg2=2, arg3=MySubClass(arg4="arg4_2"))- ])-}-```--**Key Difference from Case 1.4:**--- Case 1.4: Plain Python list `[item1, item2]` → **Creates** a new `ListContent` wrapper-- Case 1.5: Already wrapped `ListContent(items=[item1, item2])` → **Uses** the wrapper directly--**Why Case 1.5 is Separate from Case 1.3:**--- `StructuredContent` and `ListContent` are **sibling classes** (both inherit from `StuffContent`)-- Case 1.3 handles user-defined structured data classes-- Case 1.5 handles list container wrappers-- They're at the same inheritance level, not parent-child--**Requirements:**--- All items within the `ListContent` must be `StuffContent` objects (this includes both `StructuredContent` and native content like `TextContent`, `ImageContent`)-- All items must be of the same type-- The `ListContent` cannot be empty-- Concept is inferred from the first item's class name (not from "ListContent")--**Use Case:** This format is useful when you already have data wrapped in a `ListContent` object from a previous pipeline execution or when working with Pipelex's internal data structures.-------## Case 2: Explicit Format (Concept and Content)--Use the explicit format `{"concept": "...", "content": "..."}` when you need precise control over concept selection or when working with domain-specific concepts.--### 2.1: Explicit String Input--```json-{- "inputs": {- "text": {- "concept": "Text",- "content": "my text"- }- }-}-```--**Concept Options:**--- `"Text"` or `"native.Text"` for native text-- Any custom concept that is strictly compatible with `native.Text`--### 2.2: Explicit List of Strings--```json-{- "inputs": {- "documents": {- "concept": "Text",- "content": ["text1", "text2", "text3"]- }- }-}-```--**Result:** `ListContent` with multiple `TextContent` items--### 2.3: Structured Object with Concept--```json-{- "inputs": {- "invoice_data": {- "concept": "Invoice",- "content": {- "invoice_number": "INV-001",- "amount": 1250.00,- "date": "2025-10-20"- }- }- }-}-```--**Concept Resolution with Search Domains:**--When you specify a concept name without a domain 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 doesn't exist → **Error**: "Concept not found"--**Using Domain Prefix:**-```json-{- "concept": "accounting.Invoice"-}-```--This explicitly tells Pipelex to use the `Invoice` concept from the `accounting` domain.--### 2.4: List of Structured Objects--```json-{- "inputs": {- "invoices": {- "concept": "Invoice",- "content": [- {- "invoice_number": "INV-001",- "amount": 1250.00- },- {- "invoice_number": "INV-002",- "amount": 890.00- }- ]- }- }-}-```--**Result:** `ListContent` with multiple structured content items--### 2.5: Dictionary Content--Provide structured data as a dictionary:--```json-{- "inputs": {- "person": {- "concept": "PersonInfo",- "content": {- "arg1": "something",- "arg2": 1,- "arg3": {- "arg4": "something else"- }- }- }- }-}-```--The system will:-1. Find the concept structure (with domain resolution as explained above)-2. Validate the dictionary against the concept's structure-3. Create the appropriate content object--### 2.6: List of Dictionaries--```json-{- "inputs": {- "people": {- "concept": "PersonInfo",- "content": [- {- "arg1": "something",- "arg2": 1,- "arg3": {"arg4": "something else"}- },- {- "arg1": "something else",- "arg2": 2,- "arg3": {"arg4": "something else else"}- }- ]- }- }-}-```--### Using DictStuff Instances (Python Clients Only)--For Python clients, you can also pass `DictStuff` instances instead of plain dicts. `DictStuff` is a Pydantic model with the same structure as the explicit format.--```python-from pipelex.client import PipelexClient-from pipelex.core.stuffs.stuff import DictStuff--client = PipelexClient(api_token="YOUR_API_KEY")--# Using DictStuff instance with dict content-response = await client.execute_pipeline(- pipe_code="process_invoice",- inputs={- "invoice": DictStuff(- concept="accounting.Invoice",- content={- "invoice_number": "INV-001",- "amount": 1250.00,- "date": "2025-10-20"- }- )- }-)--# Using DictStuff instance with list of dicts content-response = await client.execute_pipeline(- pipe_code="process_invoices",- inputs={- "invoices": DictStuff(- concept="accounting.Invoice",- content=[- {"invoice_number": "INV-001", "amount": 1250.00},- {"invoice_number": "INV-002", "amount": 890.00}- ]- )- }-)--# Using DictStuff instance with list of strings (for Text concept)-response = await client.execute_pipeline(- pipe_code="analyze_texts",- inputs={- "documents": DictStuff(- concept="Text",- content=["document 1", "document 2", "document 3"]- )- }-)-```--**DictStuff Structure:**--- `concept` (str): The concept code (with optional domain prefix)-- `content` (dict[str, Any] | list[Any]): The actual data content--**Content Types:**--- **Dictionary**: Single structured object → Creates a single Stuff-- **List of dicts**: Multiple structured objects → Creates ListContent with validated items-- **List of strings** (for Text-compatible concepts): Creates ListContent of TextContent--**Note:** `DictStuff` instances are automatically converted to plain dicts and processed through the standard Case 2 logic.-------## Search Domains Explained--When you reference a concept by name (like `"Invoice"` or `"PersonInfo"`), Pipelex needs to find it in your loaded domains.--### Automatic Search--```json-{- "concept": "Invoice"-}-```--**What happens:**-1. Pipelex searches all available domains for a concept named `"Invoice"`-2. If found in **exactly one domain** → ✅ Uses that concept-3. If found in **multiple domains** → ❌ Error: "Ambiguous concept: Found 'Invoice' in domains: accounting, billing. Use 'domain.Invoice' format."-4. If **not found** → ❌ Error: "Concept 'Invoice' not found in any domain"--### Explicit Domain Specification--To avoid ambiguity, specify the domain explicitly:--```json-{- "concept": "accounting.Invoice"-}-```--**Format:** `"domain_name.ConceptName"`--This tells Pipelex exactly which concept to use, bypassing the search.--### Best Practices--- Use simple names (`"Invoice"`) when you have unique concept names across domains-- Use domain-prefixed names (`"accounting.Invoice"`) when:- - You have concepts with the same name in different domains- - You want to be explicit about which concept to use- - You're building APIs that need to be unambiguous-------## Multiple Input Combinations--Combine different input types in a single request:--```json-{- "inputs": {- "text": "Analyze this contract for risks.",- "category": {- "concept": "Category",- "content": {"name": "legal", "priority": "high"}- },- "options": ["option1", "option2", "option3"],- "invoice": {- "concept": "accounting.Invoice",- "content": {- "invoice_number": "INV-001",- "amount": 1250.00- }- }- }-}-```--In this example:--- `text` uses direct string format (Case 1.1)-- `category` uses explicit format with structured content (Case 2.5)-- `options` uses direct list format (Case 1.2)-- `invoice` uses explicit format with domain prefix and structured content (Case 2.5)-------## PLX Content: Execute Pipelines Inline--The `plx_content` field allows you to execute pipelines by providing their `.plx` definition directly in the request, without needing to reference a pre-existing `pipe_code`.--### When to Use PLX Content--Use `plx_content` when you want to:--- Execute a dynamically generated pipeline-- Test a pipeline without deploying it-- Run one-off pipelines that don't need to be stored-- Prototype new pipelines quickly--### Basic Usage--Instead of referencing a `pipe_code`, provide the complete pipeline definition:--```bash-curl -X POST https://api.pipelex.ai/api/v1/pipeline/execute \- -H "Authorization: Bearer YOUR_API_KEY" \- -H "Content-Type: application/json" \- -d '{- "plx_content": "domain = \"my_domain\"\n\n[concept]\nGreeting = \"A greeting message\"\n\n[pipe.hello]\ntype = \"PipeLLM\"\ndescription = \"Generate a greeting\"\noutput = \"Greeting\"\nprompt = \"Generate a friendly greeting\"",- "inputs": {- "name": "Alice"- }- }'-```--### PLX Content Structure--The `plx_content` should contain a valid `.plx` file as a string:--```json-{- "plx_content": "domain = \"example\"\n\n[concept]\nResult = \"A result\"\n\n[pipe.my_pipe]\ntype = \"PipeLLM\"\ndescription = \"Process input\"\ninputs = { text = \"Text\" }\noutput = \"Result\"\nprompt = \"Process this: @text\""-}-```--**Key Points:**--- The `plx_content` must be a valid Pipelex pipeline definition-- Include newlines (`\n`) to properly format the pipeline-- The pipeline will be validated before execution-- All concepts and pipes must be properly defined within the content--### Example: Dynamic Pipeline--```python-from pipelex.client import PipelexClient--client = PipelexClient(api_token="YOUR_API_KEY")--# Define a pipeline inline-plx_pipeline = """-domain = "sentiment_analysis"--[concept]-SentimentScore = "A sentiment score"--[concept.SentimentScore.structure]-score = { type = "number", description = "Sentiment score from -1 to 1", required = true }-label = { type = "text", description = "Sentiment label", required = true }--[pipe.analyze]-type = "PipeLLM"-description = "Analyze sentiment of text"-inputs = { text = "Text" }-output = "SentimentScore"-model = { model = "gpt-4o-mini", temperature = 0.3 }-prompt = \"\"\"-Analyze the sentiment of this text and provide a score from -1 (negative) to 1 (positive):--@text-\"\"\"-"""--# Execute the pipeline-response = await client.execute_pipeline(- pipe_code="analyze",- plx_content=plx_pipeline,- inputs={- "text": "This product exceeded all my expectations!"- }-)--print(response.pipe_output)-```--### Combining PLX Content with Inputs--You can use all the PipelineInputs input formats described above with `plx_content`:--```json-{- "plx_content": "domain = \"processing\"...",- "inputs": {- "text": "Simple direct input",- "data": {- "concept": "DataRecord",- "content": {- "id": 123,- "values": [1, 2, 3]- }- }- }-}-```--### Validation--When you provide `plx_content`:-1. The pipeline definition is parsed and validated-2. All concepts and structures are verified-3. The pipeline is executed if valid-4. Errors are returned if the pipeline definition is invalid--!!! important "Mutually Exclusive Parameters"- `plx_content` and `pipe_code` are mutually exclusive. Use one or the other, not both.-------## Error Handling--### Error Response Format--```json-{- "status": "error",- "message": "Pipeline execution failed",- "error": "Invalid concept: UnknownConcept",- "pipeline_run_id": "abc123",- "pipeline_state": "FAILED"-}-```--### HTTP Status Codes--- `200 OK`: Pipeline executed successfully-- `400 Bad Request`: Invalid input format-- `401 Unauthorized`: Missing or invalid API key-- `404 Not Found`: Pipeline not found-- `500 Internal Server Error`: Server error--### Common Errors--**Concept Not Found**-```json-{- "status": "error",- "error": "Concept 'UnknownConcept' not found in the library"-}-```--**Ambiguous Concept**-```json-{- "status": "error",- "error": "Ambiguous concept: Found 'Invoice' in domains: accounting, billing. Use 'domain.Invoice' format."-}-```--**Invalid Input Type**-```json-{- "status": "error",- "error": "Trying to create a Stuff from a list of strings but the items are not of the same type"-}-```-------## Best Practices--### Input Design--1. **Use Direct Format for Simple Inputs**- ```json- // ✅ Good- { "text": "Hello" }-- // ❌ Unnecessary- { "text": { "concept": "Text", "content": "Hello" } }- ```--2. **Be Explicit with Custom Concepts**- ```json- // ✅ Good - clear and unambiguous- { "invoice": { "concept": "accounting.Invoice", "content": {...} } }- ```--3. **Validate Before Sending**-- - Ensure all required fields are present- - Match field types to concept structure- - Use domain prefixes when concepts might be ambiguous--### Performance Tips--1. **Batch Processing**: Use list inputs when processing multiple items-2. **Reuse Connections**: Keep the client instance for multiple requests-3. **Handle Async Properly**: Use proper async/await patterns in Python--### Security--1. **Protect API Keys**: Never commit API keys to version control-2. **Use Environment Variables**: Store credentials securely- ```python- import os- api_token = os.getenv("PIPELEX_API_TOKEN")- ```-------## Client Libraries--### Python--#### Installation--```bash-pip install pipelex-```--#### Basic Usage (Direct Text Input)--```python-from pipelex.client import PipelexClient--client = PipelexClient(api_token="YOUR_API_KEY")--# Simple text input - no need for concept/content structure-response = await client.execute_pipeline(- pipe_code="analyze_sentiment",- inputs={- "text": "This is amazing!"- }-)--print(response.pipe_output.working_memory)-```--#### Structured Input--```python-from pipelex.client import PipelexClient--client = PipelexClient(api_token="YOUR_API_KEY")--# Explicit concept and structured content-response = await client.execute_pipeline(- pipe_code="extract_invoice",- inputs={- "document": {- "concept": "PDF",- "content": {- "url": "https://example.com/invoice.pdf"- }- }- }-)--# Access the main output-invoice = response.pipe_output.working_memory.root["invoice"]-print(f"Invoice Number: {invoice['content']['invoice_number']}")-```--#### Multiple Inputs with Mixed Formats--```python-from pipelex.client import PipelexClient--client = PipelexClient(api_token="YOUR_API_KEY")--response = await client.execute_pipeline(- pipe_code="contract_analysis",- inputs={- # Direct text input- "contract_text": "This is the contract text...",-- # Structured input with explicit concept- "analysis_config": {- "concept": "AnalysisConfig",- "content": {- "priority": "high",- "focus_areas": ["liability", "termination"]- }- },-- # Direct list input- "reference_docs": ["doc1", "doc2", "doc3"]- }-)--print(response.pipeline_state)-print(response.main_stuff_name)-```--#### Using StructuredContent Objects (Advanced)--```python-from pipelex.client import PipelexClient-from my_project.invoices.invoice_struct import Invoice, InvoiceLineItem--client = PipelexClient(api_token="YOUR_API_KEY")--# Create StructuredContent objects directly-invoice_data = Invoice(- invoice_number="INV-001",- amount=1250.00,- line_items=[- InvoiceLineItem(description="Service A", amount=500.00),- InvoiceLineItem(description="Service B", amount=750.00)- ]-)--# Pass StructuredContent object directly (Case 1.3)-response = await client.execute_pipeline(- pipe_code="validate_invoice",- inputs={- "invoice": invoice_data- }-)-```--#### Using Domain-Prefixed Concepts--```python-from pipelex.client import PipelexClient--client = PipelexClient(api_token="YOUR_API_KEY")--response = await client.execute_pipeline(- pipe_code="multi_domain_processing",- inputs={- "accounting_invoice": {- "concept": "accounting.Invoice", # From accounting domain- "content": {- "invoice_number": "INV-001",- "amount": 1250.00- }- },- "billing_invoice": {- "concept": "billing.Invoice", # From billing domain- "content": {- "customer_id": "CUST-123",- "period": "2025-10"- }- }- }-)-```-------## Support--For questions or issues:--- **Documentation**: [https://docs.pipelex.ai](https://docs.pipelex.ai)-- **Discord Community**: [https://go.pipelex.com/discord](https://go.pipelex.com/discord)-- **GitHub**: [https://github.com/pipelex/pipelex](https://github.com/pipelex/pipelex)-- **Email**: [[email protected]](mailto:[email protected])diff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/define_your_concepts.md b/docs/pages/build-reliable-ai-workflows-with-pipelex/define_your_concepts.mddeleted file mode 100644index 4b5468e47..000000000--- a/docs/pages/build-reliable-ai-workflows-with-pipelex/define_your_concepts.md+++ /dev/null@@ -1,367 +0,0 @@-# Defining Your Concepts--Concepts are the foundation of reliable AI workflows. They define what flows through your pipes—not just as data types, but as meaningful pieces of knowledge with clear boundaries and validation rules.--## Writing Concept Definitions--Every concept starts with a natural language definition. This definition serves two audiences: developers who build with your pipeline, and the LLMs that process your knowledge.--### Basic Concept Definition--The simplest way to define a concept is with a descriptive sentence:--```plx-[concept]-Invoice = "A commercial document issued by a seller to a buyer"-Employee = "A person employed by an organization"-ProductReview = "A customer's evaluation of a product or service"-```--Those concepts will be Text-based by default. If you want to use sutrctured output, you need to create a Python class for the concept, or declare the structure directly in the concept definition.--**Key principles for concept definitions:**--1. **Define what it is, not what it's for**- ```plx- # ❌ Wrong: includes usage context- TextToSummarize = "Text that needs to be summarized"-- # ✅ Right: defines the essence- Article = "A written composition on a specific topic"- ```--2. **Use singular forms**- ```plx- # ❌ Wrong: plural form- Invoices = "Commercial documents from sellers"-- # ✅ Right: singular form- Invoice = "A commercial document issued by a seller to a buyer"- ```--3. **Avoid unnecessary adjectives**- ```plx- # ❌ Wrong: includes subjective qualifier- LongArticle = "A lengthy written composition"-- # ✅ Right: neutral description- Article = "A written composition on a specific topic"- ```--### Organizing Related Concepts--Group concepts that naturally belong together in the same domain. A domain acts as a namespace for a set of related concepts and pipes, helping you organize and reuse your pipeline components. You can learn more about them in [Kick off a Pipelex Workflow Project](kick-off-a-pipelex-workflow-project.md#what-are-domains).--```plx-# finance.plx-domain = "finance"-description = "Financial document processing"--[concept]-Invoice = "A commercial document issued by a seller to a buyer"-Receipt = "Proof of payment for goods or services"-PurchaseOrder = "A buyer's formal request to purchase goods or services"-PaymentTerms = "Conditions under which payment is to be made"-LineItem = "An individual item or service listed in a financial document"-```--## How to Structure Your Concepts--Once you've defined your concepts semantically, you may need to add structure if they have specific fields. Pipelex offers three approaches:--### 1. No Structure (Concept Only)--For concepts that only refine native concepts without adding fields, just declare them with a description. They default to text-based content.--```plx-[concept]-ProductReview = "A customer's evaluation of a product or service"-```--### 2. Inline TOML Structures (Recommended)--Define structured concepts directly in your `.plx` files using TOML syntax. This is the fastest and simplest approach for most use cases.--```plx-[concept.Invoice]-description = "A commercial document issued by a seller to a buyer"--[concept.Invoice.structure]-invoice_number = "The unique invoice identifier"-total_amount = { type = "number", description = "Total invoice amount", required = true }-vendor_name = "The name of the vendor"-```--Behind the scenes, Pipelex generates a complete Pydantic model with validation.--### 3. Python StructuredContent Classes--Create explicit Python classes when you need custom validation, computed properties, or advanced features.--```python-from pipelex.core.stuffs.structured_content import StructuredContent-from pydantic import Field--class Invoice(StructuredContent):- invoice_number: str- total_amount: float = Field(ge=0, description="Total invoice amount")- vendor_name: str-```--**For detailed guidance on choosing and implementing these approaches, see [Structuring Concepts](structuring-concepts.md).**--## Adding Structure with Python Models--This section covers the Python class approach for structured concepts. For a simpler alternative using inline TOML syntax, see [Structuring Concepts](structuring-concepts.md).--While text definitions help LLMs understand your concepts, Python models ensure structured, validated outputs when you need custom validation, computed properties, or advanced features.--### Creating a Python Structured Model--For concepts that need custom logic, create a Python class that inherits from `StructuredContent`:--```python-# finance.py-from datetime import datetime-from pydantic import Field-from pipelex.core.stuffs.structured_content import StructuredContent--class Invoice(StructuredContent):- invoice_number: str- issue_date: datetime- due_date: datetime- vendor_name: str- customer_name: str- total_amount: float = Field(ge=0, description="Total invoice amount")- currency: str = Field(default="USD", description="Three-letter currency code")-```--The model name must match the concept name exactly: `Invoice` concept → `Invoice` class.--Python classes are automatically discovered and registered by Pipelex.--!!! warning "Module Execution During Auto-Discovery"- When Pipelex discovers `StructuredContent` classes, it imports the module containing them. **Any code at the module level (outside functions/classes) will be executed during import.** This can have unintended side effects.-- **Best practice:** Keep your `StructuredContent` classes in dedicated modules (e.g., `*_struct.py` files) with minimal module-level code, or ensure module-level code is safe to execute during discovery.--### With Custom Validation--Use Pydantic's validation features for complex rules:--```python-from pydantic import field_validator-from pipelex.core.stuffs.structured_content import StructuredContent--class Employee(StructuredContent):- name: str- email: str- department: str- years_of_experience: int = Field(ge=0, le=50, description="Years of work experience")-- @field_validator("email")- @classmethod- def validate_email(cls, v: str) -> str:- if "@" not in v:- raise ValueError("Invalid email format")- return v.lower()-```--### Linking Concepts to Models--The connection between `.plx` definitions and Python models happens automatically through naming:--```plx-# hr.plx-domain = "hr"--[concept]-Employee = "A person employed by an organization"-Meeting = "A scheduled gathering of people for discussion"-Department = "An organizational unit within a company" # No Python model => text-based-```--```python-# hr.py-from pipelex.core.stuffs.structured_content import StructuredContent-from datetime import datetime--class Employee(StructuredContent):- name: str- email: str- department: str- hire_date: datetime--class Meeting(StructuredContent):- title: str- scheduled_date: datetime- duration_minutes: int- attendees: list[str]--# Note: Department concept has no Python model, so it's text-based-```--**For more examples, advanced features, and guidance on when to use Python classes vs inline structures, see [Structuring Concepts](structuring-concepts.md).**--## Concept Refinement and Inheritance--Sometimes concepts build on each other. A `Contract` is a kind of `Document`. A `NonCompeteClause` is a specific part of a `Contract`. Pipelex lets you express these relationships.--### Declaring Concept Refinement--Use the `refines` field to indicate when one concept is a more specific version of another:--```plx-[concept]-Document = "A written or printed record"--[concept.Contract]-description = "A legally binding agreement between parties"-refines = "Text"--[concept.ContractLogo]-description = "A logo associated with a contract"-refines = "Image"-```--### Why Refinement Matters--Concept refinement helps in two ways:--1. **Semantic clarity**: Makes relationships between concepts explicit-2. **Pipeline flexibility**: Pipes accepting general concepts can work with refined ones-3. **Validation**: You can only refine Native concepts **for now** (Text, Image, PDF, TextAndImages, Number, Page)--For example, a pipe that processes `Document` can also process `Contract` or `EmploymentContract`:--```plx-[pipe.extract_key_points]-type = "PipeLLM"-description = "Extract main points from any document"-inputs = { doc = "Document" } # Can accept Document, Contract, or EmploymentContract-output = "KeyPoints"-```--## Native Concepts and Their Structures--Pipelex includes several built-in native concepts that cover common data types in AI workflows. These concepts come with predefined structures and are automatically available in all pipelines.--### Available Native Concepts--Here are all the native concepts you can use out of the box:--| Concept | Description | Content Class Name |-|---------|-------------|---------------|-| `Text` | A text | `TextContent` |-| `Image` | An image | `ImageContent` |-| `PDF` | A PDF document | `PDFContent` |-| `TextAndImages` | A text combined with images | `TextAndImagesContent` |-| `Number` | A number | `NumberContent` |-| `Page` | The content of a document page with text, images, and optional page view | `PageContent` |-| `Dynamic` | A dynamic concept that can adapt to context | `DynamicContent` |-| `LlmPrompt` | A prompt for an LLM | *No specific implementation* |-| `Anything` | A concept that can represent any type of content | *No specific implementation* |--### Native Concept Structures--Each native concept has a corresponding Python structure that defines its data model:--#### TextContent-```python-class TextContent(StuffContent):- text: str-```--#### ImageContent-```python-class ImageContent(StuffContent):- url: str- source_prompt: Optional[str] = None- caption: Optional[str] = None- base_64: Optional[str] = None-```--#### PDFContent-```python-class PDFContent(StuffContent):- url: str-```--#### NumberContent-```python-class NumberContent(StuffContent):- number: Union[int, float]-```--#### TextAndImagesContent-```python-class TextAndImagesContent(StuffContent):- text: Optional[TextContent]- images: Optional[List[ImageContent]]-```--#### PageContent-```python-class PageContent(StructuredContent):- text_and_images: TextAndImagesContent- page_view: Optional[ImageContent] = None-```--#### DynamicContent-```python-class DynamicContent(StuffContent):- # Dynamic content that can adapt to context- # Structure is flexible and determined at runtime- pass-```--**Note**: `LlmPromptContent` and `AnythingContent` are referenced in the native concept definitions but do not have actual implementations in the current codebase. They are handled through the generic content system.--### Using Native Concepts--Native concepts can be used directly in your pipeline definitions without any additional setup:--```plx-[pipe.analyze_document]-type = "PipeLLM"-description = "Analyze a PDF document"-inputs = { document = "PDF" }-output = "Text"-prompt = "Analyze this document and provide a summary"--[pipe.process_image]-type = "PipeLLM"-description = "Describe an image"-inputs = { photo = "Image" }-output = "Text"-prompt = "Describe what you see in this image"--[pipe.extract_from_page]-type = "PipeLLM"-description = "Extract information from a document page"-inputs = { page_content = "Page" }-output = "ExtractedInfo"-prompt = "Extract key information from this page content"-```--### Refining Native Concepts--You can create more specific concepts by refining native ones:--```plx-[concept.Invoice]-description = "A commercial document issued by a seller to a buyer"-refines = "PDF"--[concept.ProductPhoto]-description = "A photograph of a product for marketing purposes"-refines = "Image"--[concept.ContractPage]-description = "A page from a legal contract document"-refines = "Page"-```--When you refine a native concept, your refined concept inherits the structure of the native concept but can be used in more specific contexts. This allows for better semantic clarity while maintaining compatibility with pipes that accept the base native concept.--With well-defined concepts—both in natural language and code—your pipelines gain clarity, reliability, and maintainability. Next, we'll see how to build pipes that transform these concepts.\ No newline at end of filediff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/design_and_run_pipelines.md b/docs/pages/build-reliable-ai-workflows-with-pipelex/design_and_run_pipelines.mddeleted file mode 100644index 6c429902c..000000000--- a/docs/pages/build-reliable-ai-workflows-with-pipelex/design_and_run_pipelines.md+++ /dev/null@@ -1,166 +0,0 @@-# Designing and Running Pipelines--In Pipelex, a pipeline is not just a rigid sequence of steps; it's a dynamic and intelligent workflow built by composing individual, reusable components called **pipes**. This approach allows you to break down complex AI tasks into manageable, testable, and reliable units.--This guide provides an overview of how to design your pipelines and execute them.--## The Building Blocks: Pipes--A pipeline is composed of pipes. There are two fundamental types of pipes you will use to build your workflows:--* **[Pipe Operators](pipe-operators/index.md)**: These are the "workers" of your pipeline. They perform concrete actions like calling an LLM (`PipeLLM`), extracting text from a document (`PipeExtract`), or running a Python function (`PipeFunc`). Each operator is a specialized tool designed for a specific task.-* **[Pipe Controllers](pipe-controllers/index.md)**: These are the "managers" of your pipeline. They don't perform tasks themselves but orchestrate the execution flow of other pipes. They define the logic of your workflow, such as running pipes in sequence (`PipeSequence`), in parallel (`PipeParallel`), or based on a condition (`PipeCondition`).--## Designing a Pipeline: Composition in PLX--The most common way to design a pipeline is by defining and composing pipes in a `.plx` configuration file. This provides a clear, declarative way to see the structure of your workflow.--Each pipe, whether it's an operator or a controller, is defined in its own `[pipe.<pipe_name>]` table. The `<pipe_name>` becomes the unique identifier for that pipe.--Let's look at a simple example. Imagine we want a workflow that:-1. Takes a product description.-2. Generates a short, catchy marketing tagline for it.--We can achieve this with a `PipeLLM` operator.--```plx-# Filename: marketing_pipeline.plx--domain = "marketing"-description = "Marketing content generation domain"--# 1. Define the concepts used in our pipes-[concept]-ProductDescription = "A description of a product's features and benefits"-Tagline = "A catchy marketing tagline"--# 2. Define the pipe that does the work-[pipe.generate_tagline]-type = "PipeLLM"-description = "Generate a catchy tagline for a product"-inputs = { description = "ProductDescription" }-output = "Tagline"-prompt = """-Product Description:-@description--Generate a catchy tagline based on the above description.-The tagline should be memorable, concise, and highlight the key benefit.-"""-```--This defines a single-step pipeline. The pipe `generate_tagline` takes a `ProductDescription` as input and outputs a `Tagline`.--To create a multi-step workflow, you use a controller. The `PipeSequence` controller is the most common one. It executes a series of pipes in a specific order.--The inputs specified will be required before the pipe is executed. Those inputs should be stored in the Working Memory.--The output concept is very important. Indeed, the output of your pipe wille be corresponding to the concept you specify. If the concept is structured, the output will be a structured object. If the concept is native, the output will be a string.--```plx-# Filename: marketing_pipeline.plx--domain = "marketing"-description = "Marketing content generation domain"--# 1. Define concepts-[concept]-ProductDescription = "A description of a product's features and benefits"-Keyword = "A keyword extracted from a text"-Tagline = "A catchy marketing tagline"--# 2. Define operator pipes-[pipe.extract_keywords]-type = "PipeLLM"-description = "Extract keywords from a product description"-inputs = { description = "ProductDescription" }-output = "Keyword[]"-prompt = """-Please extract the most relevant keywords from the following product description:--@description--Focus on features, benefits, and unique selling points.-"""-```--!!! note "Multiple Outputs"- The `[]` bracket notation in `output = "Keyword[]"` allows the LLM to generate as many keywords as it finds relevant. For a comprehensive guide on controlling how many items pipes produce or accept, see [Understanding Multiplicity](understanding-multiplicity.md).--```plx-[pipe.generate_tagline_from_keywords]-type = "PipeLLM"-description = "Generate a tagline from keywords"-inputs = { keywords = "Keyword" }-output = "Tagline"-prompt = """-Here are the key product keywords:-@keywords--Generate a catchy marketing tagline based on these keywords.-The tagline should be memorable, concise (under 10 words), and highlight the main benefit.-"""--# 3. This controller pipe defines the two-step pipeline-[pipe.description_to_tagline]-type = "PipeSequence"-description = "From product description to tagline"-inputs = { description = "ProductDescription" }-output = "Tagline"-steps = [- { pipe = "extract_keywords", result = "extracted_keywords" },- { pipe = "generate_tagline_from_keywords", result = "tagline" },-]-```--## Data Flow: The Working Memory--How does data get from `extract_keywords` to `generate_tagline_from_keywords`? This is handled by the **Working Memory**.--The Working Memory is a temporary storage space that exists for the duration of a single pipeline run.--1. When a pipe in a sequence executes, its output is given a name using the `result` key (e.g., `result = "extracted_keywords"`).-2. This named result is placed into the Working Memory.-3. Subsequent pipes can then reference this data by its name in their `inputs` field (e.g., `inputs = { keywords = "Keyword" }`).--This mechanism allows you to chain pipes together, creating a flow of information through your pipeline.--## Running a Pipeline--Once your pipes are defined, you can execute them from your Python code. Pipelex provides two main functions for this: `start_pipeline` and `execute_pipeline`.--To run the `description_to_tagline` pipeline we defined above, you would call it by its unique name:--```python-import asyncio--from pipelex.pipelex import Pipelex-from pipelex.pipeline.execute import execute_pipeline--async def main():- # First, initialize Pipelex (this loads all pipeline definitions)- Pipelex.make()-- # Execute the pipeline and wait for the result- pipe_output = await execute_pipeline(- pipe_code="description_to_tagline",- inputs={- "description": {- "concept": "ProductDescription",- "content": "EcoClean Pro is a revolutionary biodegradable cleaning solution that removes 99.9% of germs while being completely safe for children and pets. Made from plant-based ingredients.",- },- },- )-- # Get the final output- tagline = pipe_output.main_stuff_as_str- print(f"Generated tagline: {tagline}")--if __name__ == "__main__":- asyncio.run(main())-```--- `execute_pipeline`: Runs the specified pipe and waits for it to complete, returning the final output. This is useful for simple, synchronous-style interactions.-- `start_pipeline`: Immediately returns a `pipeline_run_id` and an `asyncio.Task`. This allows you to run pipelines in the background and manage them asynchronously, which is essential for complex, long-running, or parallel workflows.--By combining declarative PLX definitions with a powerful Python execution model, Pipelex gives you a robust framework for building and running reliable AI workflows.diff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/executing-pipelines-with-inputs.md b/docs/pages/build-reliable-ai-workflows-with-pipelex/executing-pipelines-with-inputs.mddeleted file mode 100644index f154c7d5d..000000000--- a/docs/pages/build-reliable-ai-workflows-with-pipelex/executing-pipelines-with-inputs.md+++ /dev/null@@ -1,367 +0,0 @@-# Executing Pipelines with Inputs--When you run a Pipelex pipeline from Python, you often need to provide input data. The `inputs` parameter gives you a flexible and intuitive way to pass data to your pipelines.--This guide explains the different formats you can use and when to use each one.--## Understanding inputs--The `inputs` parameter accepts a dictionary where:--- **Keys** are the input variable names (matching the `inputs` defined in your pipeline)-- **Values** can be provided in multiple formats for convenience--Under the hood, `inputs` uses this type definition:--```python-StuffContentOrData = dict[str, Any] | StuffContent | list[Any] | str-PipelineInputs = dict[str, StuffContentOrData]-```--Pipelex is smart about detecting what you mean and automatically wraps your data in the appropriate content types.--!!! tip "Working with Lists"- When providing multiple items as input (lists) or expecting multiple outputs, understanding multiplicity is essential. See [Understanding Multiplicity](understanding-multiplicity.md) for a comprehensive guide on how Pipelex handles single items versus collections.--## Quick Comparison--Here's when to use each format:--| Format | Use Case | Example |-|--------|----------|---------|-| **Simple String** | Text inputs, quick prototypes | `"input": "Hello world"` |-| **Native Content** | PDF, Image, or other native types | `"doc": PDFContent(url="file.pdf")` |-| **Explicit Format** | Custom concepts, refined concepts | `"data": {"concept": "domain.ConceptCode", "content": value}` |-| **Mixed Formats** | Multiple inputs of different types | Combine any of the above |--## Format 1: Simple String Inputs--The simplest way to provide text input is with a plain string. Pipelex automatically converts it to `TextContent`.--### Example--```python-pipe_output = await execute_pipeline(- pipe_code="summarize_story",- inputs={- "story": """- Once upon a time there was a brave knight who saved the kingdom from a dragon.- [...]- # Imagine this is a long text for the purpose of this example- [...]- and they lived happily ever after.- """,- },-)-```--**When to use:**--- Your pipeline expects a `Text` concept-- You're passing simple string data-- You want the most concise syntax--## Format 2: Native Content Types--For native concepts like `PDF`, `Image`, `Text`, `Number`, and `Page`, you can use their content classes directly.--### PDF Example--```python-from pipelex.core.stuffs.pdf_content import PDFContent--pipe_output = await execute_pipeline(- pipe_code="process_invoice",- inputs={- "document": PDFContent(url="invoice.pdf"),- },-)-```--### Image Example--```python-from pipelex.core.stuffs.image_content import ImageContent--pipe_output = await execute_pipeline(- pipe_code="analyze_photo",- inputs={- "photo": ImageContent(url="photo.jpg"),- },-)-```--**Why this works:**--Native content types are automatically recognized by Pipelex. The system knows that `PDFContent` corresponds to the `PDF` concept, `ImageContent` to `Image`, and so on.--**When to use:**--- Your pipeline expects a native concept (`PDF`, `Image`, `Text`, `Number`, `Page`)-- You want type safety and IDE autocomplete-- You're loading from files or URLs--## Format 3: Explicit Concept Format--For custom concepts or concepts that refine native types, use the explicit format with `concept` and `content` keys.--### Example with Refined Concept--```python-from pipelex.core.stuffs.image_content import ImageContent--pipe_output = await execute_pipeline(- pipe_code="extract_gantt",- inputs={- "gantt_chart_image": {- "concept": "gantt.GanttChartImage", # Custom concept that refines Image- "content": ImageContent(url="gantt.png"),- }- },-)-```--### Example with Custom Structured Type--```python-pipe_output = await execute_pipeline(- pipe_code="answer_question",- inputs={- "question": {- "concept": "qa.Question",- "content": "What is the capital of France?",- },- },-)-```--**When to use:**--- Your pipeline expects a custom concept (not a native one)-- Your concept refines a native type but adds semantic meaning-- You need to be explicit about which concept you're providing--!!! note "Why Explicit Format is Sometimes Required"- If you have a concept like `gantt.GanttChartImage` that refines the native `Image` concept, Pipelex can't automatically know you mean a `GanttChartImage` when you pass an `ImageContent`. The explicit format removes this ambiguity.--## Format 4: Multiple Inputs with Mixed Formats--You can mix and match formats freely in the same `inputs` dictionary.--### Complex Example--```python-from pipelex.core.stuffs.text_content import load_text_from_path--pipe_output = await execute_pipeline(- pipe_code="analyze_contract",- inputs={- # Format 1: Simple string- "client_instructions": "Focus on payment terms",-- # Format 1: String loaded from file (still just a string)- "contract_text": load_text_from_path("contract.txt"),-- # Format 3: Explicit concept- "question": {- "concept": "legal.Question",- "content": "What are the fees?",- },- },-)-```--**When to use:**--- Your pipeline has multiple inputs-- Different inputs have different types or requirements-- You want to use the most convenient format for each input--## Guidelines: Choosing the Right Format--Follow these simple rules:--### Use Simple Strings When--- ✅ The input is text data-- ✅ The pipeline expects a `Text` concept-- ✅ You want minimal syntax--### Use Native Content Types When--- ✅ Working with `PDF`, `Image`, `Number`, or `Page` concepts-- ✅ You want type checking and IDE support-- ✅ Loading from files or URLs--### Use Explicit Format When--- ✅ Your concept is not a native type-- ✅ Your concept refines a native type (adds semantic meaning)-- ✅ You need to specify exactly which concept you're providing-- ✅ Pipelex gives you a type error without it--## Common Patterns--### Pattern 1: Document Processing--```python-# Most document processing pipelines expect a PDF input-pipe_output = await execute_pipeline(- pipe_code="extract_data",- inputs={- "document": PDFContent(url="document.pdf"),- },-)-```--### Pattern 2: Image Analysis--```python-# Image processing with native Image concept-pipe_output = await execute_pipeline(- pipe_code="describe_image",- inputs={- "image": ImageContent(url="photo.jpg"),- },-)-```--### Pattern 3: Text Generation--```python-# Simple text input for generation tasks-pipe_output = await execute_pipeline(- pipe_code="write_story",- inputs={- "topic": "A robot learning to love",- },-)-```--### Pattern 4: Specialized Types--```python-# Custom concept that needs explicit specification-pipe_output = await execute_pipeline(- pipe_code="process_tweet",- inputs={- "draft_tweet": {- "concept": "social.DraftTweet",- "content": "Check out this amazing framework!",- },- },-)-```--## Working with Structured Content--If you have structured data defined as a `StructuredContent` class, you can pass instances directly when using the explicit format.--### Example--```python-from my_project.models import Character--# Create a structured object-character = Character(- name="Alice",- age=30,- description="A brave explorer",-)--# Pass it to the pipeline-pipe_output = await execute_pipeline(- pipe_code="analyze_character",- inputs={- "character": {- "concept": "story.Character",- "content": character,- },- },-)-```--## Alternative: Using working_memory Directly--For advanced use cases, you can construct the working memory explicitly instead of using `inputs`:--```python-from pipelex.core.stuffs.stuff_factory import StuffFactory-from pipelex.core.memory.working_memory_factory import WorkingMemoryFactory--# Create a stuff object-character_stuff = StuffFactory.make_from_concept_string(- concept_string="story.Character",- name="character",- content=character_data,-)--# Create working memory-working_memory = WorkingMemoryFactory.make_from_single_stuff(- stuff=character_stuff,-)--# Execute with working memory-pipe_output = await execute_pipeline(- pipe_code="analyze_character",- working_memory=working_memory,-)-```--**When to use `working_memory` directly:**--- You need fine-grained control over stuff naming-- You're building complex multi-stuff scenarios-- You're working with intermediate pipeline states--**For most cases, `inputs` is simpler and recommended.**--## Troubleshooting--### Error: "Concept not found"--If you see an error about a concept not being found, you may need to use the explicit format:--```python-# ❌ Won't work if MyType is a custom concept-inputs={"data": my_value}--# ✅ Use explicit format-inputs={- "data": {- "concept": "domain.MyType",- "content": my_value,- }-}-```--### Error: "Type mismatch"--Make sure the content type matches what your concept expects:--```python-# ❌ Wrong: passing a string when concept expects structured data-inputs={- "character": {- "concept": "story.Character",- "content": "Alice", # Should be a Character instance- }-}--# ✅ Correct: pass the right type-inputs={- "character": {- "concept": "story.Character",- "content": Character(name="Alice", age=30, ...),- }-}-```--## Related Documentation--- [Design and Run Pipelines](design_and_run_pipelines.md) - Learn about pipeline execution basics-- [Define Your Concepts](define_your_concepts.md) - Understand concepts and their role-- [Structuring Concepts](structuring-concepts.md) - Create structured data types-- [Cookbook Examples](../cookbook-examples/index.md) - See real-world input patterns--diff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/pipe_plx.png b/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/pipe_plx.pngdeleted file mode 100644index 9c95c5c5d..000000000Binary files a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/pipe_plx.png and /dev/null differdiff --git a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipeline-creation.md b/docs/pages/build-reliable-ai-workflows-with-pipelex/pipeline-creation.mddeleted file mode 100644index 4d585db82..000000000--- a/docs/pages/build-reliable-ai-workflows-with-pipelex/pipeline-creation.md+++ /dev/null@@ -1,88 +0,0 @@-# Pipeline Creation using the Pipe Builder--Pipelex provides powerful tools to automatically generate complete, working pipelines from natural language requirements. This feature leverages AI to translate your ideas into fully functional pipeline code, dramatically speeding up development.--!!! tip "Pipe Builder Requirements"- For now, the pipe builder requires access to **Claude 4.5 Sonnet**, either through Pipelex Inference, or using your own key through Anthropic, Amazon Bedrock or BlackboxAI. Don't hesitate to join our [Discord](https://go.pipelex.com/discord) to get a key or see [Configure AI Providers](../setup/configure-ai-providers.md) for details. Otherwise, you can also create the workflows yourself, following our [documentation guide](kick-off-a-pipelex-workflow-project.md).--## Overview--The pipeline creation system can generate pipelines in different modes depending on your needs - from quick one-shot generation to validated, production-ready pipelines that have been automatically tested and fixed.--## Build Pipe--Generate a validated pipeline with automatic fixing of deterministic issues:--```bash-pipelex build pipe "BRIEF IN NATURAL LANGUAGE" [OPTIONS]-```--This command runs a validation/fix loop to ensure the generated pipeline is correct and runnable. It automatically detects and corrects common issues.--**Example:**--```bash-pipelex build pipe "Take a photo as input, and render the opposite of the photo" \- -o results/photo_inverter.plx-```--**Options:**--- `--output, -o`: Output path for generated PLX file-- `--no-output`: Skip saving the pipeline to file--## Quick Start Example--The simplest way to create a pipeline is to use the `build pipe` command with a clear description:--```bash-pipelex build pipe "Given an expense report, apply company rules and validate compliance"-```--This will:--1. Analyze your requirements-2. Generate a complete pipeline with appropriate concepts and pipes-3. Validate the pipeline for correctness-4. Fix any deterministic issues automatically-5. Save the working pipeline--## Best Practices--When creating pipelines with natural language:--**Be Specific About Inputs and Outputs:**--- ✅ Good: "Take a PDF invoice as input and extract the total amount, vendor name, and date"-- ❌ Vague: "Process invoices"--**Describe the Transformation:**--- ✅ Good: "Analyze sentiment of customer reviews and categorize as positive, negative, or neutral"-- ❌ Vague: "Do something with reviews"--**Mention Data Types When Relevant:**--- ✅ Good: "Extract text from a PDF, then summarize it into 3 bullet points"-- ❌ Unclear: "Summarize documents"--## What Gets Generated--When you run a build command, Pipelex automatically creates:--- **Domain definition**: The namespace for your pipeline-- **Concepts**: Structured data types for inputs and outputs-- **Pipes**: The processing steps and LLM operations-- **Python structures**: When structured output is needed (saved alongside the `.plx` file with `_struct.py` suffix)--All generated pipelines follow Pipelex best practices and conventions automatically.--## Next Steps--After generating your pipeline:--1. **Review the generated `.plx` file** to understand the structure-2. **Test the pipeline** using the generated example code-3. **Iterate if needed** by modifying the natural language description and regenerating-4. **Customize** the pipeline by editing the `.plx` file directly for fine-tuning-diff --git a/docs/pages/writing-workflows/index.md b/docs/pages/writing-workflows/index.mddeleted file mode 100644index 8828b04e9..000000000--- a/docs/pages/writing-workflows/index.md+++ /dev/null@@ -1,329 +0,0 @@-# Writing Workflows--Ready to dive deeper? This section shows you how to manually create pipelines and understand the `.plx` language.--!!! tip "Prefer Automated Workflow Generation?"- If you have access to **Claude 4.5 Sonnet** (via Pipelex Inference, Anthropic, Amazon Bedrock, or BlackBox AI), you can use our **pipe builder** to generate workflows from natural language descriptions. See the [Getting Started guide](../../index.md) to learn how to use `pipelex build pipe` commands. This tutorial is for those who want to write workflows manually or understand the `.plx` language in depth.--Let's build a **character generator** to understand the basics.--## Write Your First Pipeline--Create a `.plx` file anywhere in your project (we recommend a `pipelines` directory):--`character.plx`-```plx-domain = "characters"--[pipe]-[pipe.create_character]-type = "PipeLLM"-description = "Creates a character."-output = "Text"-prompt = """-You are a book writer. Your task is to create a character.-Think of it and then output the character description.-"""-```--This pipeline:--- Declares a `characters` domain-- Defines a `create_character` pipe of type `PipeLLM`-- Outputs plain `Text`-- Uses a simple prompt--## Run Your First Pipelex Script--**CLI:**--```bash-pipelex run create_character-```--**Python:**--Create a Python file to execute the pipeline:--`character.py`-```python-import asyncio-from pipelex.pipeline.execute import execute_pipeline-from pipelex.pipelex import Pipelex--async def create_character():- # Run the script with execute_pipe- pipe_output = await execute_pipeline(- pipe_code="create_character",- )- # Print the output- print(pipe_output.main_stuff_as_str)--# Initialize pipelex to load your pipeline libraries-Pipelex.make()--# Run using asyncio because our APIs are all async-asyncio.run(create_character())-```--Then run:--```bash-python character.py-```--## Get Your First Pipelex Result----## Using Specific LLMs--### Indicate Your LLM Selection Explicitly--```plx-[pipe.create_character]-type = "PipeLLM"-description = "Create a character."-output = "Text"-model = { model = "gpt-4o-mini", temperature = 0.9, max_tokens = "auto" }-prompt = """-You are a book writer. Your task is to create a character.-Think of it and then output the character description.-"""-```--### Or Use an LLM Preset from the LLM Deck--```plx-[pipe.create_character]-type = "PipeLLM"-description = "Create a character."-output = "Text"-model = "llm_for_creative_writing"-prompt = """-You are a book writer. Your task is to create a character.-Think of it and then output the character description.-"""--# The llm choice above is defined in `.pipelex/inference/deck/base_deck.toml` as:-# llm_for_creative_writing = { model = "base-gpt", temperature = 0.9 }-# it's a base preset that we provide. you can add your own presets, too.-```--!!! tip "LLM Presets"- We have many [LLM presets available by default](https://github.com/Pipelex/pipelex/tree/main/.pipelex/inference/deck/base_deck.toml).--Learn more in our [LLM Configuration Guide](../build-reliable-ai-workflows-with-pipelex/configure-ai-llm-to-optimize-workflows.md).--## Generate Structured Outputs--Let's create a rigorously structured `Character` object instead of plain text.--### Define the Structure using Pydantic BaseModel--Using [Pydantic BaseModel](https://docs.pydantic.dev/latest/) syntax:--`characters.py`-```python-from pipelex.core.stuffs.structured_content import StructuredContent--# Define the structure of your output here-# This class must inherit from StructuredContent-class Character(StructuredContent):- name: str- age: int- gender: str- description: str-```--!!! tip "Keep Structure Files Clean"- Keep your `StructuredContent` classes in dedicated files with minimal module-level code. Pipelex imports these modules during auto-discovery, so any module-level code will be executed.--### Define the Structure using Inline Structure Definition--Define structures directly in your `.plx` file:--```plx-[concept.Character]-description = "A character in a fiction story"--[concept.Character.structure]-name = "The character's name"-age = { type = "integer", description = "The character's age", required = true }-gender = "The character's gender"-description = "A description of the character"-```--Learn more in [Structuring Concepts](../build-reliable-ai-workflows-with-pipelex/structuring-concepts.md).--### Use your Structured Concept in Your Pipe--Specify that your output is a `Character` instance:--`characters.plx`-```plx-domain = "characters"--[concept]-Character = "A character in a fiction story" # <- Define your output concept--[pipe]-[pipe.create_character]-type = "PipeLLM"-description = "Create a character. Get a structured result."-output = "Character" # <- This is the output concept for your pipe-prompt = """-You are a book writer. Your task is to create a character.-Think of it and then output the character description.-"""-```--!!! tip "Concept Naming"- The concept name matches the class name (`Character`), so Pipelex automatically links them.--!!! tip "Semantic Clarity"- Defining concepts removes ambiguity—"character" could mean a letter or symbol, but here it clearly means a fictional person.--#### Run Your Pipeline--The output is now a structured `Character` instance:----### Using Prompt Templates--Pass data into prompts using templates.--Let's process existing characters and extract metadata from their descriptions.--#### Define the Output Structure--```python-# character_model.py-from pipelex.core.stuffs.structured_content import StructuredContent--# input class-class Character(StructuredContent):- name: str- age: int- gender: str- occupation: str- description: str--# output class-class CharacterMetadata(StructuredContent):- name: str- age: int- height: float-```--#### Use a Template to Fill Prompts with Data--!!! tip "Template Syntax"- Our template syntax is based on [Jinja2](https://jinja.palletsprojects.com/en/stable/). Use `{{ double.curly.braces }}` or the simpler `@` prefix (recommended).--```plx-[concept]-Character = "A character from a book"-CharacterMetadata = "Metadata regarding a character."--[pipe]-[pipe.extract_character_1]-type = "PipeLLM"-description = "Get character information from a description."-inputs = { character = "Character" } # <- These inputs are usable in the prompt-output = "CharacterMetadata"-prompt = """-You are given a text description of a character.-Your task is to extract specific data from the following description.--"""-```--!!! tip "Template Variables"- `@character.description` grabs the `character` stuff from working memory and uses its `description` attribute.--Learn more about Jinja in the [PipeLLM documentation](../build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeLLM.md).--#### Execute from Python--First, create an inputs JSON file:--`character_inputs.json`-```json-{- "character": {- "concept": "character.Character",- "content": {- "name": "Elias",- "age": 38,- "gender": "man",- "occupation": "explorer",- "description": "Elias Varrin is a 38-year-old man, standing at approximately 1.85 meters tall, with a lean, weathered frame shaped by decades of travel through remote and often unforgiving landscapes. His name, though not widely known, carries weight among historians, explorers, and those who trade in whispered legends. Elias has piercing storm-gray eyes that scan every environment with sharp precision, and his ash-blond hair—flecked with early streaks of grey—is usually tucked beneath a wide-brimmed, timeworn hat."- }- }-}-```--Then load and execute:--```python-import asyncio-import json-from pipelex.pipeline.execute import execute_pipeline-from pipelex.pipelex import Pipelex--from character_model import CharacterMetadata---async def process_existing_character():- # Load inputs from JSON file- with open("character_inputs.json", "r", encoding="utf-8") as f:- inputs = json.load(f)-- # Run the pipe with loaded inputs- pipe_output = await execute_pipeline(- pipe_code="extract_character_1",- inputs=inputs,- )-- # Get the result as a properly typed instance- extracted_metadata = pipe_output.main_stuff_as(content_type=CharacterMetadata)-- print(extracted_metadata)---Pipelex.make()-asyncio.run(process_existing_character())-```--#### Get Result---------## Next Steps--Now that you understand the basics, explore more:--**Learn More:**--- [Cookbook Examples](../cookbook-examples/index.md) - Real-world examples and patterns-- [Build Reliable AI Workflows](../build-reliable-ai-workflows-with-pipelex/kick-off-a-pipelex-workflow-project.md) - Deep dive into pipeline design-- [Pipe Operators](../build-reliable-ai-workflows-with-pipelex/pipe-operators/index.md) - PipeLLM, PipeExtract, PipeCompose, and more-- [Pipe Controllers](../build-reliable-ai-workflows-with-pipelex/pipe-controllers/index.md) - PipeSequence, PipeParallel, PipeBatch, PipeCondition--**Explore Tools:**--- [Pipe Builder](../tools/pipe-builder.md) - Generate pipelines from natural language-- [Kit Commands](../tools/kit.md) - Manage agent rules and migrations-- [CLI Commands](../tools/cli.md) - Command-line interface reference--**Configure:**--- [LLM Configuration](../build-reliable-ai-workflows-with-pipelex/configure-ai-llm-to-optimize-workflows.md) - Optimize cost and quality-- [Inference Backend](../configuration/config-technical/inference-backend-config.md) - Configure model providers--[](https://github.com/Pipelex/pipelex-cookbook/)diff --git a/docs/stylesheets/general.css b/docs/stylesheets/general.cssindex 726b048d7..cfc4726dd 100644--- a/docs/stylesheets/general.css+++ b/docs/stylesheets/general.css@@ -1,15 +1,69 @@-/* Custom styles for Pipelex documentation */+/* ===== Pipelex Docs – globals.css (final & minimal) ===== */-/* Equal width buttons */-.equal-width {- width: 100%;- max-width: 300px;- display: inline-block;+/* Brand colors */+:root {+ --md-accent-fg-color: #45BF9F;+ --md-primary-fg-color: #45BF9F;+ --md-primary-fg-color--light: #6CD4B6;+ --md-primary-fg-color--dark: #2E9A7F;}-/* Enable word wrapping in code blocks */-pre code {- white-space: pre-wrap !important;- word-wrap: break-word;- overflow-wrap: break-word;-}\ No newline at end of file+/* Utilities */+.equal-width { width: 100%; max-width: 300px; display: inline-block; }+pre code { white-space: pre-wrap !important; word-wrap: break-word; overflow-wrap: break-word; }++/* --- Sidebar nav --- */++/* 1) Baseline: non-active links = light grey (declare ONCE) */+.md-nav--primary .md-nav__link:not(.md-nav__link--active) {+ color: rgba(0, 0, 0, 0.6) !important;+}+[data-md-color-scheme="slate"] .md-nav--primary .md-nav__link:not(.md-nav__link--active) {+ color: rgba(255, 255, 255, 0.4) !important;+}++/* 2) TOP-LEVEL SECTION HEADERS ONLY (dark & bold)+ Works across Material versions:+ - first-level <li> that contains a child <nav>+ - OR first-level <li> that contains the toggle input+ - OR items explicitly marked as section by Material */+.md-sidebar__inner nav.md-nav--primary > ul.md-nav__list+ > li.md-nav__item:has(> nav) > label.md-nav__link,+.md-sidebar__inner nav.md-nav--primary > ul.md-nav__list+ > li.md-nav__item:has(> input.md-nav__toggle) > label.md-nav__link,+.md-nav--primary .md-nav__item.md-nav__item--section > label.md-nav__link {+ color: #000 !important;+ font-weight: 700 !important;+}+[data-md-color-scheme="slate"] .md-sidebar__inner nav.md-nav--primary > ul.md-nav__list+ > li.md-nav__item:has(> nav) > label.md-nav__link,+[data-md-color-scheme="slate"] .md-sidebar__inner nav.md-nav--primary > ul.md-nav__list+ > li.md-nav__item:has(> input.md-nav__toggle) > label.md-nav__link,+[data-md-color-scheme="slate"] .md-nav--primary .md-nav__item.md-nav__item--section > label.md-nav__link {+ color: #fff !important;+ font-weight: 700 !important;+}+/* Constant, small pill padding on ALL items (links + labels) */+.md-nav--primary .md-nav__link,+.md-nav--primary label.md-nav__link {+ padding: 6px 10px; /* tighter than before */+ margin: 0px 0px;+ border-radius: 10px; /* softer, not huge */+ box-sizing: border-box;+ transition: background-color 120ms ease, color 120ms ease; /* color only, no layout props */+}++/* Hover: color only (no padding/radius changes) */+.md-nav--primary a.md-nav__link:not(.md-nav__link--active):hover {+ background-color: rgba(255, 255, 255, 0.08);+}+[data-md-color-scheme="default"] .md-nav--primary a.md-nav__link:not(.md-nav__link--active):hover {+ background-color: rgba(0, 0, 0, 0.06);+}++/* Active: color only (no padding/radius changes) */+.md-nav--primary .md-nav__link--active {+ color: #45BF9F !important;+ font-weight: 700 !important;+ background-color: rgba(69, 191, 159, 0.12) !important;+}diff --git a/mkdocs.yml b/mkdocs.ymlindex 3385792ef..bef311f35 100644--- a/mkdocs.yml+++ b/mkdocs.yml@@ -1,11 +1,9 @@-site_name: Pipelex Docs+site_name: Pipelex Documentationsite_url: https://docs.pipelex.com/site_description: "Official documentation for Pipelex, a framework and language for building deterministic, repeatable AI workflows and knowledge pipelines."docs_dir: docsrepo_url: "https://github.com/Pipelex/pipelex"repo_name: "Pipelex on GitHub"-watch: [README.md, CONTRIBUTING.md, CHANGELOG.md, MANIFESTO.md, LICENSE]-theme:name: materialcustom_dir: docs/overrides@@ -17,16 +15,15 @@ theme:- navigation.tabs.sticky- navigation.sections- navigation.top+ - content.code.copypalette:- scheme: default # light- primary: teal- accent: deep purple+ primary: customtoggle:icon: material/weather-nightname: Switch to dark mode- scheme: slate # dark- primary: teal- accent: purple+ primary: customtoggle:icon: material/weather-sunnyname: Switch to light mode@@ -71,7 +68,8 @@ markdown_extensions:- attr_list- md_in_html- pymdownx.blocks.caption- - pymdownx.highlight+ - pymdownx.highlight:+ use_pygments: true- pymdownx.superfences:custom_fences:- name: mermaid@@ -83,102 +81,113 @@ markdown_extensions:- pymdownx.emoji:emoji_index: !!python/name:material.extensions.emoji.twemojiemoji_generator: !!python/name:material.extensions.emoji.to_svg++extra_css:+ - stylesheets/mermaid.css+ - stylesheets/general.cssnav:- Home:- - Welcome: index.md- - Writing Workflows: pages/writing-workflows/index.md- - Setup:- - Configure AI Providers: pages/setup/configure-ai-providers.md- - Project Organization: pages/setup/project-organization.md- - Telemetry: pages/setup/telemetry.md+ - What is Pipelex?: index.md+ - Get Started:+ - The Pipe Builder: home/2-get-started/pipe-builder.md+ - Write Workflows Manually: home/2-get-started/write-workflows-manually.md- Understand Pipelex:- - The Knowledge Pipeline Manifesto: manifesto.md- - The Pipelex Paradigm: pages/pipelex-paradigm-for-repeatable-ai-workflows/index.md+ - The Knowledge Pipeline Manifesto: home/3-understand-pipelex/manifesto.md+ - The Pipelex Paradigm: home/3-understand-pipelex/pipelex-paradigm/index.md- Cookbook Examples:- - Overview: pages/cookbook-examples/index.md- - Hello World: pages/cookbook-examples/hello-world.md+ - Overview: home/4-cookbook-examples/index.md+ - Hello World: home/4-cookbook-examples/hello-world.md- Document Processing:- - Simple OCR: pages/cookbook-examples/simple-ocr.md- - Generic Document Extraction: pages/cookbook-examples/extract-generic.md- - Invoice Extractor: pages/cookbook-examples/invoice-extractor.md- - Proof of Purchase Extraction: pages/cookbook-examples/extract-proof-of-purchase.md+ - Simple OCR: home/4-cookbook-examples/simple-ocr.md+ - Generic Document Extraction: home/4-cookbook-examples/extract-generic.md+ - Invoice Extractor: home/4-cookbook-examples/invoice-extractor.md+ - Proof of Purchase Extraction: home/4-cookbook-examples/extract-proof-of-purchase.md- Graphical Extraction:- - Gantt Chart Extraction: pages/cookbook-examples/extract-gantt.md- - Table Extraction from Image: pages/cookbook-examples/extract-table.md- - DPE Extraction: pages/cookbook-examples/extract-dpe.md+ - Gantt Chart Extraction: home/4-cookbook-examples/extract-gantt.md+ - Table Extraction from Image: home/4-cookbook-examples/extract-table.md+ - DPE Extraction: home/4-cookbook-examples/extract-dpe.md- Text Generation:- - Screenplay Generator (wip): pages/cookbook-examples/write-screenplay.md- - Tweet Optimizer (wip): pages/cookbook-examples/write-tweet.md+ - Screenplay Generator (wip): home/4-cookbook-examples/write-screenplay.md+ - Tweet Optimizer (wip): home/4-cookbook-examples/write-tweet.md+ - Setup:+ - Configure AI Providers: home/5-setup/configure-ai-providers.md+ - Project Organization: home/5-setup/project-organization.md+ - Telemetry: home/5-setup/telemetry.md- Build Reliable AI Workflows:- - Kick off a Pipeline Project: pages/build-reliable-ai-workflows-with-pipelex/kick-off-a-pipelex-workflow-project.md- - Define Your Concepts: pages/build-reliable-ai-workflows-with-pipelex/define_your_concepts.md- - Structuring Concepts: pages/build-reliable-ai-workflows-with-pipelex/structuring-concepts.md- - Design and Run Pipelines: pages/build-reliable-ai-workflows-with-pipelex/design_and_run_pipelines.md- - Executing Pipelines with Inputs: pages/build-reliable-ai-workflows-with-pipelex/executing-pipelines-with-inputs.md- - Understanding Multiplicity: pages/build-reliable-ai-workflows-with-pipelex/understanding-multiplicity.md- - Pipeline Creation: pages/build-reliable-ai-workflows-with-pipelex/pipeline-creation.md- - Pipe Operators:- - Overview: pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/index.md- - PipeLLM: pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeLLM.md- - PipeExtract: pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeExtract.md- - PipeImgGen: pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeImgGen.md- - PipeCompose: pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeCompose.md- - PipeFunc: pages/build-reliable-ai-workflows-with-pipelex/pipe-operators/PipeFunc.md- - Pipe Controllers:- - Overview: pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/index.md- - PipeSequence: pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeSequence.md- - PipeParallel: pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeParallel.md- - PipeBatch: pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeBatch.md- - PipeCondition: pages/build-reliable-ai-workflows-with-pipelex/pipe-controllers/PipeCondition.md- - Optimize Cost & Quality: pages/build-reliable-ai-workflows-with-pipelex/configure-ai-llm-to-optimize-workflows.md- - LLM Structured Generation: pages/build-reliable-ai-workflows-with-pipelex/llm-structured-generation-config.md- - LLM Prompting Style: pages/build-reliable-ai-workflows-with-pipelex/adapt-to-llm-prompting-style-openai-anthropic-mistral.md- - LLM Providers & Models: pages/configuration/config-technical/inference-backend-config.md- - Observer:- - Data Extraction: pages/observer/data-extraction.md- - API Reference:- - API Guide: pages/api/index.md- - n8n Node: https://pipelex.github.io/n8n-nodes-pipelex/- - Configuration:- - Overview: pages/configuration/index.md- - Pipeline Validation Configuration:- - Dry Run: pages/configuration/config-pipeline-validation/dry-run-config.md- - Static Validation: pages/configuration/config-pipeline-validation/static-validation-config.md- - Practical Configuration:- - Logging: pages/configuration/config-practical/logging-config.md- - Pipe Run: pages/configuration/config-practical/pipe-run-config.md- - Reporting: pages/configuration/config-practical/reporting-config.md- - Telemetry: pages/configuration/config-practical/telemetry-config.md- - Tracker: pages/configuration/config-practical/tracker-config.md- - Technical Configuration:- - AWS: pages/configuration/config-technical/aws-config.md- - Cogt: pages/configuration/config-technical/cogt-config.md- - Inference Backend: pages/configuration/config-technical/inference-backend-config.md- - Library: pages/configuration/config-technical/library-config.md- - Feature: pages/configuration/config-advanced/feature-config.md- - Development:- - Changelog: changelog.md+ - Kick off a Pipeline Project: home/6-build-reliable-ai-workflows/kick-off-a-pipelex-workflow-project.md+ - Pipe Builder: home/6-build-reliable-ai-workflows/pipe-builder.md+ - Pipelex Bundle Specification: home/6-build-reliable-ai-workflows/pipelex-bundle-specification.md+ - Domain: home/6-build-reliable-ai-workflows/domain.md+ - Concepts:+ - Define Your Concepts: home/6-build-reliable-ai-workflows/concepts/define_your_concepts.md+ - Inline structures: home/6-build-reliable-ai-workflows/concepts/inline-structures.md+ - Python classes: home/6-build-reliable-ai-workflows/concepts/python-classes.md+ - Native Concepts: home/6-build-reliable-ai-workflows/concepts/native-concepts.md+ - Refining Concepts: home/6-build-reliable-ai-workflows/concepts/refining-concepts.md+ - Design and Run Pipelines:+ - Overview: home/6-build-reliable-ai-workflows/pipes/index.md+ - Executing Pipelines: home/6-build-reliable-ai-workflows/pipes/executing-pipelines.md+ - Providing Inputs to Pipelines: home/6-build-reliable-ai-workflows/pipes/provide-inputs.md+ - Working Memory: home/6-build-reliable-ai-workflows/pipes/working-memory.md+ - Pipe Output: home/6-build-reliable-ai-workflows/pipes/pipe-output.md+ - Understanding Multiplicity: home/6-build-reliable-ai-workflows/pipes/understanding-multiplicity.md+ - Pipe Operators:+ - Overview: home/6-build-reliable-ai-workflows/pipes/pipe-operators/index.md+ - PipeLLM: home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeLLM.md+ - PipeExtract: home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeExtract.md+ - PipeImgGen: home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeImgGen.md+ - PipeCompose: home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeCompose.md+ - PipeFunc: home/6-build-reliable-ai-workflows/pipes/pipe-operators/PipeFunc.md+ - Pipe Controllers:+ - Overview: home/6-build-reliable-ai-workflows/pipes/pipe-controllers/index.md+ - PipeSequence: home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeSequence.md+ - PipeParallel: home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeParallel.md+ - PipeBatch: home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeBatch.md+ - PipeCondition: home/6-build-reliable-ai-workflows/pipes/pipe-controllers/PipeCondition.md+ - Optimize Cost & Quality: home/6-build-reliable-ai-workflows/configure-ai-llm-to-optimize-workflows.md+ - LLM Structured Generation: home/6-build-reliable-ai-workflows/llm-structured-generation-config.md+ - LLM Prompting Style: home/6-build-reliable-ai-workflows/adapt-to-llm-prompting-style-openai-anthropic-mistral.md+ - Configuration:+ - Overview: home/7-configuration/index.md+ - Pipeline Validation Configuration:+ - Dry Run: home/7-configuration/config-pipeline-validation/dry-run-config.md+ - Static Validation: home/7-configuration/config-pipeline-validation/static-validation-config.md+ - Practical Configuration:+ - Logging: home/7-configuration/config-practical/logging-config.md+ - Pipe Run: home/7-configuration/config-practical/pipe-run-config.md+ - Reporting: home/7-configuration/config-practical/reporting-config.md+ - Telemetry: home/7-configuration/config-practical/telemetry-config.md+ - Tracker: home/7-configuration/config-practical/tracker-config.md+ - Technical Configuration:+ - AWS: home/7-configuration/config-technical/aws-config.md+ - Cogt: home/7-configuration/config-technical/cogt-config.md+ - LLM Providers & Models: home/7-configuration/config-technical/inference-backend-config.md+ - Library: home/7-configuration/config-technical/library-config.md+ - Feature: home/7-configuration/config-advanced/feature-config.md+ - Analytics:+ - Observer Data Extraction: home/8-analytics/data-extraction.md- Tools:- - CLI: pages/tools/cli.md- - Kit Commands: pages/tools/kit.md- - Pipe Builder: pages/tools/pipe-builder.md- - Logging: pages/tools/logging.md+ - CLI: home/9-tools/cli.md+ - Kit Commands: home/9-tools/kit.md+ - Pipe Builder: home/9-tools/pipe-builder.md+ - Logging: home/9-tools/logging.md- Advanced Customizations:- - Overview: pages/advanced-customization/index.md- - Secrets Provider: pages/advanced-customization/secrets-provider-injection.md- - Reporting Delegate: pages/advanced-customization/reporting-delegate-injection.md- - Pipeline Tracker: pages/advanced-customization/pipeline-tracker-injection.md- - Storage Provider: pages/advanced-customization/storage-provider-injection.md- - Template Provider: pages/advanced-customization/template-provider-injection.md- - Observer Provider: pages/advanced-customization/observer-provider-injection.md- - Content Generator: pages/advanced-customization/content-generator-injection.md- - Pipe Router: pages/advanced-customization/pipe-router-injection.md- - License: license.md+ - Overview: home/10-advanced-customizations/index.md+ - Secrets Provider: home/10-advanced-customizations/secrets-provider-injection.md+ - Reporting Delegate: home/10-advanced-customizations/reporting-delegate-injection.md+ - Pipeline Tracker: home/10-advanced-customizations/pipeline-tracker-injection.md+ - Storage Provider: home/10-advanced-customizations/storage-provider-injection.md+ - Template Provider: home/10-advanced-customizations/template-provider-injection.md+ - Observer Provider: home/10-advanced-customizations/observer-provider-injection.md+ - Content Generator: home/10-advanced-customizations/content-generator-injection.md+ - Plugin Injection: home/10-advanced-customizations/plugin-injection.md+ - Pipe Router: home/10-advanced-customizations/pipe-router-injection.md+ - API: https://pipelex.github.io/pipelex-api/+ - MCP: https://pipelex.github.io/pipelex-mcp/+ - n8n: https://pipelex.github.io/n8n-nodes-pipelex/+ - Contribute:- Contributing: contributing.md- Code of Conduct: CODE_OF_CONDUCT.md--extra_css:- - stylesheets/mermaid.css- - stylesheets/general.css-\ No newline at end of file+ - License: license.md+ - Changelog: changelog.mddiff --git a/pipelex/builder/concept/concept_spec.py b/pipelex/builder/concept/concept_spec.pyindex 98dfee5bd..d4266d058 100644--- a/pipelex/builder/concept/concept_spec.py+++ b/pipelex/builder/concept/concept_spec.py@@ -42,7 +42,7 @@ class ConceptStructureSpec(StructuredContent):the_field_name: Field name. Must be snake_case.description: Natural language description of the field's purpose and usage.type: The field's data type.- required: Whether the field is mandatory. Defaults to True unless explicitly set to False.+ required: Whether the field is mandatory. Defaults to False unless explicitly set to True.default_value: Default value for the field. Must match the specified type, and for choicefields must be one of the valid choices. When provided, type must be specified(unless choices are provided).@@ -58,7 +58,7 @@ class ConceptStructureSpec(StructuredContent):the_field_name: str = Field(description="Field name. Must be snake_case.")description: strtype: ConceptStructureSpecFieldType = Field(description="The type of the field.")- required: bool | None = None+ required: bool | None = Falsedefault_value: Any | None = None@field_validator("type", mode="before")diff --git a/pipelex/core/concepts/concept_blueprint.py b/pipelex/core/concepts/concept_blueprint.pyindex fae92136d..5f72a7d76 100644--- a/pipelex/core/concepts/concept_blueprint.py+++ b/pipelex/core/concepts/concept_blueprint.py@@ -36,7 +36,7 @@ class ConceptStructureBlueprint(BaseModel):key_type: str | None = Nonevalue_type: str | None = Nonechoices: list[str] | None = Field(default=None)- required: bool | None = Field(default=True)+ required: bool | None = Field(default=False)default_value: Any | None = None# TODO: date translator for default_valuediff --git a/pipelex/core/concepts/concept_factory.py b/pipelex/core/concepts/concept_factory.pyindex 4f402a594..c512b5b92 100644--- a/pipelex/core/concepts/concept_factory.py+++ b/pipelex/core/concepts/concept_factory.py@@ -114,13 +114,6 @@ class ConceptFactory:description="A number",structure_class_name=structure_class_name,)- case NativeConceptCode.LLM_PROMPT:- return Concept(- code=native_concept_code,- domain=SpecialDomain.NATIVE,- description="A prompt for an LLM",- structure_class_name=NativeConceptCode.TEXT.structure_class_name,- )case NativeConceptCode.IMG_GEN_PROMPT:return Concept(code=native_concept_code,diff --git a/pipelex/core/concepts/concept_native.py b/pipelex/core/concepts/concept_native.pyindex b099db8ce..49ef6f836 100644--- a/pipelex/core/concepts/concept_native.py+++ b/pipelex/core/concepts/concept_native.py@@ -13,7 +13,6 @@ class NativeConceptCode(StrEnum):PDF = "PDF"TEXT_AND_IMAGES = "TextAndImages"NUMBER = "Number"- LLM_PROMPT = "LlmPrompt"IMG_GEN_PROMPT = "ImgGenPrompt"PAGE = "Page"ANYTHING = "Anything"@@ -46,7 +45,6 @@ class NativeConceptCode(StrEnum):| NativeConceptCode.PDF| NativeConceptCode.TEXT_AND_IMAGES| NativeConceptCode.NUMBER- | NativeConceptCode.LLM_PROMPT| NativeConceptCode.IMG_GEN_PROMPT| NativeConceptCode.PAGE| NativeConceptCode.ANYTHING@@ -67,7 +65,6 @@ class NativeConceptCode(StrEnum):| NativeConceptCode.PDF| NativeConceptCode.TEXT_AND_IMAGES| NativeConceptCode.NUMBER- | NativeConceptCode.LLM_PROMPT| NativeConceptCode.IMG_GEN_PROMPT| NativeConceptCode.PAGE| NativeConceptCode.ANYTHINGdiff --git a/pipelex/kit/agent_rules/write_pipelex.md b/pipelex/kit/agent_rules/write_pipelex.mdindex d6e0cc109..77405af0a 100644--- a/pipelex/kit/agent_rules/write_pipelex.md+++ b/pipelex/kit/agent_rules/write_pipelex.md@@ -124,16 +124,16 @@ For concepts with structured fields, define them inline using TOML syntax:description = "A commercial document issued by a seller to a buyer"[concept.Invoice.structure]-invoice_number = "The unique invoice identifier"+invoice_number = "The unique invoice identifier" # This will be optional by defaultissue_date = { type = "date", description = "The date the invoice was issued", required = true }total_amount = { type = "number", description = "The total invoice amount", required = true }-vendor_name = "The name of the vendor"-line_items = { type = "list", item_type = "text", description = "List of items", required = false }+vendor_name = "The name of the vendor" # This will be optional by default+line_items = { type = "list", item_type = "text", description = "List of items" }```**Supported inline field types:** `text`, `integer`, `boolean`, `number`, `date`, `list`, `dict`-**Field properties:** `type`, `description`, `required` (default: true), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)+**Field properties:** `type`, `description`, `required` (default: false), `default_value`, `choices`, `item_type` (for lists), `key_type` and `value_type` (for dicts)**Simple syntax** (creates required text field):```plx@@ -142,7 +142,7 @@ field_name = "Field description"**Detailed syntax** (with explicit properties):```plx-field_name = { type = "text", description = "Field description", required = false, default_value = "default" }+field_name = { type = "text", description = "Field description", default_value = "default" }```**3. Python StructuredContent Class (For Advanced Features)**diff --git a/pipelex/language/plx_factory.py b/pipelex/language/plx_factory.pyindex f5929e0ce..c32d290d2 100644--- a/pipelex/language/plx_factory.py+++ b/pipelex/language/plx_factory.py@@ -281,10 +281,13 @@ class PlxFactory:)raise TypeError(msg)log.verbose(f"Structure for '{concept_key}' is a mapping: {structure_field_value}")+ # Filter out "required" key if its value is False+ structure_field_value = cast("Mapping[str, Any]", structure_field_value)+ filtered_value = {key: value for key, value in structure_field_value.items() if not (key == "required" and not value)}structure_table_obj.add(structure_field_key,cls.convert_dicts_to_inline_tables(- value=structure_field_value, field_ordering=cls._plx_config().concepts.structure_field_ordering+ value=filtered_value, field_ordering=cls._plx_config().concepts.structure_field_ordering),)concept_table_obj.add("structure", structure_table_obj)diff --git a/tests/unit/core/concepts/concept_factory/data.py b/tests/unit/core/concepts/concept_factory/data.pyindex a705929c1..2956ce4b4 100644--- a/tests/unit/core/concepts/concept_factory/data.py+++ b/tests/unit/core/concepts/concept_factory/data.py@@ -64,7 +64,6 @@ class TestCases:("my_domain", "Dynamic", None, DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="Dynamic")),("my_domain", "TextAndImages", None, DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="TextAndImages")),("my_domain", "Number", None, DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="Number")),- ("my_domain", "LlmPrompt", None, DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="LlmPrompt")),("my_domain", "Page", None, DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="Page")),("my_domain", "Anything", None, DomainAndConceptCode(domain=SpecialDomain.NATIVE, concept_code="Anything")),]diff --git a/tests/unit/core/concepts/test_concept.py b/tests/unit/core/concepts/test_concept.pyindex dcc9306f9..e5f0bc1ad 100644--- a/tests/unit/core/concepts/test_concept.py+++ b/tests/unit/core/concepts/test_concept.py@@ -19,7 +19,6 @@ class TestConcept:assert ConceptBlueprint.is_native_concept_code(NativeConceptCode.PDF) is Trueassert ConceptBlueprint.is_native_concept_code(NativeConceptCode.TEXT_AND_IMAGES) is Trueassert ConceptBlueprint.is_native_concept_code(NativeConceptCode.NUMBER) is True- assert ConceptBlueprint.is_native_concept_code(NativeConceptCode.LLM_PROMPT) is Trueassert ConceptBlueprint.is_native_concept_code(NativeConceptCode.ANYTHING) is Trueassert ConceptBlueprint.is_native_concept_code(NativeConceptCode.DYNAMIC) is True@@ -38,9 +37,6 @@ class TestConcept:with pytest.raises(ConceptCodeError):ConceptBlueprint.is_native_concept_code(f"{SpecialDomain.NATIVE}.{NativeConceptCode.NUMBER}")- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"{SpecialDomain.NATIVE}.{NativeConceptCode.LLM_PROMPT}")-with pytest.raises(ConceptCodeError):ConceptBlueprint.is_native_concept_code(f"not_native.{NativeConceptCode.TEXT}")@@ -56,9 +52,6 @@ class TestConcept:with pytest.raises(ConceptCodeError):ConceptBlueprint.is_native_concept_code(f"not_native.{NativeConceptCode.NUMBER}")- with pytest.raises(ConceptCodeError):- ConceptBlueprint.is_native_concept_code(f"not_native.{NativeConceptCode.LLM_PROMPT}")-with pytest.raises(ConceptCodeError):ConceptBlueprint.is_native_concept_code(f"not_native.{NativeConceptCode.DYNAMIC}")@@ -76,10 +69,6 @@ class TestConcept:== 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_string(NativeConceptCode.LLM_PROMPT)- == f"{SpecialDomain.NATIVE}.{NativeConceptCode.LLM_PROMPT}"- )assert (NativeConceptCode.get_validated_native_concept_string(NativeConceptCode.ANYTHING)== f"{SpecialDomain.NATIVE}.{NativeConceptCode.ANYTHING}"@@ -107,16 +96,11 @@ class TestConcept:NativeConceptCode.get_validated_native_concept_string(f"{SpecialDomain.NATIVE}.{NativeConceptCode.NUMBER}")== f"{SpecialDomain.NATIVE}.{NativeConceptCode.NUMBER}")- assert (- NativeConceptCode.get_validated_native_concept_string(f"{SpecialDomain.NATIVE}.{NativeConceptCode.LLM_PROMPT}")- == f"{SpecialDomain.NATIVE}.{NativeConceptCode.LLM_PROMPT}"- )assert NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.TEXT}") is Noneassert NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.IMAGE}") is Noneassert NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.PDF}") is Noneassert NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.TEXT_AND_IMAGES}") is Noneassert NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.NUMBER}") is None- assert NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.LLM_PROMPT}") is Noneassert NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.ANYTHING}") is Noneassert NativeConceptCode.get_validated_native_concept_string(f"not_native.{NativeConceptCode.DYNAMIC}") is Noneassert NativeConceptCode.get_validated_native_concept_string("RandomConcept") is None@@ -196,17 +180,6 @@ class TestConcept:)is True)- assert (- Concept.is_native_concept(- ConceptFactory.make_from_blueprint(- concept_code=NativeConceptCode.LLM_PROMPT,- domain=valid_domain,- blueprint=ConceptBlueprint(description=valid_definition),- concept_codes_from_the_same_domain=["RandomConcept"],- ),- )- is True- )assert (Concept.is_native_concept(ConceptFactory.make_from_blueprint(