Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,6 +22,7 @@ from opentelemetry.sdk.trace import TracerProvider
|
|
| 22 |
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
|
| 23 |
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
| 24 |
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
|
|
|
|
| 25 |
|
| 26 |
# Load environment variables
|
| 27 |
|
|
@@ -30,8 +31,11 @@ load_dotenv()
|
|
| 30 |
# Add the alias before instrumentation
|
| 31 |
smolagents.ApiModel = smolagents.HfApiModel
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
| 35 |
LANGFUSE_AUTH=base64.b64encode(f"{LANGFUSE_PUBLIC_KEY}:{LF_SECRET_KEY}".encode()).decode()
|
| 36 |
|
| 37 |
os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://cloud.langfuse.com/api/public/otel" # EU data region
|
|
@@ -43,7 +47,8 @@ trace_provider.add_span_processor(SimpleSpanProcessor(OTLPSpanExporter()))
|
|
| 43 |
|
| 44 |
SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
|
| 45 |
|
| 46 |
-
DATA_PATH = ""
|
|
|
|
| 47 |
PROMPT_TEMPLATE = """
|
| 48 |
Ответь на вопрос, используя только следующий контекст:
|
| 49 |
{context}
|
|
|
|
| 22 |
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
|
| 23 |
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
|
| 24 |
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
|
| 25 |
+
from langfuse import Langfuse
|
| 26 |
|
| 27 |
# Load environment variables
|
| 28 |
|
|
|
|
| 31 |
# Add the alias before instrumentation
|
| 32 |
smolagents.ApiModel = smolagents.HfApiModel
|
| 33 |
|
| 34 |
+
langfuse = Langfuse(
|
| 35 |
+
secret_key="sk-lf-f8fe856f-7569-4aec-9a08-dabbac9e83b9",
|
| 36 |
+
public_key="pk-lf-23dd0190-7c1d-4ac9-be62-9aaf1370ef6d",
|
| 37 |
+
host="https://cloud.langfuse.com"
|
| 38 |
+
)
|
| 39 |
LANGFUSE_AUTH=base64.b64encode(f"{LANGFUSE_PUBLIC_KEY}:{LF_SECRET_KEY}".encode()).decode()
|
| 40 |
|
| 41 |
os.environ["OTEL_EXPORTER_OTLP_ENDPOINT"] = "https://cloud.langfuse.com/api/public/otel" # EU data region
|
|
|
|
| 47 |
|
| 48 |
SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
|
| 49 |
|
| 50 |
+
DATA_PATH = ""
|
| 51 |
+
# Specify the path to your file
|
| 52 |
PROMPT_TEMPLATE = """
|
| 53 |
Ответь на вопрос, используя только следующий контекст:
|
| 54 |
{context}
|