Spaces:
Runtime error
Runtime error
| 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)... |