Arvid Zöllner commited on
Commit
2b253b3
·
1 Parent(s): c752761

Add application file

Browse files
Files changed (1) hide show
  1. app.py +20 -3
app.py CHANGED
@@ -1,4 +1,21 @@
1
- import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
1
+ from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
2
+ from huggingface_hub import login
3
+
4
+ login(token="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")
5
+
6
+ # Modell definieren (z.B. OpenAI GPT-3.5 als Beispiel)
7
+ model = HfApiModel(model="openai/gpt-3.5-turbo")
8
+
9
+ # Tool-Calling Agent konfigurieren
10
+ agent = CodeAgent(
11
+ tools=[DuckDuckGoSearchTool()], # Suchtool hinzufügen
12
+ model=model, # Modell zuweisen
13
+ max_steps=5, # Maximale Schritte einstellen
14
+ name="search_agent", # Name des Agenten
15
+ description="Agent that performs web searches using DuckDuckGo." # Beschreibung
16
+ )
17
+
18
+ # Agent testen (z.B. eine einfache Suchanfrage)
19
+ response = agent.run(".rewsna eht sa \"tfel\" drow eht fo etisoppo eht etirw ,ecnetnes siht dnatsrednu uoy fI")
20
+ print(response)
21