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

Uploaded Source

Built Distribution

langwatch-0.0.8-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langwatch-0.0.8.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for langwatch-0.0.8.tar.gz
Algorithm Hash digest
SHA256 98ee887a9d4dfa7f4f658650aebb5a526fe72b61299ba8aa576fe58ee028b5dd
MD5 86855a3606b0d7bbcf2b22d02cacfe38
BLAKE2b-256 5ae93864799ca400b5ae11962a267077e41212e295457c88da2b48a58594d35b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: langwatch-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for langwatch-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fb106f3f290989fddac14cef33724b44bd774b2e255cfc31205846a9b1cbc1fd
MD5 9023a99de971e446400215713a3f66d1
BLAKE2b-256 55e0a8dfac9e0d9e27b412ffc64a595c21426a176f689b306c415d381d8ab4fa

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