feat: add qdrant vector adapter
This commit is contained in:
@@ -17,6 +17,31 @@ class VectorRecord(BaseModel):
|
||||
metadata: dict = {}
|
||||
|
||||
|
||||
def qdrant_semantic_kind(kind: str) -> str:
|
||||
if kind in {"schema_table", "schema_column"}:
|
||||
return "schema"
|
||||
if kind in {"memory", "solved_question"}:
|
||||
return "memory"
|
||||
if kind == "evidence":
|
||||
return "evidence"
|
||||
raise ValueError(f"Unsupported vector kind: {kind}")
|
||||
|
||||
|
||||
def qdrant_payload(record: VectorRecord, *, content_hash: str, workspace_id: str) -> dict:
|
||||
semantic_kind = qdrant_semantic_kind(record.kind)
|
||||
return {
|
||||
"workspace_id": workspace_id,
|
||||
"kind": semantic_kind,
|
||||
"record_kind": record.kind,
|
||||
"record_key": record.id,
|
||||
"ref": record.ref,
|
||||
"title": record.title,
|
||||
"content": record.content,
|
||||
"content_hash": content_hash,
|
||||
**record.metadata,
|
||||
}
|
||||
|
||||
|
||||
def split_markdown(text: str, max_chars: int) -> list[str]:
|
||||
"""Spezza un markdown: intero se sta nel limite, altrimenti per heading '##',
|
||||
e in ultima istanza per accumulo greedy di righe."""
|
||||
|
||||
Reference in New Issue
Block a user