Working with AI assistants#
Professional responsibility#
Lactuca is a professional actuarial tool. Results depend on inputs, tables, and assumptions you choose. AI assistants can draft code faster, but they can also produce plausible-looking wrong premiums, reserves, or API usage.
You remain fully responsible for every numerical result and for compliance with applicable regulations and professional standards. See the End User License Agreement §10.2–10.3 for the full disclaimer. Spanish legal text: Contrato de Licencia de Usuario Final.
Verifying AI-generated code#
Before relying on any snippet:
Run — Execute it in an activated Python environment (
import lactucasucceeds).Cross-check — Compare magnitude with a Cookbook recipe or a simplified manual check.
API audit — Confirm method and parameter names against API Reference or IDE autocompletion.
On failure — Read Error Reference and paste the exact traceback into the assistant; do not ask it to “fix” without error context.
What these files are / are not#
For end users who installed Lactuca via pip:
Curated context files so Cursor, Copilot, ChatGPT, Claude, etc. use the real Lactuca API.
Downloadable markdown and IDE templates (see below).
Not included here:
Internal developer tooling (repository
.cursor/rules/, contributor Copilot guides, audit skills). Those are not shipped with the package.
Not a substitute for the full documentation, API Reference, or actuarial judgment.
Download the context pack#
Files are served from the documentation site (save locally for offline use):
File |
Purpose |
|---|---|
Always attach — API, pitfalls, |
|
Cursor rule template (copy to your project) |
|
VS Code Copilot instructions template |
|
Copy-paste prompts |
|
Optional — portfolio / batch |
Production URLs (terminal download):
curl -fsSL -o lactuca-ai-core.md https://www.lactuca.io/latest/_static/ai/lactuca-ai-core.md
Index for agents:
https://www.lactuca.io/llms.txt
Match docs to your installed version#
Context files declare compatible_with_docs in the header. Your installed version:
import lactuca
print(lactuca.__version__)
Documentation defaults to latest (https://www.lactuca.io/latest/...). If your
package version differs, use the version switcher on the docs site or replace
latest with /vX.Y.Z/ in bookmarked URLs.
Quick start#
Download lactuca-ai-core.md.
Open your AI tool (see sections below).
Attach the core file (or paste its contents at the start of the chat).
Use a template from prompt-templates.md or ask:
Using the attached Lactuca context, write a runnable script for a 15-year temporary annuity-due, male age 50, table PER2020_Ind_1o, cohort=1960, i=3%. Use
äxanddiscrete_precision. Do not invent parameters.Verify using the workflow above.
Cursor#
Copy lactuca-user.mdc to your project:
.cursor/rules/lactuca-user.mdcOr reference the core in chat:
@lactuca-ai-core.md(after saving it in the project).Keep the core next to your actuarial scripts for
@mentions.
alwaysApply: true in the template loads Lactuca conventions in every chat; for smaller
context use @file only when working on Lactuca code.
VS Code + GitHub Copilot#
Copy copilot-instructions-lactuca.md to your project as
.github/copilot-instructions.md, or paste the core into Copilot → Customize Chat → Instructions.In chat,
#file:lactuca-ai-core.mdif the file lives in the workspace.
ChatGPT / Claude / Gemini#
Projects / Custom GPT: upload
lactuca-ai-core.md(+ optionalprompt-templates.md) as knowledge files.Ad hoc chat: paste the core at the beginning; re-attach in long threads.
Web discovery: agents may read
https://www.lactuca.io/llms.txt.
JupyterLab, VS Code notebooks, and Google Colab use the same context files as
scripts. Save or upload lactuca-ai-core.md (and optionally prompt-templates.md) next
to your notebook. In VS Code, use the Copilot or Cursor chat panel as for .py files.
No notebook-specific extension is required.
Prompt templates#
Full templates: prompt-templates.md
Template #1 references the package version via compatible_with_docs in the attached core
file (or substitute import lactuca; lactuca.__version__ after you verify it matches).
Minimal example:
Context: attached lactuca-ai-core.md (Lactuca actuarial Python library).
Task: Price a 20-year term insurance, male 45, PASEM2020_NoRel_1o, i=3%.
Use Ax(n=20). If unsure about a parameter, say so — do not invent API.
Portfolio and batch work#
Attach lactuca-ai-batch.md in addition to the core.
See Batch Calculations for full semantics (benefits=, on_error, record_ids).
Updating context when you upgrade Lactuca#
After pip install --upgrade lactuca:
Check
lactuca.__version__againstcompatible_with_docsin your saved core file.Re-download the pack from this page if versions differ.
Re-run a known Cookbook recipe to sanity-check.
Further reading#
Getting Started — installation and first calculations
Notation and Glossary — symbols and parameter names
Cookbook — verified recipes
Error Reference —
ValueErrormessagesActivation Guide — licensing