|
1 | | -# Enabling LM Tracing |
| 1 | +# Enabling LM Tracing with Arize Phoenix |
2 | 2 |
|
3 | 3 | Tracing is important for several reasons, especially in the context of machine learning and software development. It helps identify issues and bugs in your Synalinks programs by providing a detailed log of events and operations. This makes it easier to pinpoint where things went wrong and why. |
4 | 4 |
|
5 | | -To install MLflow, an open-source tracing software, use the following: |
| 5 | +In this guide we are going to setup the tracing locally, for more information on how to setup in the cloud, refer to [Arize Phoenix documentation](https://docs.arize.com/phoenix) |
6 | 6 |
|
7 | 7 | ```shell |
8 | | -pip install mlflow |
| 8 | +uv pip install openinference-instrumentation-litellm arize-otel |
9 | 9 | ``` |
10 | 10 |
|
11 | 11 | To activate the LM tracing, add the following lines to the top of your script |
12 | 12 |
|
13 | 13 | ```python |
14 | | -import mlflow |
15 | | - |
16 | | -mlflow.litellm.autolog() |
17 | | -# Set this to your MLflow server |
18 | | -mlflow.set_tracking_uri("http://localhost:5000") |
| 14 | +# Import open-telemetry dependencies |
| 15 | +from arize.otel import register |
| 16 | +from openinference.instrumentation.litellm import LiteLLMInstrumentor |
| 17 | + |
| 18 | +# Setup OTel via Arize Phoenix convenience function |
| 19 | +tracer_provider = register( |
| 20 | + space_id = "your-space-id", # in app space settings page |
| 21 | + api_key = "your-api-key", # in app space settings page |
| 22 | + project_name = "your-project-name", # name this to whatever you would like |
| 23 | +) |
| 24 | + |
| 25 | +LiteLLMInstrumentor().instrument(tracer_provider=tracer_provider) |
19 | 26 | ``` |
20 | 27 |
|
21 | 28 | You are done, MLflow is now configured. |
22 | 29 |
|
23 | | -To launch MLflow server, use the following command in a shell |
| 30 | +To launch Arize Phoenix server, first pull the docker image with the following command. |
| 31 | + |
| 32 | +```shell |
| 33 | +docker pull arizephoenix/phoenix |
| 34 | +``` |
| 35 | + |
| 36 | +Then use the following command in a shell |
24 | 37 |
|
25 | 38 | ```shell |
26 | | -mlflow server --host 127.0.0.1 --port 5000 |
| 39 | +docker run -p 6006:6006 -p 4317:4317 -i -t arizephoenix/phoenix:latest |
27 | 40 | ``` |
28 | 41 |
|
29 | | -You can find more information about the server configuration [here](https://mlflow.org/docs/latest/tracking/server.html). |
| 42 | +Finally go to `http://0.0.0.0:6006` to monitor your application. |
0 commit comments