-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat: introduce culture #5124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: introduce culture #5124
Conversation
|
|
||
| return await self.db.get_cultural_knowledge(id=id) | ||
|
|
||
| def get_all_knowledge(self, name: Optional[str] = None) -> Optional[List[CulturalKnowledge]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_knowledge and get_all_knowledge can be combined with optional filters for id and name?
Btw why is name here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can be combined. We should do the same for Memory.
- Name is there as potential filter
| message: Optional[str] = None, | ||
| messages: Optional[List[Message]] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually a good pattern? It made sense when we had message and messages, but should it not just be str for our experiment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
message is used when we generate the item given the user message, messages when it's based on a conversation --- it could totally be just messages here. Would need refactor in the agent logic
We should also adjust for both memory and culture
|
|
||
|
|
||
| @dataclass | ||
| class CultureManager: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt about a base class, and then we have CultureManager and AsyncCultureManager with the same functions, but one is sync and other is async?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I think that is a better pattern for these kinds of classes (we should do memory like that as well I think)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah good - we actually just introduced that pattern with the async dbs. It is cleaner.
We should also adjust for both memory and culture
|
|
||
| return response | ||
|
|
||
| def update_culture_task(self, task: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the difference really with the above? Could they be the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These orchestrate generation of the learning, the other ones are to persist the generated learning I think. The pattern comes from the MemoryManager too. Combining both would simplify usage from the Agent if I'm understanding the setup
We should adjust for both memory and culture
| return Message(role="system", content=self.system_message) | ||
|
|
||
| # Default capture instructions | ||
| culture_capture_instructions = self.culture_capture_instructions or dedent( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only such a small part is configurable... but this is fine for now
Changes: - Introduces a Culture Manager to define and manage the cultural context within your Agents. - Related cookbooks showing usage --------- Co-authored-by: Ashpreet <[email protected]> Co-authored-by: Yash Pratap Solanky <[email protected]> Co-authored-by: ysolanky <[email protected]>
Changes: