Skip to main content

Text Analytics for LLM apps

Project description

phospho Python Client

Phospho is an open source 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.9

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.

phospho lab

You can also use phospho locally to run evaluations and event detection on your text messages. See the phospho lab documentation for more information or the notebook quicksart.ipynb in the notebooks folder.

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.3.38.tar.gz (54.9 kB view details)

Uploaded Source

Built Distribution

phospho-0.3.38-py3-none-any.whl (62.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: phospho-0.3.38.tar.gz
  • Upload date:
  • Size: 54.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure

File hashes

Hashes for phospho-0.3.38.tar.gz
Algorithm Hash digest
SHA256 6c9ce57fbe7b6ced87850ecc4b1c88c591fe783249a93fe7489bb12ac1e04475
MD5 de6e7d20e97872d01a56726c60b4935a
BLAKE2b-256 ee051e46da34332463c6d1074bc584cdecc0cf227fff20bb2d1105d903df16e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: phospho-0.3.38-py3-none-any.whl
  • Upload date:
  • Size: 62.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Linux/6.5.0-1025-azure

File hashes

Hashes for phospho-0.3.38-py3-none-any.whl
Algorithm Hash digest
SHA256 3598e1375078a7d2d3edb1db893359343744fdf66f0708dfb34776397c97778f
MD5 9acc3c8c4784aa9e6eea3b6afb14912e
BLAKE2b-256 25754d474ab0d1d3a18ea6115096383601d54a1c013e688d30758cb296f46e51

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