Skip to main content

Respan instrumentation plugin for Haystack

Project description

respan-instrumentation-haystack

Respan instrumentation plugin for Haystack by deepset. Wraps opentelemetry-instrumentation-haystack to automatically trace pipeline runs, component executions, and LLM calls.

Configuration

1. Install

pip install respan-instrumentation-haystack

2. Set Environment Variables

Variable Required Description
RESPAN_API_KEY Yes Your Respan API key.
RESPAN_BASE_URL No Defaults to https://api.respan.ai.

Quickstart

3. Run Script

import os
from dotenv import load_dotenv

load_dotenv()

from respan import Respan
from respan_instrumentation_haystack import HaystackInstrumentor

respan = Respan(instrumentations=[HaystackInstrumentor()])

from haystack import Pipeline
from haystack.components.generators import OpenAIGenerator
from haystack.components.builders import PromptBuilder

template = """Answer the following question: {{question}}"""

pipe = Pipeline()
pipe.add_component("prompt_builder", PromptBuilder(template=template))
pipe.add_component("llm", OpenAIGenerator(model="gpt-4o-mini"))
pipe.connect("prompt_builder", "llm")

result = pipe.run({"prompt_builder": {"question": "What is the capital of France?"}})
print(result["llm"]["replies"][0])

respan.flush()

4. View Dashboard

After running the script, traces appear on your Respan dashboard.

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

respan_instrumentation_haystack-0.1.0.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file respan_instrumentation_haystack-0.1.0.tar.gz.

File metadata

File hashes

Hashes for respan_instrumentation_haystack-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d9da7c6b0a2423b500502d80f012b3af84a07977d10b7f2df87ca224f94310dd
MD5 815efae19c6bc34305fa309d6d621234
BLAKE2b-256 12996d93caaca0c1b42c5337f479c1f31dac1a78045cab0523c2c85643517b41

See more details on using hashes here.

File details

Details for the file respan_instrumentation_haystack-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for respan_instrumentation_haystack-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 271da8cfe21098cc958fe720a640c84c9300a784539dd17f34fdd2b087415037
MD5 563e5e7a945a0a63b09b12a2cd0b6482
BLAKE2b-256 ef2e47d0c7f9cc9f8071ead5aae42a8f6c41465af6b70d5f4f2bc5e5b7cc3657

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page