Spaces:
Sleeping
Sleeping
Commit Β·
402292c
1
Parent(s): 3544fa1
Update 2026-03-22 09:29:56
Browse files- agent/nodes.py +1 -1
- app.py +6 -5
agent/nodes.py
CHANGED
|
@@ -30,7 +30,7 @@ def agent_node(state: AgentState) -> dict:
|
|
| 30 |
user_msg = msg.content
|
| 31 |
elif cname == "ToolMessage":
|
| 32 |
tool_obs.append({"tool":getattr(msg,"name","tool"),"result":msg.content})
|
| 33 |
-
client = InferenceClient(api_key=state["hf_token"])
|
| 34 |
messages = build_messages(user_msg, state.get("conversation_history",[]), tool_obs)
|
| 35 |
full_text = call_llm_streaming(client, state["model_name"], messages,
|
| 36 |
emit_token=lambda t: ev.emit(sid,{"type":"token","content":t}))
|
|
|
|
| 30 |
user_msg = msg.content
|
| 31 |
elif cname == "ToolMessage":
|
| 32 |
tool_obs.append({"tool":getattr(msg,"name","tool"),"result":msg.content})
|
| 33 |
+
client = InferenceClient(api_key=state["hf_token"], provider="auto")
|
| 34 |
messages = build_messages(user_msg, state.get("conversation_history",[]), tool_obs)
|
| 35 |
full_text = call_llm_streaming(client, state["model_name"], messages,
|
| 36 |
emit_token=lambda t: ev.emit(sid,{"type":"token","content":t}))
|
app.py
CHANGED
|
@@ -10,10 +10,10 @@ app = Flask(__name__)
|
|
| 10 |
app.secret_key = os.getenv("SECRET_KEY","lgsa-2025-dev-secret")
|
| 11 |
|
| 12 |
AVAILABLE_MODELS = [
|
| 13 |
-
{"id":"
|
| 14 |
-
{"id":"
|
| 15 |
-
{"id":"
|
| 16 |
-
{"id":"
|
| 17 |
]
|
| 18 |
|
| 19 |
_sessions: dict = {}
|
|
@@ -158,4 +158,5 @@ def api_reset():
|
|
| 158 |
return jsonify({"status":"ok","session_id":sid})
|
| 159 |
|
| 160 |
if __name__ == "__main__":
|
| 161 |
-
app.run(host="0.0.0.0", port=7860, debug=False, threaded=True)
|
|
|
|
|
|
| 10 |
app.secret_key = os.getenv("SECRET_KEY","lgsa-2025-dev-secret")
|
| 11 |
|
| 12 |
AVAILABLE_MODELS = [
|
| 13 |
+
{"id":"meta-llama/Meta-Llama-3.1-8B-Instruct","name":"Llama 3.1 8B Instruct","badge":"π¦ Recommended"},
|
| 14 |
+
{"id":"Qwen/Qwen2.5-7B-Instruct","name":"Qwen 2.5 7B Instruct","badge":"β‘ Fast"},
|
| 15 |
+
{"id":"mistralai/Mistral-7B-Instruct-v0.3","name":"Mistral 7B Instruct v0.3","badge":"π Mistral"},
|
| 16 |
+
{"id":"google/gemma-2-9b-it","name":"Gemma 2 9B Instruct","badge":"π Google"},
|
| 17 |
]
|
| 18 |
|
| 19 |
_sessions: dict = {}
|
|
|
|
| 158 |
return jsonify({"status":"ok","session_id":sid})
|
| 159 |
|
| 160 |
if __name__ == "__main__":
|
| 161 |
+
app.run(host="0.0.0.0", port=7860, debug=False, threaded=True)
|
| 162 |
+
|