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.26.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

langwatch-0.0.26-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langwatch-0.0.26.tar.gz
  • Upload date:
  • Size: 17.4 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.26.tar.gz
Algorithm Hash digest
SHA256 afec2b18b07fea6e8fa5f0a3bbff52b3aa56b5cb9e9eb7ef2b0a5dcd6d99ab00
MD5 59e485a5dd1593096fcb2bf23b928f14
BLAKE2b-256 17b5b9a0fd3067fb85633dec38ecafa9e729ba5667ce3b97dfb6e24645cd0b31

See more details on using hashes here.

File details

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

File metadata

  • Download URL: langwatch-0.0.26-py3-none-any.whl
  • Upload date:
  • Size: 20.9 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.26-py3-none-any.whl
Algorithm Hash digest
SHA256 9c08aa5c208b5da75ec859a92eb7d31de9db29d07808ea5825292c5b1bb0f19d
MD5 2c1f595e261b8103fc9ccade884ea2da
BLAKE2b-256 3e90011738bfa7c8de32a55ee71aacf8592ea06245dd3e1db1ae3be0311005ca

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