respan-instrumentation-huggingface
Respan instrumentation plugin for Hugging Face Transformers.
This package wraps the upstream opentelemetry-instrumentation-transformers
instrumentor and adds a small Respan contract processor so
TextGenerationPipeline.__call__ spans export with canonical Respan fields.
Installation
pip install respan-ai respan-instrumentation-huggingface
Usage
from respan import Respan, workflow
from respan_instrumentation_huggingface import HuggingFaceInstrumentor
from transformers import pipeline
respan = Respan(
app_name="huggingface-text-generation",
instrumentations=[HuggingFaceInstrumentor()],
)
@workflow(name="huggingface_text_generation")
def run_generation():
generator = pipeline(
"text-generation",
model="sshleifer/tiny-gpt2",
)
return generator(
"Tracing helps teams",
max_length=30,
temperature=0.7,
top_p=0.9,
)
try:
print(run_generation())
finally:
respan.flush()
respan.shutdown()
Set TRACELOOP_TRACE_CONTENT=false to suppress prompt and completion text in
span attributes while still exporting model and request metadata.
Metadata
Release files for respan-instrumentation-huggingface 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| respan_instrumentation_huggingface-0.1.1.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| respan_instrumentation_huggingface-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.1 kB
Release files / respan_instrumentation_huggingface-0.1.1.tar.gz
| Download URL | respan_instrumentation_huggingface-0.1.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a706a4a23b2d4117bd3871c3f4908ab791b74e20408baf45a698c9e8cbe2b473
|
|
BLAKE2b-256 checksum How to use checksums |
cf80308a613d05ced5e49b43a049d834b8ad57dd7187a7a188187774a0767d36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / respan_instrumentation_huggingface-0.1.1-py3-none-any.whl
| Download URL | respan_instrumentation_huggingface-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88e07b33e089ea340fc99970437cfeff2926ec6eca53d7aa763a337c380eb1cb
|
|
BLAKE2b-256 checksum How to use checksums |
d17b7023e79e3467e39961360197be0ca37f87363fa69e4c8464cac57c268ead
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|