74 lines
2.1 KiB
Python
74 lines
2.1 KiB
Python
"""
|
|
FILE: app/routers/tools.py
|
|
DESCRIPTION: Liefert JSON-Schemas für die Integration als 'Tools' in Agents (Ollama/OpenAI). Read-Only.
|
|
VERSION: 0.1.1
|
|
STATUS: Active
|
|
DEPENDENCIES: fastapi
|
|
LAST_ANALYSIS: 2025-12-15
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
from fastapi import APIRouter
|
|
|
|
router = APIRouter()
|
|
|
|
TOOLS = {
|
|
"tools": [
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "mindnet_query",
|
|
"description": "Hybrid-Retrieval über mindnet (Semantik + Edges).",
|
|
"parameters": {
|
|
"type": "object",
|
|
"oneOf": [
|
|
{"required": ["query"]},
|
|
{"required": ["query_vector"]}
|
|
],
|
|
"properties": {
|
|
"query": {
|
|
"type": "string",
|
|
"description": "Freitext-Query; wird serverseitig in 384-d Embedding konvertiert."
|
|
},
|
|
"query_vector": {
|
|
"type": "array",
|
|
"items": {"type": "number"},
|
|
"description": "Direkter 384-d Query-Vektor (optional)."
|
|
},
|
|
"top_k": {"type":"integer","default":10,"minimum":1,"maximum":50},
|
|
"expand_depth": {"type":"integer","default":1,"minimum":0,"maximum":3},
|
|
"edge_types": {
|
|
"type":"array","items":{"type":"string"},
|
|
"default": ["references","belongs_to","prev","next"]
|
|
},
|
|
"filters": {"type":"object","description":"payload-Filter (tags etc.)"}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"type": "function",
|
|
"function": {
|
|
"name": "mindnet_subgraph",
|
|
"description": "Gibt die Nachbarschaft (Edges) einer Note/Seed-ID zurück.",
|
|
"parameters": {
|
|
"type":"object",
|
|
"properties": {
|
|
"note_id":{"type":"string"},
|
|
"depth":{"type":"integer","default":1,"minimum":0,"maximum":3},
|
|
"edge_types":{
|
|
"type":"array","items":{"type":"string"},
|
|
"default":["references","belongs_to","prev","next","backlink"]
|
|
}
|
|
},
|
|
"required":["note_id"]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
|
|
@router.get("/ollama")
|
|
def get_ollama_tools():
|
|
return TOOLS
|