-
Notifications
You must be signed in to change notification settings - Fork 428
Expand file tree
/
Copy pathfaq_agent.py
More file actions
76 lines (65 loc) · 2.31 KB
/
Copy pathfaq_agent.py
File metadata and controls
76 lines (65 loc) · 2.31 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
76
"""
Bindu Docs QA Agent 🌻
Answers questions about Bindu documentation.
"""
import os
from dotenv import load_dotenv
load_dotenv()
from bindu.penguin.bindufy import bindufy
from agno.agent import Agent
from agno.models.openrouter import OpenRouter
from agno.tools.duckduckgo import DuckDuckGoTools
# ---------------------------------------------------------------------------
# Agent Configuration
# ---------------------------------------------------------------------------
agent = Agent(
name="Bindu Docs Agent",
instructions="""
You are an expert assistant for Bindu (GetBindu).
TASK:
1. Search the Bindu documentation (docs.getbindu.com) for the user's query.
2. Answer the question clearly.
FORMATTING RULES:
- Return your answer in CLEAN Markdown.
- Use '##' for main headers.
- Use bullet points for lists.
- Do NOT wrap the entire response in JSON code blocks. Just return the text.
- At the end, include a '### Sources' section with links found.
""",
model=OpenRouter(
id="openai/gpt-oss-120b",
api_key=os.getenv("OPENROUTER_API_KEY"),
),
tools=[DuckDuckGoTools()],
markdown=True,
)
# ---------------------------------------------------------------------------
# Handler (FIXED)
# ---------------------------------------------------------------------------
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 config
# ---------------------------------------------------------------------------
config = {
"author": "your.email@example.com",
"name": "bindu_docs_agent",
"description": "Answers questions about Bindu documentation",
"deployment": {
"url": "http://localhost:3773",
"expose": True,
"cors_origins": ["http://localhost:5173"]
},
"skills": ["skills/question-answering", "skills/pdf-processing"],
}
# Run the Bindu wrapper
bindufy(config, handler)
# if you want to use tunnel to expose your agent to the internet, use the following command
#bindufy(config, handler, launch=True)