ryanrwatkins commited on
Commit
9754eed
·
verified ·
1 Parent(s): 9f35ee8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -7,9 +7,27 @@ from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
 
 
10
 
11
 
12
- import urllib, urllib.request
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
 
15
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
 
7
 
8
  from Gradio_UI import GradioUI
9
 
10
+ import urllib, urllib.request
11
 
12
 
13
+ import os
14
+ import base64
15
+ LANGFUSE_PUBLIC_KEY= os.environ.get("LANGFUSE_PUBLIC_KEY")
16
+ LANGFUSE_SECRET_KEY= os.environ.get("LANGFUSE_SECRET_KEY")
17
+ LANGFUSE_AUTH=base64.b64encode(f"{LANGFUSE_PUBLIC_KEY}:{LANGFUSE_SECRET_KEY}".encode()).decode()
18
+ os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://cloud.langfuse.com/api/public/otel" # EU data region
19
+ # os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://us.cloud.langfuse.com/api/public/otel" # US data region
20
+ os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = f"Authorization=Basic {LANGFUSE_AUTH}"
21
+ # your Hugging Face token
22
+ # os.environ["HF_TOKEN"] = ""
23
+
24
+ from opentelemetry.sdk.trace import TracerProvider
25
+ from openinference.instrumentation.smolagents import SmolagentsInstrumentor
26
+ from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
27
+ from opentelemetry.sdk.trace.export import SimpleSpanProcessor
28
+ trace_provider = TracerProvider()
29
+ trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter()))
30
+ SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
31
 
32
 
33
  # Below is an example of a tool that does nothing. Amaze us with your creativity !