LLM template loader for Latitude - Load prompts from Latitude as LLM templates
Project description
llm-templates-latitude
Template loader for LLM that loads prompts from Latitude.
This plugin allows you to use prompts managed in Latitude as templates in LLM, giving you the best of both worlds: centralized prompt management in Latitude and flexible model execution with LLM.
Installation
From PyPI (when published)
llm install llm-templates-latitude
Development Installation with uv
If you want to install from source or contribute to development:
git clone https://github.com/pcaro/llm-templates-latitude
cd llm-templates-latitude
uv sync
uv pip install -e .
Configuration
Set your Latitude API key:
export LATITUDE_API_KEY="your-api-key"
Or configure it using LLM:
llm keys set latitude
# Enter: your-api-key
Usage
Basic Usage
Load a Latitude prompt as a template and use it with any LLM model:
# Use a Latitude prompt with GPT-4
llm -t lat:my-project/welcome-email -m gpt-4 "New user John just signed up"
# Use with Claude
llm -t lat:my-project/blog-writer -m claude-3.5-sonnet -p topic "AI development" "Write an article"
# Use with local models
llm -t lat:code-reviewer -m llama2 < my-code.py
Template Path Formats
# Full format: project-id/prompt-path
llm -t lat:proj-123/marketing/emails/welcome
# Nested paths supported
llm -t lat:my-project/content/blog/technical-writer
# Just prompt path (uses default project)
llm -t lat:welcome-email
With Parameters
If your Latitude prompt has parameters defined, you can override them:
llm -t lat:email-template -p recipient_name "Alice" -p tone "formal" "Meeting cancelled"
Save Templates Locally
You can save Latitude templates locally for faster access:
# Download and save locally
llm -t lat:my-project/summarizer --save my-summarizer
# Use the saved template
llm -t my-summarizer -m gpt-4 "Content to summarize"
Streaming Responses
Templates work with streaming just like regular LLM usage:
llm -t lat:story-writer -m gpt-4 "Once upon a time..." --stream
Template Features
The plugin automatically extracts from your Latitude prompts:
- Prompt content: Main prompt text with variables
- System prompts: If defined in Latitude
- Default parameters: Parameter defaults from Latitude
- Model recommendations: Suggested model from Latitude
- Model configuration: Temperature, max tokens, etc.
- JSON schemas: For structured output prompts
Examples
Content Generation
# Blog post writer
llm -t lat:content/blog-writer -m gpt-4 -p topic "Python packaging" -p audience "developers"
# Email templates
llm -t lat:emails/customer-support -m claude-3 "Customer wants refund"
Code Tasks
# Code review
llm -t lat:dev/code-reviewer -m gpt-4 < pull-request.diff
# Documentation generator
llm -t lat:dev/doc-generator -m claude-3 -p language "Python" < my-function.py
Data Analysis
# Data summarizer
cat data.csv | llm -t lat:analysis/data-summary -m gpt-4
# Report generator
llm -t lat:reports/quarterly -m claude-3 -p quarter "Q4 2023" -p metrics "revenue,users"
Development
This project uses uv for dependency management.
Setup
git clone https://github.com/pcaro/llm-templates-latitude
cd llm-templates-latitude
# Install dependencies and create virtual environment
uv sync
# Install in development mode
uv pip install -e .
Running Tests
# Run tests
uv run pytest
# Run tests with coverage
uv run pytest --cov=llm_templates_latitude
Code Formatting and Linting
# Format code
uv run black .
# Lint code
uv run ruff check --fix .
# Type checking
uv run mypy llm_templates_latitude.py
Building
# Build distribution packages
uv build
How It Works
- Template Request: When you use
-t lat:project/prompt, the plugin calls Latitude's API - Template Download: Retrieves the prompt content, system prompt, and configuration
- LLM Integration: Creates an LLM template with the downloaded content
- Model Execution: LLM processes your input with the chosen model using the Latitude prompt
This gives you:
- ✅ Centralized prompt management in Latitude
- ✅ Version control and A/B testing of prompts
- ✅ Team collaboration on prompts
- ✅ Flexibility to use any model with LLM
- ✅ Local caching and offline usage
- ✅ Integration with LLM's ecosystem (logs, conversations, etc.)
Author
Created by Pablo Caro Revuelta (@pcaro)
License
Apache 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_templates_latitude-0.1.0.tar.gz.
File metadata
- Download URL: llm_templates_latitude-0.1.0.tar.gz
- Upload date:
- Size: 81.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
779702a20aea4df8caa79d34e30f38319956f430cfb85097dba2e4aa7fdd07dd
|
|
| MD5 |
c4d564e03e1fdf14adfdec7721917fcb
|
|
| BLAKE2b-256 |
88bdf3e1fc64411f7f9f068daedc2f6c388ec819924b7596f0bd8e1502ab7d32
|
File details
Details for the file llm_templates_latitude-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llm_templates_latitude-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a6b8e7e6fbaac4cfec337e9b9bfdbd684b0d9154af773ddf67dbfdfd0b9db63
|
|
| MD5 |
2ddd1716b32ca2ac30337091460b18a0
|
|
| BLAKE2b-256 |
1bb4daefe956258d6402a0332e9cea70d4625d332c9392a84f487b339aa1c2b7
|