|
| 1 | +# OpenLLMetry Repository Guide |
| 2 | + |
| 3 | +## Repository Structure |
| 4 | +This repository contains multiple PyPI-publishable packages organized and orchestrated using Nx workspace management. |
| 5 | + |
| 6 | +### Nx Workspace Commands |
| 7 | +```bash |
| 8 | +# Run tests across all packages |
| 9 | +nx run-many -t test |
| 10 | + |
| 11 | +# Run linting across all packages |
| 12 | +nx run-many -t lint |
| 13 | + |
| 14 | +# Update lock files across all packages |
| 15 | +nx run-many -t lock |
| 16 | + |
| 17 | +# Run specific targets on specific packages |
| 18 | +nx run <package-name>:test |
| 19 | +nx run <package-name>:lint |
| 20 | + |
| 21 | +# Show project graph |
| 22 | +nx graph |
| 23 | + |
| 24 | +# Show what's affected by changes |
| 25 | +nx affected:test |
| 26 | +nx affected:lint |
| 27 | +``` |
| 28 | + |
| 29 | +## Package Management |
| 30 | +All packages use Poetry as the package manager. Always execute commands through Poetry: |
| 31 | +```bash |
| 32 | +poetry run <command> |
| 33 | +``` |
| 34 | + |
| 35 | +## Testing with VCR Cassettes |
| 36 | +Tests utilize VCR cassettes for API calls. |
| 37 | + |
| 38 | +### Commands |
| 39 | +```bash |
| 40 | +# Run tests normally (uses existing cassettes) |
| 41 | +poetry run pytest tests/ |
| 42 | + |
| 43 | +# Re-record all cassettes (requires API keys) |
| 44 | +poetry run pytest tests/ --record-mode=all |
| 45 | + |
| 46 | +# Record only new test episodes |
| 47 | +poetry run pytest tests/ --record-mode=new_episodes |
| 48 | + |
| 49 | +# Record cassettes once (if they don't exist) |
| 50 | +poetry run pytest tests/ --record-mode=once |
| 51 | + |
| 52 | +# Run tests without recording (fails if cassettes missing) |
| 53 | +poetry run pytest tests/ --record-mode=none |
| 54 | + |
| 55 | +# Run specific test files |
| 56 | +poetry run pytest tests/test_agents.py --record-mode=once |
| 57 | +``` |
| 58 | + |
| 59 | +### Guidance |
| 60 | +Re-record cassettes when API interactions change to ensure test accuracy. |
| 61 | +Never commit secrets or PII. Scrub them using VCR filters (e.g., filter_headers, before_record) or your test framework's equivalent. |
| 62 | +Store API keys only in environment variables/secure vaults; never in code or cassettes. |
| 63 | +Typical record modes you may use: once, new_episodes, all, none (choose per test needs). |
| 64 | +Creating new cassettes requires valid API keys (OpenAI, Anthropic, etc.); ask the user to provide them if needed. |
| 65 | + |
| 66 | +## Semantic Conventions |
| 67 | +The semantic convention package follows the OpenTelemetry GenAI specification: |
| 68 | +https://opentelemetry.io/docs/specs/semconv/gen-ai/ |
| 69 | + |
| 70 | +## Instrumentation Packages |
| 71 | +Instrumentation packages should leverage the semantic conventions package. Their purpose is to instrument AI-related libraries and generate spans and tracing data compliant with OpenTelemetry semantic conventions. |
| 72 | + |
| 73 | +## Code Quality |
| 74 | +Flake8 is used for code linting. |
0 commit comments