# CLI Usage LLMPromptKit provides a command-line interface (CLI) for managing prompts, versions, tests, and evaluations. ## Basic Commands ### Prompt Management ```bash # Create a prompt llmpromptkit prompt create "Weather Forecast" --content "Provide a weather forecast for {location} on {date}" --tags "weather,forecast" # List all prompts llmpromptkit prompt list # Get prompt details llmpromptkit prompt get # Update a prompt llmpromptkit prompt update --content "New content" --tags "new,tags" # Delete a prompt llmpromptkit prompt delete ``` ### Version Control ```bash # Commit a version llmpromptkit version commit --message "Version description" # List versions llmpromptkit version list # Check out (revert to) a specific version llmpromptkit version checkout # Compare versions llmpromptkit version diff ``` ### Testing ```bash # Create a test case llmpromptkit test create --input '{"location": "New York", "date": "tomorrow"}' --expected "Expected output" # List test cases llmpromptkit test list # Run a specific test case llmpromptkit test run --llm openai # Run all test cases for a prompt llmpromptkit test run-all --llm openai # Run an A/B test between two prompts llmpromptkit test ab --inputs '[{"var": "value1"}, {"var": "value2"}]' --llm openai ``` ### Evaluation ```bash # Evaluate a prompt llmpromptkit eval run --inputs '[{"var": "value1"}, {"var": "value2"}]' --llm openai # List available metrics llmpromptkit eval metrics # Register a custom metric llmpromptkit eval register-metric ``` ## Environment Configuration The CLI supports environment variables for configuration: - `LLMPROMPTKIT_STORAGE`: Path to store prompts and related data - `LLMPROMPTKIT_OPENAI_API_KEY`: OpenAI API key for built-in LLM support - `LLMPROMPTKIT_DEFAULT_LLM`: Default LLM to use for testing and evaluation You can also create a config file at `~/.llmpromptkit/config.json`: ```json { "storage_path": "/path/to/storage", "default_llm": "openai", "api_keys": { "openai": "your-openai-key" } } ``` ## Advanced Usage ### Multiple Storage Locations ```bash # Specify a storage location for a command llmpromptkit --storage /path/to/storage prompt list # Export a prompt to another storage llmpromptkit prompt export --output /path/to/output.json # Import a prompt from a file llmpromptkit prompt import /path/to/prompt.json ``` ### Automation and Scripting ```bash # Get output in JSON format llmpromptkit --json prompt list # Use in shell scripts PROMPT_ID=$(llmpromptkit --json prompt create "Script Prompt" --content "Content" | jq -r '.id') echo "Created prompt with ID: $PROMPT_ID" ```