Spaces:
Sleeping
Sleeping
add langfuse observability
Browse files6 unmodified lines7891011126 unmodified linesfrom Gradio_UI import GradioUI# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type6 unmodified lines7891011121314151617181920212223242526272829306 unmodified linesfrom Gradio_UI import GradioUIfrom opentelemetry.sdk.trace import TracerProviderfrom openinference.instrumentation.smolagents import SmolagentsInstrumentorfrom opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporterfrom opentelemetry.sdk.trace.export import SimpleSpanProcessoros.environ["PYTHONIOENCODING"] ="utf-8"LANGFUSE_PUBLIC_KEY = os.getenv("LANGFUSE_PUBLIC_KEY", "")LANGFUSE_SECRET_KEY = os.getenv("LANGFUSE_SECRET_KEY", "")LANGFUSE_AUTH=base64.b64encode(f"{LANGFUSE_PUBLIC_KEY}:{LANGFUSE_SECRET_KEY}".encode()).decode()os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://cloud.langfuse.com/api/public/otel"os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = f"Authorization=Basic {LANGFUSE_AUTH}"# add langfuse observability to this factchecking agenttrace_provider = TracerProvider()trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter()))SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
app.py+18