Spaces:
Runtime error
Runtime error
added all codes
Browse files
app.py
CHANGED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import base64
|
3 |
+
|
4 |
+
LANGFUSE_PUBLIC_KEY="pk-lf-56067380-bad3-4383-98c3-b90c4cdc0520"
|
5 |
+
LANGFUSE_SECRET_KEY="sk-lf-a9e16e56-4164-4762-9bb4-ed6ea7bc7a1d"
|
6 |
+
LANGFUSE_AUTH=base64.b64encode(f"{LANGFUSE_PUBLIC_KEY}:{LANGFUSE_SECRET_KEY}".encode()).decode()
|
7 |
+
|
8 |
+
os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://cloud.langfuse.com/api/public/otel" # EU data region
|
9 |
+
# os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://us.cloud.langfuse.com/api/public/otel" # US data region
|
10 |
+
os.environ["OTEL_EXPORTER_OTLP_HEADERS"] = f"Authorization=Basic {LANGFUSE_AUTH}"
|
11 |
+
|
12 |
+
from opentelemetry.sdk.trace import TracerProvider
|
13 |
+
|
14 |
+
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
|
15 |
+
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
16 |
+
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
|
17 |
+
|
18 |
+
trace_provider = TracerProvider()
|
19 |
+
trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter()))
|
20 |
+
|
21 |
+
SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
|
22 |
+
|
23 |
+
from smolagents import CodeAgent, HfApiModel
|
24 |
+
|
25 |
+
agent = CodeAgent(tools=[], model=HfApiModel())
|
26 |
+
alfred_agent = agent.from_hub('jamesbright/party_organiser', trust_remote_code=True)
|
27 |
+
alfred_agent.run("Give me the best playlist for a party at Wayne's mansion. The party idea is a 'villain masquerade' theme")
|