000c969b13
Check Cross-Plugin Imports / check (push) Has been cancelled
5.5 Plugin-Marketplace: - New plugin: marketplace/ (models, routes, services, schemas, config) - MarketplaceListing model (global, no tenant_id) - Ed25519 signature verification via PluginSignature - Endpoints: list, detail, install, verify, categories - Config: MARKETPLACE_SERVER_URL setting 5.6 Agent Memory (persistent): - New plugin: agent_memory/ (models, routes, services, schemas) - AgentMemory model with embedding vector(768) + HNSW index - store_memory() with auto-embedding - retrieve_relevant_memories() with pgvector cosine similarity - Semantic search endpoint 5.7 GraphRAG: - New plugin: graph_rag/ (models, routes, services, provider, schemas) - EntityRelationship model (source/target type+id, relationship_type, metadata) - BFS graph traversal (bidirectional, configurable depth) - GraphRAGSearchProvider registered in unified_search 5.8 Subagents / Multi-Agent: - AgentCoordinator class (create_subtask, wait_for_subtask, aggregate, cancel) - AgentSubtask model + migration 0002_agent_subtasks.sql - 6 new API endpoints for subtask management - Tools registered in AI tool registry 5.9 External Agent API: - external_api.py: POST /run, GET /status, POST /stream (SSE) - Bearer API token authentication - Rate limiting: 10 req/min per token - ExternalAgentRequest/Response schemas 3 new plugins registered in main.py and __init__.py All files py_compile clean
60 lines
1.9 KiB
Python
60 lines
1.9 KiB
Python
"""Pydantic schemas for the GraphRAG plugin."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Any
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class RelationshipCreate(BaseModel):
|
|
source_type: str = Field(..., max_length=50, description="Entity type of the source (e.g. 'contact', 'company')")
|
|
source_id: str = Field(..., description="UUID of the source entity")
|
|
target_type: str = Field(..., max_length=50, description="Entity type of the target (e.g. 'email', 'task')")
|
|
target_id: str = Field(..., description="UUID of the target entity")
|
|
relationship_type: str = Field(..., max_length=50, description="Type of relationship (e.g. 'works_for', 'has_email')")
|
|
metadata: dict[str, Any] | None = Field(None, description="Arbitrary metadata about the relationship")
|
|
|
|
|
|
class RelationshipRead(BaseModel):
|
|
id: str
|
|
source_type: str
|
|
source_id: str
|
|
target_type: str
|
|
target_id: str
|
|
relationship_type: str
|
|
metadata: dict[str, Any] | None = None
|
|
owner_id: str | None = None
|
|
created_at: datetime | None = None
|
|
|
|
|
|
class TraverseRequest(BaseModel):
|
|
source_type: str = Field(..., max_length=50, description="Entity type of the starting node")
|
|
source_id: str = Field(..., description="UUID of the starting node")
|
|
max_hops: int = Field(3, ge=1, le=10, description="Maximum traversal depth")
|
|
relationship_types: list[str] | None = Field(None, description="Optional filter by relationship types")
|
|
|
|
|
|
class GraphNode(BaseModel):
|
|
entity_type: str
|
|
entity_id: str
|
|
depth: int
|
|
path: list[str] = []
|
|
|
|
|
|
class GraphEdge(BaseModel):
|
|
source_type: str
|
|
source_id: str
|
|
target_type: str
|
|
target_id: str
|
|
relationship_type: str
|
|
metadata: dict[str, Any] | None = None
|
|
|
|
|
|
class TraverseResponse(BaseModel):
|
|
nodes: list[GraphNode]
|
|
edges: list[GraphEdge]
|
|
total_nodes: int
|
|
total_edges: int
|