Phoenix supports loading data that contains OpenInference traces. This allows you to load an existing dataframe of traces into your Phoenix instance.
Usually these will be traces you’ve previously saved using Save All Traces.
Connect to Phoenix
Point your code at the Phoenix instance you started. The endpoint below is the default for a local phoenix serve; for a deployment running elsewhere, use its hostname instead.
import osos.environ["PHOENIX_COLLECTOR_ENDPOINT"] = "http://localhost:6006"# Only if the deployment has authentication enabled# os.environ["PHOENIX_API_KEY"] = "your-api-key"
Importing Traces to an Existing Phoenix Instance
import phoenix as px# Re-launch the app using trace datapx.launch_app(trace=px.TraceDataset(df))# Load traces into an existing Phoenix instance from a local filepx.launch_app(trace=px.TraceDataset.load('f7733fda-6ad6-4427-a803-55ad2182b662', directory="/my_saved_traces/"))
Launching a new Phoenix Instance with Saved Traces
You can also launch a temporary version of Phoenix in your local notebook to quickly view the traces. But be warned, this Phoenix instance will only last as long as your notebook environment is running
# Load traces from a dataframepx.launch_app(trace=px.TraceDataset.load(my_traces))# Load traces from a local filepx.launch_app(trace=px.TraceDataset.load('f7733fda-6ad6-4427-a803-55ad2182b662', directory="/my_saved_traces/"))