Skip to main content

promptwatch.io python client to trace langchain sessions

Project description

PromptWatch.io ... session tracking for LangChain

It enables you to:

  • track all the chain executions
  • track LLM Prompts and re-play the LLM runs with the same input parameters and model settings to tweak your prompt template
  • track your costs per project and per tenant (your customer)

Installation

pip install promptwatch

Basic usage

In order to enable session tracking wrap you chain executions in PromptWatch block

from langchain import OpenAI, LLMChain, PromptTemplate
from promptwatch import PromptWatch

prompt_template = PromptTemplate.from_template("Finish this sentence {input}")
my_chain = LLMChain(llm=OpenAI(), prompt=prompt_template)

with PromptWatch(api_key="<your-api-key>") as pw:
    my_chain("The quick brown fox jumped over")

Here you can get your API key: http://www.promptwatch.io/get-api-key (no registration needed)

You can set it directly into PromptWatch constructor, or set is as an ENV variable PROMPTWATCH_API_KEY

Comprehensive Chain Execution Tracking

With PromptWatch.io, you can track all chains, actions, retrieved documents, and more to gain complete visibility into your system. This makes it easy to identify issues with your prompts and quickly fix them for optimal performance.

What sets PromptWatch.io apart is its intuitive and visual interface. You can easily drill down into the chains to find the root cause of any problems and get a clear understanding of what's happening in your system.

Read more here: Chain tracing documentation

LLM Prompt caching

It is often tha case that some of the prompts are repeated over an over. It is costly and slow. With PromptWatch you just wrap your LLM model into our CachedLLM interface and it will automatically reuse previously generated values.

Read more here: Prompt caching documentation

LLM Prompt Template Tweaking

Tweaking prompt templates to find the optimal variation can be a time-consuming and challenging process, especially when dealing with multi-stage LLM chains. Fortunately, PromptWatch.io can help simplify the process!

With PromptWatch.io, you can easily experiment with different prompt variants by replaying any given LLM chain with the exact same inputs used in real scenarios. This allows you to fine-tune your prompts until you find the variation that works best for your needs.

Read more here: Prompt tweaking documentation

Keep Track of Your Prompt Template Changes

Making changes to your prompt templates can be a delicate process, and it's not always easy to know what impact those changes will have on your system. Version control platforms like GIT are great for tracking code changes, but they're not always the best solution for tracking prompt changes.

Read more here: Prompt template versioning documentation

Unit testing

Unit tests will help you understand what impact your changes in Prompt templates and your code can have on representative sessions examples.

Read more here: Unit tests documentation

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

promptwatch-0.1.1.tar.gz (30.4 kB view details)

Uploaded Source

Built Distribution

promptwatch-0.1.1-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file promptwatch-0.1.1.tar.gz.

File metadata

  • Download URL: promptwatch-0.1.1.tar.gz
  • Upload date:
  • Size: 30.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.16

File hashes

Hashes for promptwatch-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a66bd3121a649b4791f75dcae558f5b40085b91cb22905795595b330c315409b
MD5 0b5f1f4f1fca267610d764a33f0ebb5a
BLAKE2b-256 b13bb77bc742ff09349460843c78ce937b8ba1099c4baa417a39a7767b8a974a

See more details on using hashes here.

File details

Details for the file promptwatch-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: promptwatch-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 35.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.16

File hashes

Hashes for promptwatch-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a353185883323bd735574cf66cd6e1733271493742748096bc8543ddcb25c4fd
MD5 19bb9f1f22b63e3d17f308d133511020
BLAKE2b-256 541121a53ed286b9688dead15da349900de4e40d209948c9d59b65b039c9dd8f

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