|
6 | 6 | </p> |
7 | 7 |
|
8 | 8 | <h3 align="center"> |
9 | | -Open, modular framework to build GenAI applications. |
| 9 | +Open, modular framework to build and optimize GenAI applications |
10 | 10 | </h3> |
11 | 11 |
|
12 | 12 | [](https://github.com/mkenney/software-guides/blob/master/STABILITY-BADGES.md#alpha) |
13 | 13 | [](https://github.com/inftyai/alphatrion/releases/latest) |
14 | 14 |
|
15 | | -**AlphaTrion** is an open-source framework to help build GenAI applications, including experiment tracking, adaptive model routing, prompt optimization, performance evaluation and so on. The name comes after the oldest and wisest Transformer - AlphaTrion. |
| 15 | +**AlphaTrion** is an open-source framework for building and optimizing GenAI applications. Track experiments, monitor performance, analyze model usage, and manage artifacts—all through an intuitive dashboard. Named after the oldest and wisest Transformer. |
16 | 16 |
|
17 | | -*Still under active development.* |
| 17 | +*Currently in active development.* |
18 | 18 |
|
19 | | -## Concepts |
| 19 | +## Features |
20 | 20 |
|
21 | | -- **Team**: A Team is the highest-level organizational unit in AlphaTrion. It represents a group of users collaborating on experiments. |
22 | | -- **Experiment**: An Experiment is a logic-level abstraction for organizing and managing a series of related runs. It allows users to group runs that share a common purpose or configuration. Experiments can be organized using labels. |
23 | | -- **Run**: A Run is a real execution instance of an experiment. It represents the actual execution of the code with the specified configuration and hyperparameters defined in the experiment. |
| 21 | +- **🔬 Experiment Tracking** - Organize and manage ML experiments with hierarchical teams, experiments, and runs |
| 22 | +- **📊 Performance Monitoring** - Track metrics, visualize trends, and monitor experiment status in real-time |
| 23 | +- **🔍 Distributed Tracing** - Automatic OpenTelemetry integration for LLM calls with detailed span analysis |
| 24 | +- **💰 Token Usage Analytics** - Monitor daily token consumption across input/output with historical trends |
| 25 | +- **🤖 Model Distribution** - Analyze request patterns and usage across different AI models |
| 26 | +- **📦 Artifact Management** - Store and version execution results, checkpoints, and model outputs |
| 27 | +- **🎯 Interactive Dashboard** - Modern web UI for exploring experiments, metrics, and traces |
| 28 | +- **🔌 Easy Integration** - Simple Python API with async/await support |
| 29 | + |
| 30 | +## Core Concepts |
| 31 | + |
| 32 | +- **Team** - Top-level organizational unit for user collaboration |
| 33 | +- **Experiment** - Logical grouping of runs with shared purpose, organized by labels |
| 34 | +- **Run** - Individual execution instance with configuration and metrics |
24 | 35 |
|
25 | 36 | ## Quick Start |
26 | 37 |
|
27 | | -### Install from PyPI |
| 38 | +### 1. Installation |
28 | 39 |
|
29 | 40 | ```bash |
| 41 | +# From PyPI |
30 | 42 | pip install alphatrion |
31 | | -``` |
32 | | - |
33 | | -### Install from Source |
34 | | - |
35 | | -* Git clone the repository |
36 | | -* Run `source start.sh` to activate the virtual environment. |
37 | | - |
38 | 43 |
|
39 | | -### Initialize the Environment |
40 | | - |
41 | | -Run the following command for setup: |
42 | | - |
43 | | -```bash |
44 | | -cp .env.example .env & make up |
| 44 | +# Or from source |
| 45 | +git clone https://github.com/inftyai/alphatrion.git && cd alphatrion |
| 46 | +source start.sh |
45 | 47 | ``` |
46 | | -You can login to pgAdmin at `http://localhost:8081` to see the Postgres database with following credentials. Remember to register the server first. |
47 | | - |
48 | | -```shell |
49 | | -Email: alphatrion@inftyai.com |
50 | | -Password: alphatr1on |
51 | | -ServerName: alphatrion |
52 | | -HostName: postgres |
53 | | -ServerPWD: alphatr1on |
54 | | -``` |
55 | | - |
56 | | -You can also visit the Docker Registry UI at `http://localhost:80` to see the local registry where the built images are stored. |
57 | 48 |
|
58 | | -Next, init the environment with a user and team: |
| 49 | +### 2. Setup Infrastructure |
59 | 50 |
|
60 | 51 | ```bash |
61 | | -alphatrion init # see -h for options to specify username, email and team name |
| 52 | +# Start PostgreSQL, ClickHouse, and Registry |
| 53 | +cp .env.example .env |
| 54 | +make up |
| 55 | + |
| 56 | +# Initialize your team and user |
| 57 | +alphatrion init # Use -h for custom options |
62 | 58 | ``` |
63 | 59 |
|
64 | | -You will see the generated user ID in the console. Use this ID to initialize the AlphaTrion environment in your code later. |
| 60 | +Save the generated user ID—you'll need it to track experiments. |
65 | 61 |
|
66 | | -### Run a Simple Experiment |
| 62 | +**Optional Tools:** |
| 63 | +- pgAdmin: `http://localhost:8081` (alphatrion@inftyai.com / alphatr1on) |
| 64 | +- Registry UI: `http://localhost:80` |
67 | 65 |
|
68 | | -Below is a simple example with two approaches demonstrating how to create an experiment and log performance metrics. |
| 66 | +### 3. Track Your First Experiment |
69 | 67 |
|
70 | 68 | ```python |
71 | 69 | import alphatrion as alpha |
72 | 70 | from alphatrion import experiment |
73 | 71 |
|
74 | | -# Use the user ID generated from the `alphatrion init` command. |
75 | | -alpha.init(user_id=<user_id>) |
| 72 | +# Initialize with your user ID |
| 73 | +alpha.init(user_id="<your_user_id>") |
76 | 74 |
|
77 | | -async def your_task(): |
78 | | - # Run your code here then log metrics. |
79 | | - await alpha.log_metrics({"accuracy": 0.95}) |
| 75 | +async def my_task(): |
| 76 | + # Your ML code here |
| 77 | + await alpha.log_metrics({"accuracy": 0.95, "loss": 0.12}) |
80 | 78 |
|
81 | 79 | async with experiment.CraftExperiment.start(name="my_experiment") as exp: |
82 | | - task = exp.run(your_task) # use lambda or partial if you need to pass arguments to your_task |
83 | | - await task.wait() |
| 80 | + task = exp.run(my_task) |
| 81 | + await task.wait() |
84 | 82 | ``` |
85 | 83 |
|
86 | | -### View Dashboard |
87 | | - |
88 | | - |
89 | | - |
90 | | -The dashboard provides a web interface to explore experiments, runs, and metrics through an intuitive UI. |
91 | | - |
92 | | -#### Launch Dashboard |
| 84 | +### 4. Launch Dashboard |
93 | 85 |
|
94 | 86 | ```bash |
95 | | -# Start the backend server (in one terminal) |
| 87 | +# Start backend server (terminal 1) |
96 | 88 | alphatrion server |
97 | 89 |
|
98 | | -# Launch the dashboard (in another terminal) |
| 90 | +# Launch dashboard (terminal 2) |
99 | 91 | alphatrion dashboard |
100 | 92 | ``` |
101 | 93 |
|
102 | | -The dashboard will automatically open in your browser at `http://127.0.0.1:5173`. |
103 | | - |
104 | | -**Options:** |
105 | | -- `--port <PORT>`: Run on a custom port (default: 5173) |
| 94 | +Access the dashboard at `http://127.0.0.1:5173` to explore experiments, visualize metrics, and analyze traces. |
106 | 95 |
|
107 | | -**Documentation:** |
108 | | -- [Dashboard Setup Guide](./docs/dashboard/setup.md) - Complete setup and troubleshooting guide |
109 | | -- [Dashboard CLI Guide](./docs/dashboard/dashboard-cli.md) - Using the dashboard CLI command |
110 | | -- [Dashboard Architecture](./docs/dashboard/dashboard-architecture.md) - Technical architecture and deployment patterns |
| 96 | + |
111 | 97 |
|
112 | | -### Tracing |
| 98 | +### 5. View Traces |
113 | 99 |
|
114 | | -AlphaTrion automatically captures tracing data for all runs, including spans for each run and associated metadata. You can query this data to analyze model performance, latency, and token usage. |
| 100 | +AlphaTrion automatically captures distributed tracing data for all LLM calls, including latency, token usage, and span relationships. |
115 | 101 |
|
116 | 102 |  |
117 | 103 |
|
| 104 | +### 6. Other APIs |
| 105 | + |
| 106 | +- **log_params**: Track hyperparameters and configuration settings |
| 107 | +- **log_metrics**: Record performance metrics and visualize trends |
| 108 | +- **log_artifacts**: Store and manage files, checkpoints, and model outputs |
| 109 | + |
| 110 | + |
118 | 111 | ### Cleanup |
119 | 112 |
|
120 | 113 | ```bash |
121 | 114 | make down |
122 | 115 | ``` |
123 | 116 |
|
| 117 | +## Documentation |
| 118 | + |
| 119 | +- **Dashboard**: [Setup Guide](./docs/dashboard/setup.md) | [CLI Reference](./docs/dashboard/dashboard-cli.md) | [Architecture](./docs/dashboard/dashboard-architecture.md) |
| 120 | +- **Development**: [Contributing Guide](./docs/dev/development.md) |
| 121 | + |
124 | 122 | ## Contributing |
125 | 123 |
|
126 | | -We welcome contributions! Please refer to [developer.md](./docs/dev/development.md) for more information on how to set up your development environment and contribute to the project. |
| 124 | +We welcome contributions! Check out our [development guide](./docs/dev/development.md) to get started. |
127 | 125 |
|
128 | 126 | [](https://www.star-history.com/#inftyai/alphatrion&Date) |
0 commit comments