aboutsummaryrefslogtreecommitdiff
path: root/autogpts/autogpt/autogpt/core/ability/schema.py
diff options
context:
space:
mode:
Diffstat (limited to 'autogpts/autogpt/autogpt/core/ability/schema.py')
-rw-r--r--autogpts/autogpt/autogpt/core/ability/schema.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/autogpts/autogpt/autogpt/core/ability/schema.py b/autogpts/autogpt/autogpt/core/ability/schema.py
new file mode 100644
index 000000000..3d20a7b92
--- /dev/null
+++ b/autogpts/autogpt/autogpt/core/ability/schema.py
@@ -0,0 +1,30 @@
+import enum
+from typing import Any
+
+from pydantic import BaseModel
+
+
+class ContentType(str, enum.Enum):
+ # TBD what these actually are.
+ TEXT = "text"
+ CODE = "code"
+
+
+class Knowledge(BaseModel):
+ content: str
+ content_type: ContentType
+ content_metadata: dict[str, Any]
+
+
+class AbilityResult(BaseModel):
+ """The AbilityResult is a standard response struct for an ability."""
+
+ ability_name: str
+ ability_args: dict[str, str]
+ success: bool
+ message: str
+ new_knowledge: Knowledge = None
+
+ def summary(self) -> str:
+ kwargs = ", ".join(f"{k}={v}" for k, v in self.ability_args.items())
+ return f"{self.ability_name}({kwargs}): {self.message}"