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.ai.

Warning : This project is still under active development!

Installation of the phospho client

You need Python >=3.8

pip install --upgrade phospho

Quickstart

Create an account on phospho. Create an API key and note down the project id. Set them as environment variables:

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

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

import phospho

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.ai 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.14.tar.gz (25.3 kB view details)

Uploaded Source

Built Distribution

phospho-0.2.14-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: phospho-0.2.14.tar.gz
  • Upload date:
  • Size: 25.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1019-azure

File hashes

Hashes for phospho-0.2.14.tar.gz
Algorithm Hash digest
SHA256 a30a5cf6bc09cc1a9179b5cead143020646520aa492cab4b95d81836baf28000
MD5 3a7f34e43030b8c311f77a974af3763e
BLAKE2b-256 35133f72a5362bce466612c0b6676e3120c32515e7dfdb7d0abe329fe7e16991

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for phospho-0.2.14-py3-none-any.whl
Algorithm Hash digest
SHA256 c59d287b696588b1d1e8fa78086b12cf43d383a9d26c8218a5eff7d9e37037d5
MD5 29539326dd84e06c3a0c80e3d11bac5c
BLAKE2b-256 c2e61f0a1894b8e5e61ba461660b579cd6aa6d5cd328761f31debe6ce93238b4

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