Spaces:
Sleeping
Sleeping
zasharepw77
commited on
Commit
·
fe13e33
1
Parent(s):
27b0c70
Cod Calling 2
Browse files
app.py
CHANGED
|
@@ -1,31 +1,8 @@
|
|
| 1 |
-
from smolagents import ToolCallingAgent, CodeAgent, 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
|
| 10 |
-
|
| 11 |
-
# Set the API key for Sambanova
|
| 12 |
-
os.environ['SAMBANOVA_API_KEY'] = os.getenv('sambanova_token')
|
| 13 |
-
|
| 14 |
-
# Test the completion directly with litellm
|
| 15 |
-
try:
|
| 16 |
-
response = litellm.completion(
|
| 17 |
-
model="sambanova/Qwen2.5-Coder-32B-Instruct",
|
| 18 |
-
messages=[{"role": "user", "content": "Tell me about yourself."}],
|
| 19 |
-
max_tokens=100,
|
| 20 |
-
api_base="https://api.sambanova.ai/v1", # Base URL for Sambanova
|
| 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 |
|
|
@@ -39,8 +16,12 @@ model = LiteLLMModel(
|
|
| 39 |
|
| 40 |
# Create the agent
|
| 41 |
#agent = ToolCallingAgent(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
agent = CodeAgent(
|
| 43 |
-
tools=[
|
| 44 |
model=model
|
| 45 |
)
|
| 46 |
|
|
|
|
| 1 |
+
from smolagents import ToolCallingAgent, CodeAgent, DuckDuckGoSearch, DuckDuckGoSearchTool, LiteLLMModel
|
| 2 |
import os
|
| 3 |
#import litellm
|
| 4 |
#litellm._turn_on_debug() # Enable debugging for litellm
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# Set the API key for Sambanova
|
| 7 |
os.environ['SAMBANOVA_API_KEY'] = os.getenv('sambanova_token')
|
| 8 |
|
|
|
|
| 16 |
|
| 17 |
# Create the agent
|
| 18 |
#agent = ToolCallingAgent(
|
| 19 |
+
# tools=[DuckDuckGoSearchTool()],
|
| 20 |
+
# model=model
|
| 21 |
+
#)
|
| 22 |
+
|
| 23 |
agent = CodeAgent(
|
| 24 |
+
tools=[DuckDuckGoSearch()],
|
| 25 |
model=model
|
| 26 |
)
|
| 27 |
|