Skip to main content

Analytics for LLM apps

Project description

phospho Python Client

With phospho, you can 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.1.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

phospho-0.2.1-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: phospho-0.2.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.8 Darwin/20.6.0

File hashes

Hashes for phospho-0.2.1.tar.gz
Algorithm Hash digest
SHA256 e2e45e57787871b72fc8ad3dd7a5ed8c68d41790eec1e31a20ac83067d8717dd
MD5 35ed977b099fd5e19027a0f9a77ba340
BLAKE2b-256 c42e25bf76b20a1261b83d8e3fb1420c139653c15815943d375cbd804afcb111

See more details on using hashes here.

File details

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

File metadata

  • Download URL: phospho-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.8.8 Darwin/20.6.0

File hashes

Hashes for phospho-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 52ba4e0045a8f41b2dbbc677bc567a14bd1de5020e0011dc1c686fa7fb9c1172
MD5 a8812ddc5476a146ebf66eb3e5fb72ed
BLAKE2b-256 3ef09593842b6cb02771f5f28737bd7607f58c535a3168e47c7a9a3c665413de

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