Skip to content

Commit eec6858

Browse files
committed
arch(core): add sop block schema
1 parent 3ede491 commit eec6858

5 files changed

Lines changed: 47 additions & 4 deletions

File tree

src/server/core/acontext_core/llm/prompt/task_sop.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ def prompt_kwargs(cls) -> str:
2828
@classmethod
2929
def tool_schema(cls) -> list[ToolSchema]:
3030
pass
31+
32+
33+
[{"use_when": str, "notes": str, "sop": list[dict]}]
34+
[{"use_when": str, "notes": str}]
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from pydantic import BaseModel
2+
from typing import List, Optional, Any
3+
from ..utils import asUUID
4+
5+
6+
class SOPStep(BaseModel):
7+
tool_name: str
8+
tool_arguments_with_placeholder: dict[str, Any]
9+
purpose_annotation: Optional[str] = None
10+
11+
12+
class SOPData(BaseModel):
13+
use_when: str
14+
notes: str
15+
sop: List[SOPStep]
16+
17+
18+
class SOPBlock(SOPData):
19+
id: asUUID
20+
space_id: asUUID
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from pydantic import BaseModel
2+
from typing import List, Optional
3+
from ..utils import asUUID
4+
5+
6+
class TextData(BaseModel):
7+
use_when: str
8+
notes: str
9+
10+
11+
class TextBlock(TextData):
12+
id: asUUID
13+
space_id: asUUID

src/server/core/acontext_core/schema/orm/tool_reference.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from dataclasses import dataclass, field
2-
from sqlalchemy import ForeignKey, Index, Column
2+
from optparse import Option
3+
from sqlalchemy import ForeignKey, Index, Column, String
34
from sqlalchemy.orm import relationship
45
from sqlalchemy.dialects.postgresql import JSONB, UUID
56
from typing import TYPE_CHECKING, Optional, List
@@ -21,6 +22,8 @@ class ToolReference(CommonMixin):
2122

2223
__table_args__ = (Index("ix_tool_reference_project_id", "project_id"),)
2324

25+
tool_name: str = field(metadata={"db": Column(String, nullable=False)})
26+
2427
project_id: asUUID = field(
2528
metadata={
2629
"db": Column(
@@ -30,8 +33,10 @@ class ToolReference(CommonMixin):
3033
)
3134
}
3235
)
33-
34-
configs: Optional[dict] = field(
36+
tool_description: Optional[str] = field(
37+
default=None, metadata={"db": Column(String, nullable=True)}
38+
)
39+
tool_arguments_schema: Optional[dict] = field(
3540
default=None, metadata={"db": Column(JSONB, nullable=True)}
3641
)
3742

src/server/core/acontext_core/schema/orm/tool_sop.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class ToolSOP(CommonMixin):
1919

2020
__table_args__ = (Index("ix_tool_sop_project_id", "project_id"),)
2121

22-
annotation: str = field(metadata={"db": Column(String, nullable=False)})
22+
purpose_annotation: str = field(metadata={"db": Column(String, nullable=False)})
23+
placeholder_arguments: dict = field(metadata={"db": Column(JSONB, nullable=False)})
2324

2425
tool_id: asUUID = field(
2526
metadata={

0 commit comments

Comments
 (0)