Co-authored-by: Ankush Gola <9536492+agola11@users.noreply.github.com>
1.6 KiB
Locally Hosted Setup
This page contains instructions for installing and then setting up the environment to use the locally hosted version of tracing.
Installation
-
Ensure you have Docker installed (see Get Docker) and that it’s running.
-
Install the latest version of
langchain
:pip install langchain
orpip install langchain -U
to upgrade your existing version. -
Run
langchain-server
- This will spin up the server in the terminal.
- Once you see the terminal
output
langchain-langchain-frontend-1 | ➜ Local: [http://localhost:4173/](http://localhost:4173/)
, navigate to http://localhost:4173/
-
You should see a page with your tracing sessions. See the overview page for a walkthrough of the UI.
-
Currently, trace data is not guaranteed to be persisted between runs of
langchain-server
. If you want to persist your data, you can mount a volume to the Docker container. See the Docker docs for more info. -
To stop the server, press
Ctrl+C
in the terminal where you ranlangchain-server
.
Environment Setup
After installation, you must now set up your environment to use tracing.
This can be done by setting an environment variable in your terminal by running export LANGCHAIN_HANDLER=langchain
.
You can also do this by adding the below snippet to the top of every script. IMPORTANT: this must go at the VERY TOP of your script, before you import anything from langchain
.
import os
os.environ["LANGCHAIN_HANDLER"] = "langchain"