Skip to content

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

Fix/typo and hello world code (#91)

Louis Choquelcaaab2b76192
diff --git a/.cursor/rules/llms.mdc b/.cursor/rules/llms.mdc
index 6de8f9f08..94a66595e 100644
--- a/.cursor/rules/llms.mdc
+++ b/.cursor/rules/llms.mdc
@@ -17,7 +17,7 @@ An llm_handle matches the handle (an id of sorts) with the full specification of
- llm_version
- llm_platform_choice
-The declaration of llm_handleslooks like this in toml syntax:
+The declaration of llm_handles looks like this in toml syntax:
```toml
[llm_handles]
gpt-4o-2024-08-06 = { llm_name = "gpt-4o", llm_version = "2024-08-06" }
diff --git a/docs/pages/cookbook-examples/hello-world.md b/docs/pages/cookbook-examples/hello-world.md
index c1f7dcddc..60bc763b2 100644
--- a/docs/pages/cookbook-examples/hello-world.md
+++ b/docs/pages/cookbook-examples/hello-world.md
@@ -10,6 +10,55 @@ You can find the complete code for this example in the Pipelex Cookbook reposito
[**➡️ View on GitHub: quick_start/hello_world.py**](https://github.com/Pipelex/pipelex-cookbook/blob/main/quick_start/hello_world.py)
+## The Pipeline Explained
+
+The `hello_world` function demonstrates the simplest possible Pipelex pipeline. It runs a single pipe that generates a haiku about "Hello World".
+
+```python
+import asyncio
+
+from pipelex import pretty_print
+from pipelex.pipelex import Pipelex
+from pipelex.pipeline.execute import execute_pipeline
+
+
+async def hello_world():
+
+ # Execute the pipeline
+ pipe_output, _ = await execute_pipeline(
+ pipe_code="hello_world",
+ )
+
+ # Print the output
+ pretty_print(pipe_output, title="Your first Pipelex output")
+
+
+# start Pipelex
+Pipelex.make()
+# run sample using asyncio
+asyncio.run(hello_world())
+```
+
+This example shows the minimal setup needed to run a Pipelex pipeline: initialize Pipelex, execute a pipeline by its code name, and pretty-print the results.
+
+## The Pipeline Definition: `hello_world.toml`
+
+The pipeline definition is extremely simple - it's a single LLM call that generates a haiku:
+
+```toml
+domain = "quick_start"
+definition = "Discovering Pipelex"
+
+[pipe]
+[pipe.hello_world]
+PipeLLM = "Write text about Hello World."
+output = "Text"
+llm = { llm_handle = "gpt-4o-mini", temperature = 0.9, max_tokens = "auto" }
+prompt = """
+Write a haiku about Hello World.
+"""
+```
+
## How to run
1. Clone the cookbook repository:
@@ -25,4 +74,6 @@ You can find the complete code for this example in the Pipelex Cookbook reposito
4. Run the example:
```bash
python quick_start/hello_world.py
- ```
\ No newline at end of file
+ ```
+
+Expected output: A haiku about "Hello World" displayed with pretty formatting.