# LangWatch Python SDK
Go to [https://langwatch.ai](https://langwatch.ai) to setup your account.
To trace OpenAI calls:
```diff
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:
```diff
+ 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])
```
Raw data
{
"_id": null,
"home_page": "https://github.com/langwatch/langwatch",
"name": "langwatch",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Rogerio Chaves",
"author_email": "rogerio@langwatch.ai",
"download_url": "https://files.pythonhosted.org/packages/14/f1/e135510da3624069c8a68d9f0644d7088cb4669897d621d5680ca4626a37/langwatch-0.0.21.tar.gz",
"platform": null,
"description": "# LangWatch Python SDK\n\nGo to [https://langwatch.ai](https://langwatch.ai) to setup your account.\n\nTo trace OpenAI calls:\n\n```diff\nfrom openai import OpenAI\n+ import langwatch.openai\n\nclient = OpenAI()\n\n+ with langwatch.openai.OpenAITracer(client):\n completion = client.chat.completions.create(\n model=\"gpt-3.5-turbo\",\n messages=[\n {\n \"role\": \"system\",\n \"content\": \"You are a helpful assistant that only reply in short tweet-like responses, using lots of emojis.\",\n },\n {\"role\": \"user\", \"content\": message},\n ],\n stream=True,\n )\n```\n\nTo trace LangChain agent:\n\n```diff\n+ import langwatch.langchain\n\n # ...\n\n chain = LLMChain(\n llm=ChatOpenAI(),\n prompt=chat_prompt,\n output_parser=CommaSeparatedListOutputParser(),\n )\n+ with langwatch.langchain.LangChainTracer() as langWatchCallback:\n- result = chain.run(text=\"colors\")\n+ result = chain.run(text=\"colors\", callbacks=[langWatchCallback])\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python SDK for LangWatch for monitoring your LLMs",
"version": "0.0.21",
"project_urls": {
"Documentation": "https://langwatch.ai/docs",
"Homepage": "https://github.com/langwatch/langwatch",
"Issue Tracker": "https://github.com/langwatch/langwatch/issues",
"Source Code": "https://github.com/langwatch/langwatch"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4409d2b27118e01a868b445afbaf26ad1335cd80a8b4f3533be428d73dc5f3c1",
"md5": "a9743c01523240d9bf9ce15a1f34d0a7",
"sha256": "fb461c12a6f05ae8c1f4c8ae7ceca8ea3984e4f2a76a51cd3cf5461bdac777aa"
},
"downloads": -1,
"filename": "langwatch-0.0.21-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a9743c01523240d9bf9ce15a1f34d0a7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 16201,
"upload_time": "2024-05-17T15:21:03",
"upload_time_iso_8601": "2024-05-17T15:21:03.278823Z",
"url": "https://files.pythonhosted.org/packages/44/09/d2b27118e01a868b445afbaf26ad1335cd80a8b4f3533be428d73dc5f3c1/langwatch-0.0.21-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "14f1e135510da3624069c8a68d9f0644d7088cb4669897d621d5680ca4626a37",
"md5": "21ee873d6607933d5f136427f5f0fc25",
"sha256": "dec4fb1e11e9e8fd6587ac82d413c9be7e08f3960667ac10e30df01734ccce5d"
},
"downloads": -1,
"filename": "langwatch-0.0.21.tar.gz",
"has_sig": false,
"md5_digest": "21ee873d6607933d5f136427f5f0fc25",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 13507,
"upload_time": "2024-05-17T15:21:05",
"upload_time_iso_8601": "2024-05-17T15:21:05.017223Z",
"url": "https://files.pythonhosted.org/packages/14/f1/e135510da3624069c8a68d9f0644d7088cb4669897d621d5680ca4626a37/langwatch-0.0.21.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-17 15:21:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "langwatch",
"github_project": "langwatch",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "langwatch"
}