Spaces:
Running
Running
Charles Grandjean
commited on
Commit
·
0e4f8b2
1
Parent(s):
feaadb6
fix the tool
Browse files- utils/__init__.py +18 -0
- utils/tools.py +22 -0
utils/__init__.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Utils package for CyberLegalAI
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
from utils.lawyer_profile_formatter import (
|
| 7 |
+
format_lawyer_profile_from_api,
|
| 8 |
+
format_lawyer_profiles_from_response,
|
| 9 |
+
get_lawyer_profile_summary,
|
| 10 |
+
format_lawyers_as_string
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
__all__ = [
|
| 14 |
+
'format_lawyer_profile_from_api',
|
| 15 |
+
'format_lawyer_profiles_from_response',
|
| 16 |
+
'get_lawyer_profile_summary',
|
| 17 |
+
'format_lawyers_as_string'
|
| 18 |
+
]
|
utils/tools.py
CHANGED
|
@@ -53,6 +53,28 @@ async def _query_knowledge_graph(
|
|
| 53 |
conversation_history: List[Dict[str, str]],
|
| 54 |
jurisdiction: Optional[str] = None
|
| 55 |
) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
try:
|
| 57 |
# Validate jurisdiction if provided
|
| 58 |
if jurisdiction:
|
|
|
|
| 53 |
conversation_history: List[Dict[str, str]],
|
| 54 |
jurisdiction: Optional[str] = None
|
| 55 |
) -> str:
|
| 56 |
+
"""
|
| 57 |
+
Query the legal knowledge graph for relevant information about cyber regulations and directives.
|
| 58 |
+
|
| 59 |
+
This tool searches through a comprehensive knowledge graph containing legal documents,
|
| 60 |
+
regulations, and directives related to law
|
| 61 |
+
|
| 62 |
+
The knowledge graph is dynamically selected based on jurisdiction:
|
| 63 |
+
- Romania: Romanian law documents
|
| 64 |
+
- Bahrain: Bahraini law documents
|
| 65 |
+
- Default: Falls back to default port if jurisdiction not specified
|
| 66 |
+
|
| 67 |
+
Use this tool when answering legal questions to provide accurate, up-to-date information
|
| 68 |
+
from official legal sources specific to the user's jurisdiction.
|
| 69 |
+
|
| 70 |
+
Args:
|
| 71 |
+
query: The legal question or topic to search for in the knowledge graph
|
| 72 |
+
conversation_history: Optional conversation history for context (automatically provided by the agent)
|
| 73 |
+
jurisdiction: The jurisdiction name (e.g., "romania", "bahrain") to query the appropriate graph
|
| 74 |
+
|
| 75 |
+
Returns:
|
| 76 |
+
Relevant legal information from the knowledge graph with context and references
|
| 77 |
+
"""
|
| 78 |
try:
|
| 79 |
# Validate jurisdiction if provided
|
| 80 |
if jurisdiction:
|