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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file phospho-0.3.33.tar.gz
.
File metadata
- Download URL: phospho-0.3.33.tar.gz
- Upload date:
- Size: 53.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3a3f95af2e8e5761ef51b8e60a117d38d1b2bc902899fec6c7e295f671a2b7c |
|
MD5 | 907ab149aadb3f448c3cfac017e8cd47 |
|
BLAKE2b-256 | ac41e9a9a80b2b9c28c907092312f07b93ebcac69f0367ec4168efd8fc2fc083 |
File details
Details for the file phospho-0.3.33-py3-none-any.whl
.
File metadata
- Download URL: phospho-0.3.33-py3-none-any.whl
- Upload date:
- Size: 61.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c3bdefe10b15e072ea73e381d0b19dabccf1343cceda0a74e856681bddab616 |
|
MD5 | ca9f74214d2b6795f86223bfd7a1b44f |
|
BLAKE2b-256 | 61a9fb902f3ffd54d0dd8df3c1fe8a5594c97f5e8ff8577463cc9e880e71b784 |