Spaces:
Sleeping
Sleeping
Commit
·
e0a63a7
1
Parent(s):
b3038a0
Fix what_can_i_do tool: convert from decorated function to proper Tool class
Browse files
src/second_brain_online/application/agents/tools/what_can_i_do.py
CHANGED
|
@@ -1,11 +1,10 @@
|
|
| 1 |
import opik
|
| 2 |
-
from smolagents import
|
| 3 |
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
"""Returns a comprehensive list of available capabilities and topics in the Second Brain system.
|
| 9 |
|
| 10 |
This tool should be used when:
|
| 11 |
- The user explicitly asks what the system can do
|
|
@@ -16,23 +15,20 @@ def what_can_i_do(question: str) -> str:
|
|
| 16 |
This tool should NOT be used when:
|
| 17 |
- The user asks a specific technical question
|
| 18 |
- The user already knows what they want to learn about
|
| 19 |
-
- The question is about a specific topic covered in the knowledge base
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
question:
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
"""
|
| 34 |
-
|
| 35 |
-
return """
|
| 36 |
You can ask questions about the content in your Second Brain, such as:
|
| 37 |
|
| 38 |
Architecture and Systems:
|
|
@@ -58,3 +54,7 @@ RAG and Document Processing:
|
|
| 58 |
Learning Resources:
|
| 59 |
- Can you recommend courses on LLMs and RAG?
|
| 60 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import opik
|
| 2 |
+
from smolagents import Tool
|
| 3 |
|
| 4 |
|
| 5 |
+
class WhatCanIDoTool(Tool):
|
| 6 |
+
name = "what_can_i_do"
|
| 7 |
+
description = """Returns a comprehensive list of available capabilities and topics in the Second Brain system.
|
|
|
|
| 8 |
|
| 9 |
This tool should be used when:
|
| 10 |
- The user explicitly asks what the system can do
|
|
|
|
| 15 |
This tool should NOT be used when:
|
| 16 |
- The user asks a specific technical question
|
| 17 |
- The user already knows what they want to learn about
|
| 18 |
+
- The question is about a specific topic covered in the knowledge base"""
|
| 19 |
+
|
| 20 |
+
inputs = {
|
| 21 |
+
"question": {
|
| 22 |
+
"type": "string",
|
| 23 |
+
"description": "The user's query about system capabilities. While this parameter is required, the function returns a standard capability list regardless of the specific question."
|
| 24 |
+
}
|
| 25 |
+
}
|
| 26 |
+
output_type = "string"
|
| 27 |
+
|
| 28 |
+
@opik.track(name="what_can_i_do")
|
| 29 |
+
def forward(self, question: str) -> str:
|
| 30 |
+
"""Returns a comprehensive list of available capabilities and topics in the Second Brain system."""
|
| 31 |
+
return """
|
|
|
|
|
|
|
|
|
|
| 32 |
You can ask questions about the content in your Second Brain, such as:
|
| 33 |
|
| 34 |
Architecture and Systems:
|
|
|
|
| 54 |
Learning Resources:
|
| 55 |
- Can you recommend courses on LLMs and RAG?
|
| 56 |
"""
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
# Create an instance for backward compatibility
|
| 60 |
+
what_can_i_do = WhatCanIDoTool()
|