Skip to main content

Python SDK for LangWatch for monitoring your LLMs

Project description

LangWatch Python SDK

Go to https://langwatch.ai to setup your account.

To trace OpenAI calls:

from openai import OpenAI
+ import langwatch.openai

client = OpenAI()

+ with langwatch.openai.OpenAITracer(client):
    completion = client.chat.completions.create(
        model="gpt-3.5-turbo",
        messages=[
            {
                "role": "system",
                "content": "You are a helpful assistant that only reply in short tweet-like responses, using lots of emojis.",
            },
            {"role": "user", "content": message},
        ],
        stream=True,
    )

To trace LangChain agent:

+ import langwatch.langchain

  # ...

  chain = LLMChain(
      llm=ChatOpenAI(),
      prompt=chat_prompt,
      output_parser=CommaSeparatedListOutputParser(),
  )
+ with langwatch.langchain.LangChainTracer() as langWatchCallback:
-   result = chain.run(text="colors")
+   result = chain.run(text="colors", callbacks=[langWatchCallback])

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

langwatch-0.0.29.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

langwatch-0.0.29-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

Details for the file langwatch-0.0.29.tar.gz.

File metadata

  • Download URL: langwatch-0.0.29.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for langwatch-0.0.29.tar.gz
Algorithm Hash digest
SHA256 5e18cfd9af62ba89991153885c0f18fe4de0b95b68145f5d8c47c582fb0d0de9
MD5 3f626d82075ebee9d3412fbd7b7aa79e
BLAKE2b-256 3e8f880c42eed5d2e6fea5ef3e6120836418259fc8db209b3a181f7a31954a82

See more details on using hashes here.

File details

Details for the file langwatch-0.0.29-py3-none-any.whl.

File metadata

  • Download URL: langwatch-0.0.29-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.9.19

File hashes

Hashes for langwatch-0.0.29-py3-none-any.whl
Algorithm Hash digest
SHA256 98200b085edc8072e331b180b23e596a98a78a233d52da960e6cf32ba1658d85
MD5 77a82fa728a93a05a34b206578610a0f
BLAKE2b-256 7e36bf8d32f4d15a894f1da16bceb883b56b5bf8d639c182207d62d3ab446d7e

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