-
-
Notifications
You must be signed in to change notification settings - Fork 972
Expand file tree
/
Copy pathdeepseek_example.py
More file actions
37 lines (29 loc) · 913 Bytes
/
deepseek_example.py
File metadata and controls
37 lines (29 loc) · 913 Bytes
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
"""
Basic example of using DeepSeek with PraisonAI
"""
from praisonaiagents import Agent
# Initialize Agent with DeepSeek
agent = Agent(
instructions="You are a helpful assistant",
llm="deepseek/deepseek-chat",
)
# Example conversation
response = agent.start("Hello! Can you help me with a mathematical problem?")
# Example with mathematical reasoning
math_task = """
Solve this calculus problem step by step:
Find the derivative of f(x) = x^3 * e^(2x) using the product rule.
"""
response = agent.start(math_task)
# Example with code optimization
code_task = """
Optimize this Python function for better performance:
def find_duplicates(arr):
duplicates = []
for i in range(len(arr)):
for j in range(i+1, len(arr)):
if arr[i] == arr[j] and arr[i] not in duplicates:
duplicates.append(arr[i])
return duplicates
"""
response = agent.start(code_task)