Update app.py
Browse files
app.py
CHANGED
|
@@ -4,36 +4,31 @@ import requests
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
#
|
| 10 |
-
## -- Get keys for your project from the project settings page: https://cloud.langfuse.com
|
| 11 |
-
#os.environ["LANGFUSE_PUBLIC_KEY"] = os.getenv("LF_Public")
|
| 12 |
-
#os.environ["LANGFUSE_SECRET_KEY"] = os.getenv("LF_Secret")
|
| 13 |
-
#os.environ["LANGFUSE_HOST"] = "https://cloud.langfuse.com" # 🇪🇺 EU region
|
| 14 |
-
#
|
| 15 |
-
## your Hugging Face token
|
| 16 |
-
#os.environ["HF_TOKEN"] = os.getenv("HF_Token")
|
| 17 |
#
|
|
|
|
|
|
|
|
|
|
| 18 |
##langfuse = get_client()
|
| 19 |
#
|
| 20 |
#print(os.getenv('LF_Secret'))
|
| 21 |
#
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
#
|
| 28 |
-
## -- Verify connection
|
| 29 |
-
#if langfuse.auth_check():
|
| 30 |
-
# print("Langfuse client is authenticated and ready!")
|
| 31 |
-
#else:
|
| 32 |
-
# print("Authentication failed. Please check your credentials and host.")
|
| 33 |
-
#
|
| 34 |
-
#from openinference.instrumentation.smolagents import SmolagentsInstrumentor
|
| 35 |
#
|
| 36 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# Importing the Agent stuff
|
| 39 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, InferenceClientModel, PromptTemplates, EMPTY_PROMPT_TEMPLATES
|
|
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
+
# Setting up Langfuse for telemetry
|
| 8 |
+
from langfuse import Langfuse, get_client
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
#
|
| 10 |
+
# your Hugging Face token
|
| 11 |
+
os.environ["HF_TOKEN"] = os.getenv("HF_Token")
|
| 12 |
+
|
| 13 |
##langfuse = get_client()
|
| 14 |
#
|
| 15 |
#print(os.getenv('LF_Secret'))
|
| 16 |
#
|
| 17 |
+
langfuse = Langfuse(
|
| 18 |
+
secret_key=os.getenv("LANGFUSE_SECRET_KEY"),
|
| 19 |
+
public_key=os.getenv("LANGFUSE_PUBLIC_KEY"),
|
| 20 |
+
host=os.getenv("LANGFUSE_HOST")
|
| 21 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
#
|
| 23 |
+
# -- Verify connection
|
| 24 |
+
if langfuse.auth_check():
|
| 25 |
+
print("Langfuse client is authenticated and ready!")
|
| 26 |
+
else:
|
| 27 |
+
print("Authentication failed. Please check your credentials and host.")
|
| 28 |
+
|
| 29 |
+
from openinference.instrumentation.smolagents import SmolagentsInstrumentor
|
| 30 |
+
|
| 31 |
+
SmolagentsInstrumentor().instrument()
|
| 32 |
|
| 33 |
# Importing the Agent stuff
|
| 34 |
from smolagents import CodeAgent,DuckDuckGoSearchTool, InferenceClientModel, PromptTemplates, EMPTY_PROMPT_TEMPLATES
|