feat: RAG service (#1220)
This commit is contained in:
0
py/rag-service/src/models/__init__.py
Normal file
0
py/rag-service/src/models/__init__.py
Normal file
19
py/rag-service/src/models/indexing_history.py
Normal file
19
py/rag-service/src/models/indexing_history.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""Indexing History Model."""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class IndexingHistory(BaseModel):
|
||||
"""Model for indexing history record."""
|
||||
|
||||
id: int | None = Field(None, description="Record ID")
|
||||
uri: str = Field(..., description="URI of the indexed file")
|
||||
content_hash: str = Field(..., description="MD5 hash of the file content")
|
||||
status: str = Field(..., description="Indexing status (indexing/completed/failed)")
|
||||
timestamp: datetime = Field(default_factory=datetime.now, description="Record timestamp")
|
||||
error_message: str | None = Field(None, description="Error message if failed")
|
||||
document_id: str | None = Field(None, description="Document ID in the index")
|
||||
metadata: dict[str, Any] | None = Field(None, description="Additional metadata")
|
||||
25
py/rag-service/src/models/resource.py
Normal file
25
py/rag-service/src/models/resource.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""Resource Model."""
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class Resource(BaseModel):
|
||||
"""Model for resource record."""
|
||||
|
||||
id: int | None = Field(None, description="Resource ID")
|
||||
name: str = Field(..., description="Name of the resource")
|
||||
uri: str = Field(..., description="URI of the resource")
|
||||
type: Literal["local", "remote"] = Field(..., description="Type of resource (path/https)")
|
||||
status: str = Field("active", description="Status of resource (active/inactive)")
|
||||
indexing_status: Literal["pending", "indexing", "indexed", "failed"] = Field(
|
||||
"pending",
|
||||
description="Indexing status (pending/indexing/indexed/failed)",
|
||||
)
|
||||
indexing_status_message: str | None = Field(None, description="Indexing status message")
|
||||
created_at: datetime = Field(default_factory=datetime.now, description="Creation timestamp")
|
||||
indexing_started_at: datetime | None = Field(None, description="Indexing start timestamp")
|
||||
last_indexed_at: datetime | None = Field(None, description="Last indexing timestamp")
|
||||
last_error: str | None = Field(None, description="Last error message if any")
|
||||
Reference in New Issue
Block a user