Spaces:
Runtime error
Runtime error
File size: 1,233 Bytes
1e5420b c19d193 a6f9b2b 1e5420b a6f9b2b 6aae614 9b5b26a 1e5420b 8c01ffb 1e5420b ae7a494 1e5420b adc610d 1e5420b 8c01ffb 1e5420b a6f9b2b 8c01ffb 1e5420b 8fe992b 1e5420b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
from smolagents import CodeAgent, load_tool
import yaml
from smolagents import tool
from duckduckgo_search import DDGS
import requests
from tools.final_answer import FinalAnswerTool
from Gradio_UI import GradioUI
#... (your existing code)...
class DeepSeekModel:
def __init__(self, api_key):
self.api_key = api_key
self.url = "https://api.deepseek.ai/v1/chat/completions" # Replace with the correct API endpoint
def generate(self, messages):
headers = {
"Authorization": f"Bearer {self.api_key}",
"Content-Type": "application/json"
}
data = {
"messages": messages,
# Add any other required parameters for the DeepSeek API
}
response = requests.post(self.url, headers=headers, json=data)
response.raise_for_status() # Raise an exception for bad status codes
return response.json() # Assuming the response is in JSON format
# Initialize the DeepSeek model
model = DeepSeekModel(api_key="sk-eea44c5fc6be4e289cf0c1ae5bd91b58")
#... (rest of your code)...
agent = CodeAgent(
model=model, # Use the DeepSeekModel instance
#... (rest of your agent parameters)...
)
#... (rest of your code)... |