# 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](https://docs.phospho.ai/).
> _Warning_ : This project is still under active development!
## Installation of the phospho client
You need Python `>=3.9`
```bash
pip install --upgrade phospho
```
## Quickstart
Create an account on [phospho](https://platform.phospho.ai/). Create an API key and note down the project id. Set them as environment variables:
```bash
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()`.
```python
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 :
```python
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](https://platform.phospho.ai/).
## phospho lab
You can also use phospho locally to run evaluations and event detection on your text messages.
See the [phospho lab documentation](https://docs.phospho.ai/local/phospho-lab) for more information or the notebook `quicksart.ipynb` in the `notebooks` folder.
## Usage
Read the docs at [docs.phospho.ai](https://docs.phospho.ai/) for more information.
Use your phospho dashboard to monitor your agent, score interactions and detect events.
Raw data
{
"_id": null,
"home_page": "https://github.com/phospho-app/phospho",
"name": "phospho",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "LLM, Agents, gen ai, phospho, analytics, nlp",
"author": "phospho",
"author_email": "contact@phospho.ai",
"download_url": "https://files.pythonhosted.org/packages/68/e8/16bfa4203cc3d93e3d2631c3a627321e638d4985193655efdcee20cc3ade/phospho-0.3.42.tar.gz",
"platform": null,
"description": "# phospho Python Client\n\nPhospho is an open source platform to help you monitor LLM apps.\n\nWith 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.\n\nRead the docs at [docs.phospho.ai](https://docs.phospho.ai/).\n\n> _Warning_ : This project is still under active development!\n\n## Installation of the phospho client\n\nYou need Python `>=3.9`\n\n```bash\npip install --upgrade phospho\n```\n\n## Quickstart\n\nCreate an account on [phospho](https://platform.phospho.ai/). Create an API key and note down the project id. Set them as environment variables:\n\n```bash\nexport PHOSPHO_API_KEY=\"your-api-key\"\nexport PHOSPHO_PROJECT_ID=\"project-id\"\n```\n\nIn the code of your LLM app, log interactions with your agent using `phospho.log()`.\n\n```python\nimport phospho\n\nphospho.init()\n\n#\u00a0This is how you log interactions to phospho as strings\nphospho.log(input=\"The user input\", output=\"Your LLM app output\")\n\n```\n\nYou can also directly pass OpenAI API query and responses (or any object with same format) to phospho :\n\n```python\nimport phospho\nimport openai\n\nphospho.init()\nopenai_client = openai.OpenAI()\n\n#\u00a0This is your agent code\nquery = {\n \"messages\": [{\"role\": \"user\", \"content\": \"The user input\"}],\n \"model\": \"gpt-3.5-turbo\",\n}\nresponse = openai_client.chat.completions.create(**query)\n\n#\u00a0Log the interactions to phospho\nphospho.log(input=query, output=response)\n```\n\nMonitor and visualize your agent on the [phospho dashboard](https://platform.phospho.ai/).\n\n## phospho lab\n\nYou can also use phospho locally to run evaluations and event detection on your text messages.\nSee the [phospho lab documentation](https://docs.phospho.ai/local/phospho-lab) for more information or the notebook `quicksart.ipynb` in the `notebooks` folder.\n\n## Usage\n\nRead the docs at [docs.phospho.ai](https://docs.phospho.ai/) for more information.\nUse your phospho dashboard to monitor your agent, score interactions and detect events.\n",
"bugtrack_url": null,
"license": null,
"summary": "Text Analytics for LLM apps",
"version": "0.3.42",
"project_urls": {
"Documentation": "https://docs.phospho.ai",
"Homepage": "https://github.com/phospho-app/phospho"
},
"split_keywords": [
"llm",
" agents",
" gen ai",
" phospho",
" analytics",
" nlp"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ca45d290ec9f289c20f75c908086c559b26673df902d87ca2a2877c6f635ba92",
"md5": "861354d1b5b3042fca331095bc0cb666",
"sha256": "d95c1385cc9619ad0a9a482eaa02a0a14c5b0ed84c5a85d8598ea991be744524"
},
"downloads": -1,
"filename": "phospho-0.3.42-py3-none-any.whl",
"has_sig": false,
"md5_digest": "861354d1b5b3042fca331095bc0cb666",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 63586,
"upload_time": "2024-10-26T11:42:17",
"upload_time_iso_8601": "2024-10-26T11:42:17.982882Z",
"url": "https://files.pythonhosted.org/packages/ca/45/d290ec9f289c20f75c908086c559b26673df902d87ca2a2877c6f635ba92/phospho-0.3.42-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "68e816bfa4203cc3d93e3d2631c3a627321e638d4985193655efdcee20cc3ade",
"md5": "405cd743cbe7aa77e7da8b367de15274",
"sha256": "285eef4100b1b2fbbafdee957111da99b8716ef643126c218bd35bffe2b71908"
},
"downloads": -1,
"filename": "phospho-0.3.42.tar.gz",
"has_sig": false,
"md5_digest": "405cd743cbe7aa77e7da8b367de15274",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 55949,
"upload_time": "2024-10-26T11:42:19",
"upload_time_iso_8601": "2024-10-26T11:42:19.309062Z",
"url": "https://files.pythonhosted.org/packages/68/e8/16bfa4203cc3d93e3d2631c3a627321e638d4985193655efdcee20cc3ade/phospho-0.3.42.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-26 11:42:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "phospho-app",
"github_project": "phospho",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "phospho"
}