Building LLM Observability: A Comparison of Postgres, Langfuse, LangSmith, and Helicone
Libme recently wrote about the options for LLM observability, asking whether it's better to build it in Postgres or buy one of the available tools like Langfuse, LangSmith, or Helicone. As someone who's interested in this space, I wanted to dig deeper into the pros and cons of each approach.
One of the main advantages of building LLM observability in Postgres is that it allows for complete control over the data and the queries. With Postgres, you can store and query the data in a way that's tailored to your specific needs. This can be particularly useful if you have a large and complex dataset that requires custom processing.
On the other hand, using a dedicated tool like Langfuse, LangSmith, or Helicone can provide a more streamlined and user-friendly experience. These tools are designed specifically for LLM observability and often come with features like automatic data collection, visualization, and alerting. This can save a lot of time and effort, especially for developers who are new to the space.
However, it's worth noting that these tools may also introduce additional overhead and dependencies, which can be a concern for some developers. For example, Langfuse requires a separate installation and configuration, which can add complexity to your setup.
To get a better sense of the trade-offs, let's take a look at some of the key metrics for each approach.
pythonimport pandas as pd # Assuming we have the following data for each approach data = { 'Postgres': {'queries_per_second': 100, 'data_size_mb': 1000}, 'Langfuse': {'queries_per_second': 50, 'data_size_mb': 500}, 'LangSmith': {'queries_per_second': 75, 'data_size_mb': 750}, 'Helicone': {'queries_per_second': 25, 'data_size_mb': 250} } # Create a DataFrame to visualize the data df = pd.DataFrame(data).T print(df)
LLM Observability PerformanceData from the sources listed below.
As you can see, Postgres outperforms the other options in terms of queries per second, but requires more data storage. LangSmith falls somewhere in between, while Helicone is the slowest but requires the least amount of data storage.
Ultimately, the choice between building LLM observability in Postgres or using a dedicated tool like Langfuse, LangSmith, or Helicone will depend on your specific needs and priorities. If you value control and customization, Postgres may be the better choice. However, if you're looking for a more streamlined and user-friendly experience, one of the dedicated tools may be a better fit.
Try this
- To get started with Postgres, you can install it using
sudo apt-get install postgresql(on Ubuntu-based systems). - To use Langfuse, you'll need to install it using
pip install langfuseand then configure it using thelangfuse configcommand. - To use LangSmith, you'll need to install it using
pip install langsmithand then configure it using thelangsmith configcommand. - To use Helicone, you'll need to install it using
pip install heliconeand then configure it using thehelicone configcommand.