Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 0 additions & 124 deletions .cursor/rules/coding_standards.mdc

This file was deleted.

8 changes: 8 additions & 0 deletions .cursor/rules/commands.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
alwaysApply: true
description: Guidelines for running commands
---
# Commands

- When you want to run commands such as `python`, `pytest` or any of our CLI such as `pipelex` or `cocode`, ALWAYS use the current obvious virtual env. If the installaton is standard, the venv is named `.venv` so always check that first.

12 changes: 10 additions & 2 deletions .cursor/rules/docs.mdc
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
---
description:
globs: docs/**/*.md
alwaysApply: false
description: Guidelines for writing documentation
globs:
- docs/**/*.md
---
# Writing Docs

Write docs and answer questions about writing docs.

We use Material for MkDocs. All markdown in our docs must be compatible with Material for MkDocs and done using best practices to get the best results with Material for MkDocs.

## MkDocs Markdown Requirements

- Always add a blank line before any bullet lists or numbered lists in MkDocs markdown.

60 changes: 31 additions & 29 deletions .cursor/rules/llms.mdc
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
---
globs: *.plx,*.toml
alwaysApply: false
description: LLM configuration and usage guidelines
globs:
- '*.plx'
- '*.toml'
---
# Rules to choose LLM models used in PipeLLMs.

## LLM Handles
## LLM Configuration System

In order to use it in a pipe, an LLM is referenced by its llm_handle and possibly by an llm_preset.
Both llm_handles and llm_presets are defined in this toml config file: [base_llm_deck.toml](mdc:pipelex/libraries/llm_deck/base_llm_deck.toml)
In order to use it in a pipe, an LLM is referenced by its llm_handle (alias) and possibly by an llm_preset.
LLM configurations are managed through the new inference backend system with files located in `.pipelex/inference/`:

## LLM Handles
- **Model Deck**: `.pipelex/inference/deck/base_deck.toml` and `.pipelex/inference/deck/overrides.toml`
- **Backends**: `.pipelex/inference/backends.toml` and `.pipelex/inference/backends/*.toml`
- **Routing**: `.pipelex/inference/routing_profiles.toml`

An llm_handle matches the handle (an id of sorts) with the full specification of the LLM to use, i.e.:
- llm_name
- llm_version
- llm_platform_choice
## LLM Handles

The declaration of llm_handles looks like this in toml syntax:
```toml
[llm_handles]
gpt-4o-2024-11-20 = { llm_name = "gpt-4o", llm_version = "2024-11-20" }
```
An llm_handle can be either:
1. **A direct model name** (like "gpt-4o-mini", "claude-3-sonnet") - automatically available for all models loaded by the inference backend system
2. **An alias** - user-defined shortcuts that map to model names, defined in the `[aliases]` section:

In mosty cases, we only want to use version "latest" and llm_platform_choice "default" in which case the declaration is simply a match of the llm_handle to the llm_name, like this:
```toml
best-claude = "claude-4-opus"
best-gemini = "gemini-2.5-pro"
best-mistral = "mistral-large"
[aliases]
base-claude = "claude-4.5-sonnet"
base-gpt = "gpt-5"
base-gemini = "gemini-2.5-flash"
base-mistral = "mistral-medium"
```

And of course, llm_handles are automatically assigned for all models by their name, with version "latest" and llm_platform_choice "default".
The system first looks for direct model names, then checks aliases if no direct match is found. The system handles model routing through backends automatically.

## Using an LLM Handle in a PipeLLM

Expand All @@ -38,10 +39,10 @@ Here is an example of using an llm_handle to specify which LLM to use in a PipeL
```plx
[pipe.hello_world]
type = "PipeLLM"
definition = "Write text about Hello World."
description = "Write text about Hello World."
output = "Text"
llm = { llm_handle = "gpt-4o-mini", temperature = 0.9, max_tokens = "auto" }
prompt_template = """
model = { model = "gpt-5", temperature = 0.9 }
prompt = """
Write a haiku about Hello World.
"""
```
Expand All @@ -54,20 +55,20 @@ Presets are meant to record the choice of an llm with its hyper parameters (temp

Examples:
```toml
llm_to_reason = { llm_handle = "o4-mini", temperature = 1, max_tokens = "auto" }
llm_to_extract_invoice = { llm_handle = "claude-3-7-sonnet", temperature = 0.1, max_tokens = "auto" }
llm_to_reason = { model = "base-claude", temperature = 1 }
llm_to_extract_invoice = { model = "claude-3-7-sonnet", temperature = 0.1, max_tokens = "auto" }
```

The interest is that these presets can be used to set the LLM choice in a PipeLLM, like this:

```plx
[pipe.extract_invoice]
type = "PipeLLM"
definition = "Extract invoice information from an invoice text transcript"
description = "Extract invoice information from an invoice text transcript"
inputs = { invoice_text = "InvoiceText" }
output = "Invoice"
llm = "llm_to_extract_invoice"
prompt_template = """
model = "llm_to_extract_invoice"
prompt = """
Extract invoice information from this invoice:

The category of this invoice is: $invoice_details.category.
Expand All @@ -76,8 +77,9 @@ The category of this invoice is: $invoice_details.category.
"""
```

The setting here `llm = "llm_to_extract_invoice"` works because "llm_to_extract_invoice" has been declared as an llm_preset in the deck.
The setting here `model = "llm_to_extract_invoice"` works because "llm_to_extract_invoice" has been declared as an llm_preset in the deck.
You must not use an LLM preset in a PipeLLM that does not exist in the deck. If needed, you can add llm presets.


You can override the predefined llm presets in [overrides.toml](your/path/to/pipelex/config/folder/llm_deck/overrides.toml).
You can override the predefined llm presets by setting them in `.pipelex/inference/deck/overrides.toml`.

Loading