Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,23 @@ import yaml
|
|
| 2 |
from smolagents import CodeAgent, HfApiModel
|
| 3 |
from tools.final_answer import FinalAnswerTool
|
| 4 |
from Gradio_UI import GradioUI
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# 1. Ferramenta Essencial
|
| 7 |
final_answer = FinalAnswerTool()
|
| 8 |
|
|
|
|
| 2 |
from smolagents import CodeAgent, HfApiModel
|
| 3 |
from tools.final_answer import FinalAnswerTool
|
| 4 |
from Gradio_UI import GradioUI
|
| 5 |
+
import os
|
| 6 |
|
| 7 |
+
from openinference.instrumentation.smolagents import SmolAgentsInstrumentor
|
| 8 |
+
from langfuse import Langfuse
|
| 9 |
+
|
| 10 |
+
print("Configurando a observabilidade com Langfuse...")
|
| 11 |
+
|
| 12 |
+
# Pega as chaves diretamente das variáveis de ambiente (Secrets do Space)
|
| 13 |
+
os.environ["LANGFUSE_PUBLIC_KEY"] = os.environ.get('LANGFUSE_PUBLIC_KEY')
|
| 14 |
+
os.environ["LANGFUSE_SECRET_KEY"] = os.environ.get('LANGFUSE_SECRET_KEY')
|
| 15 |
+
# Inicializa o Langfuse
|
| 16 |
+
langfuse = Langfuse()
|
| 17 |
+
|
| 18 |
+
# "Instrumenta" a biblioteca smolagents
|
| 19 |
+
SmolAgentsInstrumentor().instrument()
|
| 20 |
+
|
| 21 |
+
print("Observabilidade configurada com sucesso.")
|
| 22 |
# 1. Ferramenta Essencial
|
| 23 |
final_answer = FinalAnswerTool()
|
| 24 |
|