diff --git a/README.md b/README.md index 0617f4b..7ba4d41 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # dspy-cli -[![Documentation](https://img.shields.io/badge/docs-cmpnd--ai.github.io-blue)](https://cmpnd-ai.github.io/dspy-cli-tool/) +[![Documentation](https://img.shields.io/badge/docs-cmpnd--ai.github.io-blue)](https://cmpnd-ai.github.io/dspy-cli/) [![PyPI](https://img.shields.io/pypi/v/dspy-cli)](https://pypi.org/project/dspy-cli/) `dspy-cli` is a tool for creating, developing, testing, and deploying [DSPy](https://dspy.ai) programs as HTTP APIs. `dspy-cli` auto-generates endpoints, OpenAPI specs, and Docker configs. @@ -203,7 +203,7 @@ We've built out a lot of quality of life features in `dspy-cli`, including: - **MCP tool support:** Pass in `--mcp` while calling `serve` to stand up an MCP server for your program. - **Docker configuration:** Running `new` creates a Dockerfile, which can be used to quickly stand up your program in Docker. -Check out [the full docs](https://cmpnd-ai.github.io/dspy-cli-tool/) to learn more. +Check out [the full docs](https://cmpnd-ai.github.io/dspy-cli/) to learn more. ### License diff --git a/docs/OPENAPI.md b/docs/OPENAPI.md index 81808a2..1a869e7 100644 --- a/docs/OPENAPI.md +++ b/docs/OPENAPI.md @@ -69,6 +69,7 @@ description: A set of functions for a content management system. ``` Fallback defaults if not specified: + - **title**: "DSPy API" - **description**: "Automatically generated API for DSPy programs" - **version**: "0.1.0" @@ -96,6 +97,7 @@ spec = generate_openapi_spec(app) ### Interactive Documentation FastAPI provides: + - **Swagger UI**: `http://localhost:8000/docs` - **ReDoc**: `http://localhost:8000/redoc` @@ -132,16 +134,19 @@ Options: ## Troubleshooting **Spec not generated:** + 1. Verify `--no-save-openapi` wasn't used 2. Check write permissions 3. Check server logs **Missing program schemas:** + 1. Ensure modules subclass `dspy.Module` 2. Verify `forward()` has type annotations 3. Check modules are in `src//modules/` **Incorrect metadata:** + 1. Check `app_id` in `dspy.config.yaml` 2. Verify `description` field 3. Ensure config file is in project root diff --git a/docs/commands/generate.md b/docs/commands/generate.md index f572697..f74b154 100644 --- a/docs/commands/generate.md +++ b/docs/commands/generate.md @@ -76,12 +76,14 @@ dspy-cli g scaffold agent -m ReAct -s "task, tools: list[str] -> action, result" ## Output Structure Creates two files: + - `signatures/{name}.py` - Input/output schema - `modules/{name}_{type}.py` - Module implementation (e.g., analyzer_predict.py, reasoner_cot.py) ## Endpoint Naming Endpoints are derived from the generated module class name. For example: + - **Predict**: `analyzer` → `AnalyzerPredict` → `POST /AnalyzerPredict` - **CoT**: `reasoner -m CoT` → `ReasonerCoT` → `POST /ReasonerCoT` - **ReAct**: `agent -m ReAct` → `AgentReAct` → `POST /AgentReAct` diff --git a/docs/commands/new.md b/docs/commands/new.md index 08d0929..d32cc38 100644 --- a/docs/commands/new.md +++ b/docs/commands/new.md @@ -19,6 +19,9 @@ dspy-cli new email-summarizer -s "email: str -> summary: str, key_points: list[s # Specify program name dspy-cli new notion-tools -p emoji_picker -s "context: str -> emoji: str" + +# Specify module type and model +dspy-cli new chat-bot -m CoT --model anthropic/claude-3-sonnet ``` ## Description @@ -31,14 +34,47 @@ Creates project with standard directory layout, dependency configuration, and in |--------|-------|---------|-------------| | `--program-name` | `-p` | Derived from project name | Name of initial program module | | `--signature` | `-s` | `question -> answer` | Input/output signature defining the program interface | +| `--module-type` | `-m` | `Predict` | DSPy module type (Predict, CoT, ReAct, etc.) | +| `--model` | - | `openai/gpt-5-mini` | LLM model string (e.g. `openai/gpt-4o`) | +| `--api-key` | - | - | API key for the LLM provider | ## Arguments - `PROJECT_NAME` - Name of the project directory to create (required) -## Generated Structure +## Interactive Mode + +Running `dspy-cli new` without arguments will start an interactive mode where you can specify the project name, program name, signature, module type, and model. +Expected Outputs: + +``` +What is your project name? [my-project]: email-subject +Would you like to specify your first program? [Y/n]: Y +What is the name of your first DSPy program? [my_program]: email_subject +Choose a module type: + 1. Predict - Basic prediction module (default) + 2. ChainOfThought (CoT) - Step-by-step reasoning with chain of thought + 3. ProgramOfThought (PoT) - Generates and executes code for reasoning + 4. ReAct - Reasoning and acting with tools + 5. MultiChainComparison - Compare multiple reasoning paths + 6. Refine - Iterative refinement of outputs +Enter number or name [1]: 1 +Enter your signature or type '?' for guided input: + Examples: 'question -> answer', 'post:str -> tags:list[str], category:str' +Signature [question:str -> answer:str]: body, sender, context -> subject, tone, priority +Enter your model (LiteLLM format): + Examples: 'anthropic/claude-sonnet-4-5', 'openai/gpt-4o', 'ollama/llama2' +Model [openai/gpt-5-mini]: openai/gpt-5-mini +Enter your OpenAI API key: + (This will be stored in .env as OPENAI_API_KEY) + Press Enter to skip and set it manually later +OPENAI_API_KEY: your_key_here ``` + +## Generated Structure + +```bash my-feature/ ├── src/ │ └── my_feature/ @@ -60,29 +96,6 @@ my-feature/ Format: `input -> output` with optional type annotations. See [dspy-cli generate](generate.md) for complete syntax reference. -## Examples - -### Email Summarizer - -```bash -dspy-cli new email-summarizer -s "email: str -> summary: str, key_points: list[str]" -``` - -Generates: -- Signature: `EmailSummarizerSignature` with `email` input, `summary` and `key_points` outputs -- Module: `EmailSummarizerPredict` -- Endpoint: `/EmailSummarizerPredict` - -### Multi-Input Analyzer - -```bash -dspy-cli new code-reviewer -s "code: str, language: str -> issues: list[str], suggestions: str" -``` - -Creates module accepting two inputs (`code`, `language`) and returning two outputs (`issues`, `suggestions`). - -### Custom Program Name - ```bash dspy-cli new blog-tools -p tagger -s "blog_post: str -> tags: list[str]" ``` @@ -93,7 +106,7 @@ Project named `blog-tools`, initial program named `TaggerPredict`. Additional pr 1. Configure `.env` with API key 2. Install dependencies: `uv sync` -3. Start server: `dspy-cli serve --ui` +3. Start server: `dspy-cli serve` ## See Also diff --git a/docs/commands/serve.md b/docs/commands/serve.md index 1299a04..6b369e9 100644 --- a/docs/commands/serve.md +++ b/docs/commands/serve.md @@ -58,6 +58,7 @@ Every deployment provides: | `/openapi.json` | GET | OpenAPI specification | With `--mcp` enabled: + - `/mcp` provides Model Context Protocol server ## Logging @@ -72,7 +73,9 @@ Logs to console by default. Use `--logs-dir` to write per-module JSON logs with dspy-cli serve ``` -Server starts on `http://localhost:8000`. Call modules: +Assuming that there exists a module with the name `SummarizerPredict`, and it has a signature of `blog_post, summary_length, tone -> summary`. + +The server starts on `http://localhost:8000`. Call `SummarizerPredict`: ```bash curl -X POST http://localhost:8000/SummarizerPredict \ diff --git a/docs/configuration.md b/docs/configuration.md index f69bb20..3b9b692 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -34,29 +34,24 @@ program_models: ## Fields -**`app_id`** (required) - Unique identifier - -**`models.default`** (required) - Default model alias - -**`models.registry`** (required) - Available models +| Field | Required | Description | +|-------|----------|-------------| +| `app_id` | Yes | Unique identifier | +| `models.default` | Yes | Default model alias | +| `models.registry` | Yes | Available models | +| `program_models` | No | Per-program model overrides | ### Registry Entry -**`model`** (required) - Provider/model name (e.g., `openai/gpt-5-mini`) - -**`env`** (optional) - Environment variable for API key - -**`api_key`** (optional) - Direct API key (use `env` for security) - -**`api_base`** (optional) - Custom API endpoint - -**`max_tokens`** (optional) - Max response tokens - -**`temperature`** (optional) - Sampling temperature (0.0-2.0) - -**`model_type`** (optional) - `chat` or `responses` (default: `chat`) - -**`program_models`** (optional) - Per-program model overrides +| Field | Required | Description | +|-------|----------|-------------| +| `model` | Yes | Provider/model name (e.g., `openai/gpt-5-mini`) | +| `env` | No | Environment variable for API key | +| `api_key` | No | Direct API key (use `env` for security) | +| `api_base` | No | Custom API endpoint | +| `max_tokens` | No | Max response tokens | +| `temperature` | No | Sampling temperature (0.0-2.0) | +| `model_type` | No | `chat` or `responses` (default: `chat`) | ## API Keys diff --git a/docs/contributing.md b/docs/contributing.md index 5d8fb33..3e65855 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -6,8 +6,8 @@ Thank you for your interest in contributing to dspy-cli! This guide will help yo ```bash # Clone the repository -git clone https://github.com/cmpnd-ai/optimization-platform -cd optimization-platform/dspy-cli +git clone https://github.com/cmpnd-ai/cli-tool +cd cli-tool/dspy-cli # Install with uv (recommended) uv sync --extra dev @@ -105,137 +105,6 @@ from dspy_cli.errors import DSPyError - Use `Path` from `pathlib`, not strings - Example: `Path.cwd() / "dspy.config.yaml"` not `"dspy.config.yaml"` -### Error Handling - -- Use custom exceptions from `dspy_cli/errors.py` -- Available: `DSPyError`, `DSPyCommandError`, `ValidationError`, etc. - -### Type Hints - -All functions must have type hints: - -```python -from typing import Optional -from pathlib import Path - -def load_config(path: Optional[Path] = None) -> dict[str, Any]: - """Load configuration from YAML file.""" - ... -``` - -## Project Structure - -``` -dspy-cli/ -├── src/ -│ └── dspy_cli/ -│ ├── cli.py # Main CLI entry point -│ ├── commands/ # CLI commands -│ │ ├── new.py -│ │ ├── serve.py -│ │ └── generate.py -│ ├── server/ # FastAPI server -│ ├── discovery/ # Module discovery -│ ├── utils/ # Utilities -│ ├── templates/ # Project templates -│ └── errors.py # Custom exceptions -├── tests/ # Test files -├── docs/ # Documentation -├── pyproject.toml # Package configuration -└── README.md -``` - -## Making Changes - -### 1. Create a Branch - -```bash -git checkout -b feature/my-feature -# or -git checkout -b fix/my-bugfix -``` - -### 2. Make Your Changes - -- Write tests for new features -- Update documentation if needed -- Follow code style conventions -- Add type hints - -### 3. Run Tests - -```bash -pytest -``` - -### 4. Commit Your Changes - -```bash -git add . -git commit -m "feat: add new feature" -``` - -Use conventional commits: -- `feat:` - New feature -- `fix:` - Bug fix -- `docs:` - Documentation changes -- `test:` - Test changes -- `refactor:` - Code refactoring -- `chore:` - Maintenance tasks - -## Releasing - -For information on how to release new versions to PyPI, see [Releasing](releasing.md). - -### 5. Push and Create PR - -```bash -git push origin feature/my-feature -``` - -Then create a Pull Request on GitHub. - -## Adding New Commands - -To add a new command: - -1. **Create command file** in `src/dspy_cli/commands/`: - -```python -# src/dspy_cli/commands/my_command.py -import click - -@click.command() -@click.argument('name') -@click.option('--flag', is_flag=True) -def my_command(name, flag): - """Description of my command.""" - click.echo(f"Hello {name}") -``` - -2. **Register in CLI** (`src/dspy_cli/cli.py`): - -```python -from dspy_cli.commands.my_command import my_command - -main.add_command(my_command) -``` - -3. **Add tests** (`tests/test_my_command.py`): - -```python -from click.testing import CliRunner -from dspy_cli.commands.my_command import my_command - -def test_my_command(): - runner = CliRunner() - result = runner.invoke(my_command, ['World']) - assert result.exit_code == 0 - assert 'Hello World' in result.output -``` - -4. **Update documentation** (`docs/cli-reference.md`) - ## Testing Locally ### Test with Sample App @@ -316,11 +185,15 @@ Visit http://localhost:8000 to preview. - `docs/contributing.md` - This file - `mkdocs.yml` - MkDocs configuration +## Releasing + +For information on how to release new versions to PyPI, see [Releasing](releasing.md). + ## Reporting Issues Found a bug or have a feature request? -1. **Check existing issues**: [GitHub Issues](https://github.com/cmpnd-ai/optimization-platform/issues) +1. **Check existing issues**: [GitHub Issues](https://github.com/cmpnd-ai/cli-tool/issues) 2. **Create new issue** with: - Clear description - Steps to reproduce (for bugs) @@ -329,8 +202,8 @@ Found a bug or have a feature request? ## Getting Help -- **Issues**: [GitHub Issues](https://github.com/cmpnd-ai/optimization-platform/issues) -- **Discussions**: [GitHub Discussions](https://github.com/cmpnd-ai/optimization-platform/discussions) +- **Issues**: [GitHub Issues](https://github.com/cmpnd-ai/cli-tool/issues) +- **Discussions**: [GitHub Discussions](https://github.com/cmpnd-ai/cli-tool/discussions) ## Code of Conduct diff --git a/docs/deployment.md b/docs/deployment.md index e433416..914887e 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -35,6 +35,7 @@ flyctl deploy App available at `https://your-app.fly.dev` Verify: + ```bash curl -X POST "https://your-app.fly.dev/SummarizerPredict" \ -d '{"blog_post": "Test"}' -H "Content-Type: application/json" @@ -42,7 +43,7 @@ curl -X POST "https://your-app.fly.dev/SummarizerPredict" \ ## Docker Deployment -Compatible with Render, Railway, Google Cloud Run, AWS App Runner, DigitalOcean, Azure Container Instances. +Compatible with any platform that can serve arbitrary dockerfiles. ### Build and Test @@ -54,12 +55,14 @@ docker run -p 8000:8000 -e OPENAI_API_KEY=sk-... my-app:latest ### Push to Registry **Docker Hub:** + ```bash docker tag my-app:latest username/my-app:latest docker push username/my-app:latest ``` **AWS ECR:** + ```bash aws ecr get-login-password --region us-west-2 | \ docker login --username AWS --password-stdin .dkr.ecr.us-west-2.amazonaws.com @@ -68,6 +71,7 @@ docker push .dkr.ecr.us-west-2.amazonaws.com/my-app:latest ``` **Google Artifact Registry:** + ```bash gcloud auth configure-docker us-central1-docker.pkg.dev docker tag my-app:latest us-central1-docker.pkg.dev//dspy/my-app:latest @@ -78,13 +82,8 @@ docker push us-central1-docker.pkg.dev//dspy/my-app:latest **Render:** Connect GitHub repository, create Web Service, Render auto-detects Dockerfile, configure environment variables, deploy. -**Railway:** -```bash -railway up -railway variables set OPENAI_API_KEY=sk-proj-... -``` - **Google Cloud Run:** + ```bash gcloud run deploy my-app \ --source . \ @@ -93,10 +92,6 @@ gcloud run deploy my-app \ --set-env-vars OPENAI_API_KEY=sk-proj-... ``` -**AWS App Runner:** Push image to ECR, create App Runner service, configure ECR image source, set environment variables. - -**DigitalOcean:** Connect GitHub repository, App Platform detects Dockerfile, configure environment variables. - ## Environment Variables See [Configuration Reference](configuration.md) for detailed environment configuration. @@ -118,21 +113,20 @@ Configure via platform secret managers: | Platform | Command | |----------|---------| | **Fly.io** | `flyctl secrets set KEY=value` | -| **Render** | Dashboard → Environment tab | -| **Railway** | `railway variables set KEY=value` | | **Google Cloud Run** | `--set-env-vars KEY=value` or Secret Manager | | **AWS** | Systems Manager Parameter Store / Secrets Manager | -| **DigitalOcean** | App Platform → Settings | ### Secrets Best Practices **Required:** + - Store secrets in platform secret managers - Use `.env` for local development only - Rotate API keys regularly - Use separate keys per environment **Prohibited:** + - Committing `.env` to Git - Hardcoding keys in source code - Sharing production keys @@ -146,46 +140,17 @@ Verify service availability: curl https://my-app.fly.dev/openapi.json ``` -### Platform Configuration - -**Fly.io (fly.toml):** -```toml -[http_service] - internal_port = 8000 - force_https = true - - [[http_service.checks]] - grace_period = "10s" - interval = "30s" - timeout = "5s" - method = "GET" - path = "/openapi.json" -``` - -**Google Cloud Run:** -```bash -gcloud run deploy my-app \ - --timeout=300 \ - --max-instances=10 \ - --cpu=1 \ - --memory=512Mi -``` - ## Logs **Fly.io:** + ```bash flyctl logs # Stream logs flyctl logs --recent # Recent logs ``` -**Railway:** -```bash -railway logs # View logs -railway logs --follow # Stream logs -``` - **Google Cloud Run:** + ```bash gcloud logging read "resource.type=cloud_run_revision" gcloud logging tail "resource.type=cloud_run_revision" @@ -196,6 +161,7 @@ gcloud logging tail "resource.type=cloud_run_revision" **AWS App Runner:** CloudWatch Logs console Structured JSON log format: + ```json { "timestamp": "2024-01-15T10:30:45.123Z", @@ -215,6 +181,7 @@ Structured JSON log format: **Error: `uv: command not found`** Update Dockerfile: + ```dockerfile COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv ``` @@ -223,7 +190,7 @@ Or regenerate: `dspy-cli new --force` **Error: `No module named 'dspy'`** -Verify `pyproject.toml` includes `dspy>=2.5.0`, rebuild container. +Verify `pyproject.toml` includes `dspy`, rebuild container. **Error: `failed to solve with frontend dockerfile.v0`** @@ -234,9 +201,9 @@ Update Docker to 20.10+. **Error: `OPENAI_API_KEY not set`** Configure environment variable: + ```bash flyctl secrets set OPENAI_API_KEY=sk-proj-... # Fly.io -railway variables set OPENAI_API_KEY=sk-proj-... # Railway gcloud run services update my-app --set-env-vars OPENAI_API_KEY=sk-... # Cloud Run ``` @@ -244,9 +211,12 @@ gcloud run services update my-app --set-env-vars OPENAI_API_KEY=sk-... # Cloud Verify module exists with correct class name in `src//modules/`. +This can also happen when an external dependency is not added to the `pyproject.toml` file. + **Error: `500 Internal Server Error`** Check logs for: + - Missing environment variables - Model API rate limits - Invalid signature definition @@ -276,14 +246,11 @@ flyctl scale count 3 - [Configuration](configuration.md) - Model configuration and advanced settings - [OpenAPI Generation](OPENAPI.md) - OpenAPI spec and MCP integration -- [Getting Started](getting-started.md#continuous-optimization) - Production data optimization +- [Getting Started](getting-started.md) - Production data optimization - [Use Cases: AI Features](use-cases/ai-features.md) - Integration patterns ## Platform Documentation - [Fly.io](https://fly.io/docs/) -- [Render](https://render.com/docs) -- [Railway](https://docs.railway.app/) - [Google Cloud Run](https://cloud.google.com/run/docs) - [AWS App Runner](https://docs.aws.amazon.com/apprunner/) -- [DigitalOcean](https://docs.digitalocean.com/products/app-platform/) diff --git a/docs/getting-started.md b/docs/getting-started.md index e153070..c3a7538 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -31,6 +31,7 @@ dspy-cli new ``` You'll be prompted for: + - **Project name:** `email-subject` - **First program name:** `email_subject` (default, or customize) - **Module type:** Choose from Predict, ChainOfThought, ReAct, etc. @@ -40,30 +41,35 @@ You'll be prompted for: - **API Key:** Enter your key or press Enter to configure later **Expected output:** -``` -Creating new DSPy project: email-subject - Package name: email_subject - Initial program: email_subject - Module type: Predict - Signature: body, sender, context -> subject, tone, priority - Model: openai/gpt-4o-mini - -✓ Project created successfully! -``` - -### Non-Interactive Mode -```bash -dspy-cli new email-subject -s "body, sender, context -> subject, tone, priority" -cd email-subject -echo "OPENAI_API_KEY=sk-..." > .env -uv sync +```text +What is your project name? [my-project]: email-subject +Would you like to specify your first program? [Y/n]: Y +What is the name of your first DSPy program? [my_program]: email_subject +Choose a module type: + 1. Predict - Basic prediction module (default) + 2. ChainOfThought (CoT) - Step-by-step reasoning with chain of thought + 3. ProgramOfThought (PoT) - Generates and executes code for reasoning + 4. ReAct - Reasoning and acting with tools + 5. MultiChainComparison - Compare multiple reasoning paths + 6. Refine - Iterative refinement of outputs +Enter number or name [1]: 1 +Enter your signature or type '?' for guided input: + Examples: 'question -> answer', 'post:str -> tags:list[str], category:str' +Signature [question:str -> answer:str]: body, sender, context -> subject, tone, priority +Enter your model (LiteLLM format): + Examples: 'anthropic/claude-sonnet-4-5', 'openai/gpt-4o', 'ollama/llama2' +Model [openai/gpt-5-mini]: openai/gpt-5-mini +Enter your OpenAI API key: + (This will be stored in .env as OPENAI_API_KEY) + Press Enter to skip and set it manually later +OPENAI_API_KEY: your_key_here ``` ## 3. Run Locally ```bash -dspy-cli serve --ui +dspy-cli serve ``` Server starts at `http://localhost:8000` with interactive UI. @@ -80,11 +86,7 @@ Or use interactive UI at `http://localhost:8000`. ## 5. Deploy -See [Deployment Guide](deployment.md) for Fly.io, Docker, AWS, GCP, and Kubernetes instructions. - -## 6. Integrate - -Integration examples for JavaScript, Python, and other languages: [Examples](../examples/). +See [Deployment Guide](deployment.md) for Fly.io, Docker, AWS, GCP, and more. ## Development @@ -96,7 +98,7 @@ Integration examples for JavaScript, Python, and other languages: [Examples](../ - **[Deployment Guide](deployment.md)** - Production deployment, scaling, monitoring, troubleshooting - **[Configuration Reference](configuration.md)** - Model providers, advanced settings, optimization -- **[Command Reference](commands/index.md)** - Complete CLI documentation (`new`, `generate`, `serve`, `optimize`) -- **[Examples](../examples/)** - Working applications (blog-tools, code-review-agent, multi-module patterns) +- **[Command Reference](commands/index.md)** - Complete CLI documentation (`new`, `generate`, `serve`) +- **[Examples](https://github.com/cmpnd-ai/dspy-cli/tree/main/examples)** - Working applications (blog-tools, code-review-agent, multi-module patterns) - **[Project Structure](commands/new.md)** - Understand generated files and conventions - **[Module Types](commands/generate.md)** - Predict, ChainOfThought, ReAct, ProgramOfThought diff --git a/docs/index.md b/docs/index.md index 09cc406..c455db7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -72,7 +72,7 @@ curl -X POST http://localhost:8000/Rewriter \ ## Deploy -Your project includes a production-ready Docker container. Deploy to [Fly.io](deployment.md#flyio), [Render](deployment.md#render), [AWS](deployment.md#aws), or any Docker platform. See the [Deployment Guide](deployment.md). +Your project includes a production-ready Docker container. Deploy to [Fly.io](deployment.md#deployment-to-flyio), [Render](deployment.md#deploy-to-platform), [AWS](deployment.md#docker-deployment), or any Docker platform. See the [Deployment Guide](deployment.md). ## Architecture @@ -99,33 +99,33 @@ my-feature/ **Create** — Get up and running with your first DSPy module - [Getting Started](getting-started.md) -- [Examples](../examples/) +- [Examples](https://github.com/cmpnd-ai/dspy-cli/tree/main/examples) **Configure** — Environment variables and model settings - [Configuration](configuration.md) -- [Environment variables](configuration.md#environment-variables) -- [Model registry](configuration.md#model-registry) +- [Environment variables](deployment.md#environment-variables) +- [Model registry](configuration.md#registry-entry) **Deploy** — Ship to production - [Deployment Guide](deployment.md) -- [Production checklist](deployment.md#production-checklist) +- [Production checklist](deployment.md) **Operate** — Test and iterate -- [Testing UI & OpenAPI docs](getting-started.md#testing-ui) -- [Commands Reference](commands/) +- [Testing UI & OpenAPI docs](getting-started.md#3-run-locally) +- [Commands Reference](commands/index.md) ## What You Get - **Project scaffolding** — Standardized structure with DSPy signatures, modules, and Docker configs - **HTTP interface** — FastAPI endpoints with automatic module discovery and OpenAPI docs - **Hot-reload server** — Built-in testing UI with live code updates -- **Production-ready** — Deploy to any Docker platform +- **Deployment-ready** — Deploy to any Docker platform -**Defaults:** Local server at `http://localhost:8000`, testing UI at `/`, no auth (add via platform or middleware) +**Defaults:** Local server at `http://localhost:8000`, testing UI at `/` --- -Run `dspy-cli --help` for all commands. View more [examples](../examples/) on GitHub. +Run `dspy-cli --help` for all commands. View more [examples](https://github.com/cmpnd-ai/dspy-cli/tree/main/examples) on GitHub. diff --git a/docs/releasing.md b/docs/releasing.md index 15429e4..a89fdb4 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -87,6 +87,7 @@ We follow [Semantic Versioning](https://semver.org/): Tags must follow the format: `v{MAJOR}.{MINOR}.{PATCH}` Examples: + - `v0.1.0` - Initial alpha release - `v0.2.0` - New features added - `v0.2.1` - Bug fix @@ -114,11 +115,13 @@ git push origin :refs/tags/v0.1.9 ### Failed Publish If the workflow fails before publishing to PyPI: + - Fix the issue - Delete the tag: `git push origin :refs/tags/vX.Y.Z` - Re-tag and push again If the workflow succeeded but the release has issues: + - **Yank** the release on PyPI (Settings → "Yank release") - Create a new patch version (e.g., if v0.2.0 failed, release v0.2.1) - PyPI uploads are immutable - you cannot delete or replace them @@ -131,6 +134,7 @@ Error: Invalid or non-existent authentication information ``` Double-check the Trusted Publisher configuration on PyPI matches: + - Owner: `caisco` - Repository: `optimization-platform` - Workflow: `publish.yml` diff --git a/docs/use-cases/ai-features.md b/docs/use-cases/ai-features.md index 8cf894e..0b92bdc 100644 --- a/docs/use-cases/ai-features.md +++ b/docs/use-cases/ai-features.md @@ -29,27 +29,32 @@ AI features differ from chat interfaces in that they provide specific functional ## Common Use Cases -**Content Analysis** +### Content Analysis + - Document summarization that extracts key points and generates structured summaries - Technical documentation analysis that explains complex concepts - Code review assistance that identifies patterns and suggests improvements -**Classification and Categorization** +### Classification and Categorization + - Email categorization based on content, sender, and context - Content tagging systems that apply metadata automatically - Priority scoring for tasks, tickets, or messages -**Contextual Generation** +### Contextual Generation + - Smart reply generation for email and messaging applications - Form completion based on user context and historical data - Content recommendations tailored to specific situations -**Data Extraction** +### Data Extraction + - Invoice processing that extracts vendor, amount, and line items - Resume parsing that structures candidate information - Document metadata extraction from unstructured sources -**Browser Extensions** +### Browser Extensions + - Page summarizers that condense content with custom focus - Context-aware form fillers - Research assistants that analyze and annotate content @@ -63,16 +68,15 @@ AI features are invoked via HTTP POST requests with JSON payloads. Common integr - **Email clients**: Background workers call categorization endpoints - **Background automation**: Async workers process documents via API -See [Examples](../../examples/) for complete integration code. +See [Examples](https://github.com/cmpnd-ai/dspy-cli/tree/main/examples) for complete integration code. ## Implementation with dspy-cli -Create and deploy AI features: +Create and launch AI features: ```bash dspy-cli new document-summarizer -s "document -> summary, key_points" dspy-cli serve -flyctl launch ``` See [Getting Started](../getting-started.md) for complete workflow. diff --git a/mkdocs.yml b/mkdocs.yml index 6c244cf..69a3f08 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,8 +1,8 @@ site_name: dspy-cli site_description: Scaffold and serve DSPy applications with ease -site_url: https://cmpnd-ai.github.io/dspy-cli-tool/ -repo_url: https://github.com/cmpnd-ai/dspy-cli-tool -repo_name: cmpnd-ai/dspy-cli-tool +site_url: https://cmpnd-ai.github.io/dspy-cli/ +repo_url: https://github.com/cmpnd-ai/dspy-cli +repo_name: cmpnd-ai/dspy-cli edit_uri: edit/main/docs/ theme: @@ -41,7 +41,7 @@ theme: extra: social: - icon: fontawesome/brands/github - link: https://github.com/cmpnd-ai/dspy-cli-tool + link: https://github.com/cmpnd-ai/dspy-cli plugins: - search @@ -105,4 +105,5 @@ nav: - AI Features: use-cases/ai-features.md - Reference: - OpenAPI: OPENAPI.md + - Releasing: releasing.md - Contributing: contributing.md