Introduce structure keys (#902)

* Introduce structure keys

* Add agent key to tasks

* Rebasing is hard

* Rename task output telemetry

* Feedback
This commit is contained in:
Gui Vieira
2024-07-15 19:37:07 -03:00
committed by GitHub
parent 161c4a6856
commit dd8a199e99
7 changed files with 133 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
import uuid
from abc import ABC, abstractmethod
from copy import copy as shallow_copy
from hashlib import md5
from typing import Any, Dict, List, Optional, TypeVar
from pydantic import (
@@ -162,6 +163,11 @@ class BaseAgent(ABC, BaseModel):
self._token_process = TokenProcess()
return self
@property
def key(self):
source = [self.role, self.goal, self.backstory]
return md5("|".join(source).encode()).hexdigest()
@abstractmethod
def execute_task(
self,