zasharepw77 commited on
Commit
e42ee9c
·
1 Parent(s): 96625a4

пустой без smallfgenta 3

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  import os
2
  import litellm
3
  litellm._turn_on_debug() # Enable debugging for litellm
@@ -15,6 +21,33 @@ try:
15
  )
16
  print("\n++++\nResponse from litellm:\n")
17
  print(response)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  except Exception as e:
19
  print(f"\n++++\nError occurred:\n")
20
  print(f"{e}")
 
1
+ from smolagents import ToolCallingAgent, DuckDuckGoSearchTool, LiteLLMModel
2
+ import os
3
+ import litellm
4
+ litellm._turn_on_debug() # Enable debugging for litellm
5
+
6
+ '''
7
  import os
8
  import litellm
9
  litellm._turn_on_debug() # Enable debugging for litellm
 
21
  )
22
  print("\n++++\nResponse from litellm:\n")
23
  print(response)
24
+ except Exception as e:
25
+ print(f"\n++++\nError occurred:\n")
26
+ print(f"{e}")
27
+ '''
28
+
29
+ # Set the API key for Sambanova
30
+ os.environ['SAMBANOVA_API_KEY'] = os.getenv('sambanova_token')
31
+
32
+ # Create the model with explicit provider specification
33
+ model = LiteLLMModel(
34
+ model_id="sambanova/Qwen2.5-Coder-32B-Instruct", # Explicitly specify the sambanova provider
35
+ max_tokens=100,
36
+ #temperature=0.1,
37
+ api_base="https://api.sambanova.ai/v1", # Specify the base URL for Sambanova, as in your working requests example
38
+ )
39
+
40
+ # Create the agent
41
+ agent = ToolCallingAgent(
42
+ tools=[DuckDuckGoSearchTool()],
43
+ model=model
44
+ )
45
+
46
+ # Run the agent with error handling
47
+ try:
48
+ result = agent.run("Search for the best music recommendations for a party at the Wayne's mansion.")
49
+ print("\n++++\nResult:\n")
50
+ print(result)
51
  except Exception as e:
52
  print(f"\n++++\nError occurred:\n")
53
  print(f"{e}")