Skip to main content

Analytics for LLM apps

Project description

phospho Python Client

Phospho is a platform to help you monitor LLM apps.

With phospho, monitor every user interaction with your LLM app to identify issues and improve performance. Understand how users use your app and which versions of your product are the most successful.

Read the docs at docs.phospho.app.

Warning : This project is still under active development!

Installation of the phospho client

You need Python >=3.8

pip install --upgrade phospho

Quickstart

Create a phospho account and go to the phospho dashboard. Create a project. In your project settings, create an API key. Set them as environment variables:

export PHOSPHO_PROJECT_ID="project-id"
export PHOSPHO_API_KEY="your-api-key"

In the code of your LLM app, log interactions with your agent using phospho.log().

import phospho

# Your project id and api key are set as environment variables
phospho.init()

# This is how you log interactions to phospho as strings
phospho.log(input="The user input", output="Your LLM app output")

You can also directly pass OpenAI API query and responses (or any object with same format) to phospho :

import phospho
import openai

phospho.init()
openai_client = openai.OpenAI()

# This is your agent code
query = {
    "messages": [{"role": "user", "content": "The user input"}], 
    "model": "gpt-3.5-turbo", 
}
response = openai_client.chat.completions.create(**query)

# Log the interactions to phospho
phospho.log(input=query, output=response)

Monitor and visualize your agent on the phospho dashboard.

Usage

Read the docs at docs.phospho.app for more information. Use your phospho dashboard to monitor your agent, score interactions and detect events.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phospho-0.2.2.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

phospho-0.2.2-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file phospho-0.2.2.tar.gz.

File metadata

  • Download URL: phospho-0.2.2.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Linux/6.2.0-1016-azure

File hashes

Hashes for phospho-0.2.2.tar.gz
Algorithm Hash digest
SHA256 1c221a23ddee18b8f28669b2bb3bd17c34722ee74e6bb875d609b763d3a0bed6
MD5 b6e8803288d4d2735da515f47eb2c07b
BLAKE2b-256 8b60efcd483ae1cfb529576f80974c91fd6c7279cf5c931c0895e8a9d83aa363

See more details on using hashes here.

File details

Details for the file phospho-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: phospho-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 19.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.0 Linux/6.2.0-1016-azure

File hashes

Hashes for phospho-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0a73e1b67a56b9f93f4c8f348b5c0a46aaa43c978d7a36fd25b9bc6fe7ca1040
MD5 065d85b95a84d5b3f0852cadb0277df1
BLAKE2b-256 6e26dac82d871a48a4d4e7a49fa0cfdf195b6d65ba95c5a970814145696dded3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page