-
Notifications
You must be signed in to change notification settings - Fork 431
Expand file tree
/
Copy pathminimax_example.py
More file actions
75 lines (58 loc) · 1.85 KB
/
Copy pathminimax_example.py
File metadata and controls
75 lines (58 loc) · 1.85 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""MiniMax AI Research Agent
A Bindu agent powered by MiniMax's M3 model via OpenAI-compatible API.
MiniMax offers high-performance models with up to 1M context window.
Features:
- MiniMax M3 model (1M context)
- Web search integration via DuckDuckGo
- Research and summarization capabilities
Usage:
python minimax_example.py
Environment:
Requires MINIMAX_API_KEY in .env file
Get your API key at https://platform.minimaxi.com
"""
import os
from bindu.penguin.bindufy import bindufy
from agno.agent import Agent
from agno.tools.duckduckgo import DuckDuckGoTools
from agno.models.openai import OpenAILike
from dotenv import load_dotenv
load_dotenv()
# MiniMax API configuration
MINIMAX_API_KEY = os.getenv("MINIMAX_API_KEY")
MINIMAX_BASE_URL = "https://api.minimax.io/v1"
# Define your agent with MiniMax M3
agent = Agent(
instructions="You are a research assistant that finds and summarizes information.",
model=OpenAILike(
id="MiniMax-M3",
api_key=MINIMAX_API_KEY,
base_url=MINIMAX_BASE_URL,
),
tools=[DuckDuckGoTools()],
)
# Configuration
config = {
"author": "your.email@example.com",
"name": "minimax_research_agent",
"description": "A research assistant agent powered by MiniMax AI",
"deployment": {
"url": os.getenv("BINDU_DEPLOYMENT_URL", "http://localhost:3773"),
"expose": True,
"cors_origins": ["http://localhost:5173"]
},
"skills": ["skills/question-answering", "skills/pdf-processing"]
}
# Handler function
def handler(messages: list[dict[str, str]]):
"""Process messages and return agent response.
Args:
messages: List of message dictionaries containing conversation history
Returns:
Agent response result
"""
result = agent.run(input=messages)
return result
# Bindu-fy it
if __name__ == "__main__":
bindufy(config, handler)