Spaces:
Build error
Build error
removed test_files
Browse files- agent.py +2 -1
- app.py +4 -4
- test_agent.ipynb +0 -0
- test_app.ipynb +0 -0
- test_create_rag.ipynb +0 -0
- test_nebius_mode.ipynb +0 -105
- test_query_FAISS.ipynb +0 -0
agent.py
CHANGED
|
@@ -20,8 +20,9 @@ from smolagents import (
|
|
| 20 |
load_dotenv()
|
| 21 |
|
| 22 |
from langfuse import Langfuse,get_client
|
| 23 |
-
langfuse = Langfuse(environment='
|
| 24 |
langfuse = get_client()
|
|
|
|
| 25 |
if langfuse.auth_check():
|
| 26 |
print("Langfuse client is authenticated and ready!")
|
| 27 |
else:
|
|
|
|
| 20 |
load_dotenv()
|
| 21 |
|
| 22 |
from langfuse import Langfuse,get_client
|
| 23 |
+
langfuse = Langfuse(environment='PROD_V1')
|
| 24 |
langfuse = get_client()
|
| 25 |
+
|
| 26 |
if langfuse.auth_check():
|
| 27 |
print("Langfuse client is authenticated and ready!")
|
| 28 |
else:
|
app.py
CHANGED
|
@@ -29,9 +29,7 @@ now = datetime.utcnow().isoformat()
|
|
| 29 |
logging.info(f"Processing request {now}")
|
| 30 |
|
| 31 |
# Use langfuse to log traces
|
| 32 |
-
from langfuse import
|
| 33 |
-
langfuse = Langfuse(environment='PROD_ON_HUGGINGFACE')
|
| 34 |
-
langfuse = get_client()
|
| 35 |
|
| 36 |
# --- PATCH --- In order to be able to stream Agent intenal steps to Gradio interface
|
| 37 |
# --- OpenTelemetry detach bug (generator-safe) ---
|
|
@@ -91,7 +89,9 @@ def Agent(question, history):
|
|
| 91 |
question_with_history = "Conversation history:\n" + str(history) + "\n\nNew user question:\n " + question
|
| 92 |
|
| 93 |
# Propagate session_id to all child observations
|
| 94 |
-
with propagate_attributes(
|
|
|
|
|
|
|
| 95 |
for st in safe_agent.run(question_with_history,stream=True,return_full_result=True):
|
| 96 |
if isinstance(st, smolagents.memory.PlanningStep):
|
| 97 |
plan = 20*"# " + "\n# Planning of manager agent" + st.plan.split("## 2. Plan")[-1]
|
|
|
|
| 29 |
logging.info(f"Processing request {now}")
|
| 30 |
|
| 31 |
# Use langfuse to log traces
|
| 32 |
+
from langfuse import propagate_attributes
|
|
|
|
|
|
|
| 33 |
|
| 34 |
# --- PATCH --- In order to be able to stream Agent intenal steps to Gradio interface
|
| 35 |
# --- OpenTelemetry detach bug (generator-safe) ---
|
|
|
|
| 89 |
question_with_history = "Conversation history:\n" + str(history) + "\n\nNew user question:\n " + question
|
| 90 |
|
| 91 |
# Propagate session_id to all child observations
|
| 92 |
+
with propagate_attributes(tags=["Production","Code Agent","HuggingSpace"],
|
| 93 |
+
user_id="Add logic for troubleshootinh",
|
| 94 |
+
session_id=f"Add logic to bill user according to usage"):
|
| 95 |
for st in safe_agent.run(question_with_history,stream=True,return_full_result=True):
|
| 96 |
if isinstance(st, smolagents.memory.PlanningStep):
|
| 97 |
plan = 20*"# " + "\n# Planning of manager agent" + st.plan.split("## 2. Plan")[-1]
|
test_agent.ipynb
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
test_app.ipynb
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
test_create_rag.ipynb
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|
test_nebius_mode.ipynb
DELETED
|
@@ -1,105 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "code",
|
| 5 |
-
"execution_count": 1,
|
| 6 |
-
"id": "371b903a",
|
| 7 |
-
"metadata": {},
|
| 8 |
-
"outputs": [
|
| 9 |
-
{
|
| 10 |
-
"name": "stdout",
|
| 11 |
-
"output_type": "stream",
|
| 12 |
-
"text": [
|
| 13 |
-
"Available models:\n",
|
| 14 |
-
"- meta-llama/Meta-Llama-3.1-8B-Instruct-fast\n",
|
| 15 |
-
"- meta-llama/Meta-Llama-3.1-8B-Instruct\n",
|
| 16 |
-
"- meta-llama/Llama-Guard-3-8B\n",
|
| 17 |
-
"- nvidia/Llama-3_1-Nemotron-Ultra-253B-v1\n",
|
| 18 |
-
"- nvidia/Nemotron-Nano-V2-12b\n",
|
| 19 |
-
"- google/gemma-2-2b-it\n",
|
| 20 |
-
"- google/gemma-2-9b-it-fast\n",
|
| 21 |
-
"- Qwen/Qwen2.5-Coder-7B-fast\n",
|
| 22 |
-
"- BAAI/bge-en-icl\n",
|
| 23 |
-
"- BAAI/bge-multilingual-gemma2\n",
|
| 24 |
-
"- intfloat/e5-mistral-7b-instruct\n",
|
| 25 |
-
"- meta-llama/Llama-3.3-70B-Instruct\n",
|
| 26 |
-
"- meta-llama/Llama-3.3-70B-Instruct-fast\n",
|
| 27 |
-
"- deepseek-ai/DeepSeek-R1-0528\n",
|
| 28 |
-
"- Qwen/Qwen3-235B-A22B-Instruct-2507\n",
|
| 29 |
-
"- Qwen/Qwen3-235B-A22B-Thinking-2507\n",
|
| 30 |
-
"- Qwen/Qwen3-32B\n",
|
| 31 |
-
"- Qwen/Qwen3-32B-fast\n",
|
| 32 |
-
"- google/gemma-3-27b-it\n",
|
| 33 |
-
"- google/gemma-3-27b-it-fast\n",
|
| 34 |
-
"- Qwen/Qwen2.5-VL-72B-Instruct\n",
|
| 35 |
-
"- Qwen/Qwen3-Embedding-8B\n",
|
| 36 |
-
"- deepseek-ai/DeepSeek-V3-0324\n",
|
| 37 |
-
"- zai-org/GLM-4.5\n",
|
| 38 |
-
"- zai-org/GLM-4.5-Air\n",
|
| 39 |
-
"- openai/gpt-oss-120b\n",
|
| 40 |
-
"- openai/gpt-oss-20b\n",
|
| 41 |
-
"- deepseek-ai/DeepSeek-R1-0528-fast\n",
|
| 42 |
-
"- deepseek-ai/DeepSeek-V3-0324-fast\n",
|
| 43 |
-
"- moonshotai/Kimi-K2-Instruct\n",
|
| 44 |
-
"- Qwen/Qwen3-30B-A3B-Thinking-2507\n",
|
| 45 |
-
"- Qwen/Qwen3-30B-A3B-Instruct-2507\n",
|
| 46 |
-
"- Qwen/Qwen3-Coder-30B-A3B-Instruct\n",
|
| 47 |
-
"- Qwen/Qwen3-Coder-480B-A35B-Instruct\n",
|
| 48 |
-
"- NousResearch/Hermes-4-70B\n",
|
| 49 |
-
"- NousResearch/Hermes-4-405B\n",
|
| 50 |
-
"- PrimeIntellect/INTELLECT-3\n",
|
| 51 |
-
"- moonshotai/Kimi-K2-Thinking\n",
|
| 52 |
-
"- black-forest-labs/flux-dev\n",
|
| 53 |
-
"- black-forest-labs/flux-schnell\n"
|
| 54 |
-
]
|
| 55 |
-
}
|
| 56 |
-
],
|
| 57 |
-
"source": [
|
| 58 |
-
"import requests\n",
|
| 59 |
-
"import os\n",
|
| 60 |
-
"\n",
|
| 61 |
-
"api_key = os.environ.get(\"NEBIUS_API_KEY\")\n",
|
| 62 |
-
"headers = {\n",
|
| 63 |
-
" \"Authorization\": f\"Bearer {api_key}\",\n",
|
| 64 |
-
" \"Content-Type\": \"application/json\"\n",
|
| 65 |
-
"}\n",
|
| 66 |
-
"\n",
|
| 67 |
-
"# Try the models endpoint\n",
|
| 68 |
-
"response = requests.get(\n",
|
| 69 |
-
" \"https://api.tokenfactory.nebius.com/v1/models\",\n",
|
| 70 |
-
" headers=headers\n",
|
| 71 |
-
")\n",
|
| 72 |
-
"\n",
|
| 73 |
-
"if response.status_code == 200:\n",
|
| 74 |
-
" models = response.json()\n",
|
| 75 |
-
" print(\"Available models:\")\n",
|
| 76 |
-
" for model in models.get('data', []):\n",
|
| 77 |
-
" print(f\"- {model.get('id')}\")\n",
|
| 78 |
-
"else:\n",
|
| 79 |
-
" print(f\"Error: {response.status_code}\")\n",
|
| 80 |
-
" print(response.text)"
|
| 81 |
-
]
|
| 82 |
-
}
|
| 83 |
-
],
|
| 84 |
-
"metadata": {
|
| 85 |
-
"kernelspec": {
|
| 86 |
-
"display_name": "mcp-birthday",
|
| 87 |
-
"language": "python",
|
| 88 |
-
"name": "python3"
|
| 89 |
-
},
|
| 90 |
-
"language_info": {
|
| 91 |
-
"codemirror_mode": {
|
| 92 |
-
"name": "ipython",
|
| 93 |
-
"version": 3
|
| 94 |
-
},
|
| 95 |
-
"file_extension": ".py",
|
| 96 |
-
"mimetype": "text/x-python",
|
| 97 |
-
"name": "python",
|
| 98 |
-
"nbconvert_exporter": "python",
|
| 99 |
-
"pygments_lexer": "ipython3",
|
| 100 |
-
"version": "3.10.19"
|
| 101 |
-
}
|
| 102 |
-
},
|
| 103 |
-
"nbformat": 4,
|
| 104 |
-
"nbformat_minor": 5
|
| 105 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_query_FAISS.ipynb
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|