Update app.py
Browse files
app.py
CHANGED
|
@@ -16,18 +16,17 @@ class BasicAgent:
|
|
| 16 |
def __init__(self):
|
| 17 |
print("BasicAgent initialized.")
|
| 18 |
|
| 19 |
-
# 初始化 OpenAIServerModel 实例,用于与 DeepSeek 的语言模型交互
|
| 20 |
model = OpenAIServerModel(
|
| 21 |
-
model_id="deepseek-chat",
|
| 22 |
api_key="sk-04da63f756c9468182d278f52e33ad15",
|
| 23 |
-
api_base="https://api.deepseek.com",
|
| 24 |
)
|
| 25 |
-
|
| 26 |
search_tool = DuckDuckGoSearchTool()
|
| 27 |
-
|
| 28 |
self.agent = CodeAgent(
|
| 29 |
-
model = model,
|
| 30 |
-
tools=[search_tool]
|
| 31 |
)
|
| 32 |
def __call__(self, question: str) -> str:
|
| 33 |
"""
|
|
@@ -39,10 +38,10 @@ class BasicAgent:
|
|
| 39 |
Returns:
|
| 40 |
str: Agent 生成的回答
|
| 41 |
"""
|
| 42 |
-
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 43 |
-
fixed_answer = self.agent.run(question)
|
| 44 |
-
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 45 |
-
return fixed_answer
|
| 46 |
|
| 47 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 48 |
"""
|
|
|
|
| 16 |
def __init__(self):
|
| 17 |
print("BasicAgent initialized.")
|
| 18 |
|
|
|
|
| 19 |
model = OpenAIServerModel(
|
| 20 |
+
model_id="deepseek-chat",
|
| 21 |
api_key="sk-04da63f756c9468182d278f52e33ad15",
|
| 22 |
+
api_base="https://api.deepseek.com",
|
| 23 |
)
|
| 24 |
+
|
| 25 |
search_tool = DuckDuckGoSearchTool()
|
| 26 |
+
|
| 27 |
self.agent = CodeAgent(
|
| 28 |
+
model = model,
|
| 29 |
+
tools=[search_tool]
|
| 30 |
)
|
| 31 |
def __call__(self, question: str) -> str:
|
| 32 |
"""
|
|
|
|
| 38 |
Returns:
|
| 39 |
str: Agent 生成的回答
|
| 40 |
"""
|
| 41 |
+
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 42 |
+
fixed_answer = self.agent.run(question)
|
| 43 |
+
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 44 |
+
return fixed_answer
|
| 45 |
|
| 46 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 47 |
"""
|