# Tracing Auto Instrumentation
Tracing Auto Instrumentation allows you to easily instrument popular LLM frameworks for tracing your LLM application. It is built with and on top of the LastMile Rag Debugger: [https://rag.lastmileai.dev/](https://rag.lastmileai.dev/).
## Supported Frameworks/Libraries and Examples:
Sure, here's the table with the example links formatted as bullet points:
| Framework/Library | Example Link |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| OpenAI | - [openai_instrumentation.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/openai_instrumentation.ipynb) <br /> -[openai_streaming.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/openai_streaming.ipynb) |
| IBM | - [ibm.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/ibm.ipynb) <br />-[ibm_granite_tutorial.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/ibm_granite_tutorial.ipynb) |
| LangChain | - [langchain.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/langchain.ipynb) |
| LLamaIndex | - [llama_index.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/llama_index.ipynb) <br />-[llama_index_function_calls.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/llama_index_function_calls.ipynb) |
## Getting Started
Getting started is easy. Simply choose the framework you want to instrument and follow the instructions below. If you want to instrument multiple frameworks, you can install `all`.
```shell
pip install "tracing-auto-instrumentation[all]"
```
### OpenAI
```shell
pip install "tracing-auto-instrumentation[openai]"
```
```python
import openai
from tracing_auto_instrumentation.openai import wrap_openai
from lastmile_eval.rag.debugger.tracing.sdk import get_lastmile_tracer
tracer = get_lastmile_tracer(
tracer_name="OpenAI Function Calling",
)
client = wrap_openai(openai.OpenAI(), tracer)
```
### LangChain
```shell
pip install "tracing-auto-instrumentation[langchain]"
```
```python
import langchain
from tracing_auto_instrumentation.langchain import LangChainInstrumentor
# Create an instance of LangChainInstrumentor and instrument the code
instrumentor = LangChainInstrumentor(project_name="Plan-and-Execute Example")
instrumentor.instrument()
```
### LLamaIndex
```shell
pip install "tracing-auto-instrumentation[llamaindex]"
```
```python
import llama_index.core
from tracing_auto_instrumentation.llama_index import LlamaIndexCallbackHandler
llama_index.core.global_handler = LlamaIndexCallbackHandler(
project_name="LlamaIndex with Paul Graham",
)
```
### IBM
```shell
pip install "tracing-auto-instrumentation[ibm]"
```
```python
# todo
```
Raw data
{
"_id": null,
"home_page": null,
"name": "tracing-auto-instrumentation",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": null,
"author": "LastMile AI",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/b0/97/d7a665ae4ddd484551e7d6c1f753ade7379e71902952bf923e3e0307da39/tracing_auto_instrumentation-0.0.11.tar.gz",
"platform": null,
"description": "# Tracing Auto Instrumentation\n\nTracing Auto Instrumentation allows you to easily instrument popular LLM frameworks for tracing your LLM application. It is built with and on top of the LastMile Rag Debugger: [https://rag.lastmileai.dev/](https://rag.lastmileai.dev/).\n\n## Supported Frameworks/Libraries and Examples:\n\nSure, here's the table with the example links formatted as bullet points:\n\n| Framework/Library | Example Link |\n| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| OpenAI | - [openai_instrumentation.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/openai_instrumentation.ipynb) <br /> -[openai_streaming.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/openai_streaming.ipynb) |\n| IBM | - [ibm.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/ibm.ipynb) <br />-[ibm_granite_tutorial.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/ibm_granite_tutorial.ipynb) |\n| LangChain | - [langchain.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/langchain.ipynb) |\n| LLamaIndex | - [llama_index.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/llama_index.ipynb) <br />-[llama_index_function_calls.ipynb](https://github.com/lastmile-ai/eval-cookbook/blob/main/auto-instrumentors/llama_index_function_calls.ipynb) |\n\n## Getting Started\n\nGetting started is easy. Simply choose the framework you want to instrument and follow the instructions below. If you want to instrument multiple frameworks, you can install `all`.\n\n```shell\npip install \"tracing-auto-instrumentation[all]\"\n```\n\n### OpenAI\n\n```shell\npip install \"tracing-auto-instrumentation[openai]\"\n```\n\n```python\nimport openai\nfrom tracing_auto_instrumentation.openai import wrap_openai\nfrom lastmile_eval.rag.debugger.tracing.sdk import get_lastmile_tracer\n\ntracer = get_lastmile_tracer(\n tracer_name=\"OpenAI Function Calling\",\n)\nclient = wrap_openai(openai.OpenAI(), tracer)\n```\n\n### LangChain\n\n```shell\npip install \"tracing-auto-instrumentation[langchain]\"\n```\n\n```python\nimport langchain\nfrom tracing_auto_instrumentation.langchain import LangChainInstrumentor\n\n# Create an instance of LangChainInstrumentor and instrument the code\ninstrumentor = LangChainInstrumentor(project_name=\"Plan-and-Execute Example\")\ninstrumentor.instrument()\n```\n\n### LLamaIndex\n\n```shell\npip install \"tracing-auto-instrumentation[llamaindex]\"\n```\n\n```python\nimport llama_index.core\n\nfrom tracing_auto_instrumentation.llama_index import LlamaIndexCallbackHandler\n\nllama_index.core.global_handler = LlamaIndexCallbackHandler(\n project_name=\"LlamaIndex with Paul Graham\",\n)\n```\n\n### IBM\n\n```shell\npip install \"tracing-auto-instrumentation[ibm]\"\n```\n\n```python\n# todo\n```\n",
"bugtrack_url": null,
"license": null,
"summary": null,
"version": "0.0.11",
"project_urls": {
"Bug Tracker": "https://github.com/lastmile-ai/tracing_auto_instrumentation/issues",
"Homepage": "https://github.com/lastmile-ai/tracing_auto_instrumentation"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "04221d9c7e244f0038286d0393ed9e4adf4ec0d535dcbfbe934c2e5a6436cc94",
"md5": "bc368a88d8658a762834855cafddd39d",
"sha256": "92fe5e2c62c4078a0a2811156f6cab6099e5ac5a1d488b47ee967beb0ad5af80"
},
"downloads": -1,
"filename": "tracing_auto_instrumentation-0.0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bc368a88d8658a762834855cafddd39d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 29361,
"upload_time": "2024-08-15T21:23:25",
"upload_time_iso_8601": "2024-08-15T21:23:25.715862Z",
"url": "https://files.pythonhosted.org/packages/04/22/1d9c7e244f0038286d0393ed9e4adf4ec0d535dcbfbe934c2e5a6436cc94/tracing_auto_instrumentation-0.0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b097d7a665ae4ddd484551e7d6c1f753ade7379e71902952bf923e3e0307da39",
"md5": "224f92a49fbe02673c447da4d6ef9026",
"sha256": "73a67f80de26b7d89fcd0fb3a0ebdf9200cd13c7d09729a5674e4d38666f518a"
},
"downloads": -1,
"filename": "tracing_auto_instrumentation-0.0.11.tar.gz",
"has_sig": false,
"md5_digest": "224f92a49fbe02673c447da4d6ef9026",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 22381,
"upload_time": "2024-08-15T21:23:27",
"upload_time_iso_8601": "2024-08-15T21:23:27.425022Z",
"url": "https://files.pythonhosted.org/packages/b0/97/d7a665ae4ddd484551e7d6c1f753ade7379e71902952bf923e3e0307da39/tracing_auto_instrumentation-0.0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-15 21:23:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lastmile-ai",
"github_project": "tracing_auto_instrumentation",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "tracing-auto-instrumentation"
}