Skip to content
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

Fix sequential agents unable to use skills and uploads. #65

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions backend/app/core/graph/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,13 @@ def convert_hierarchical_team_to_dict(
return teams


def convert_sequential_team_to_dict(team: Team) -> Mapping[str, GraphMember]:
def convert_sequential_team_to_dict(members: list[Member]) -> Mapping[str, GraphMember]:
team_dict: dict[str, GraphMember] = {}

in_counts: defaultdict[int, int] = defaultdict(int)
out_counts: defaultdict[int, list[int]] = defaultdict(list[int])
members_lookup: dict[int, Member] = {}

for member in team.members:
for member in members:
assert member.id is not None, "member.id is unexpectedly None"
if member.source:
in_counts[member.id] += 1
Expand All @@ -171,7 +170,7 @@ def convert_sequential_team_to_dict(team: Team) -> Mapping[str, GraphMember]:
managed=skill.managed,
definition=skill.tool_definition,
)
for skill in member.skills
for skill in memberModel.skills
]
tools += [
GraphUpload(
Expand All @@ -180,7 +179,7 @@ def convert_sequential_team_to_dict(team: Team) -> Mapping[str, GraphMember]:
owner_id=upload.owner_id,
upload_id=cast(int, upload.id),
)
for upload in member.uploads
for upload in memberModel.uploads
if upload.owner_id is not None
]
graph_member = GraphMember(
Expand Down Expand Up @@ -453,7 +452,6 @@ async def generator(

try:
memory = await AsyncPostgresSaver.from_conn_string(settings.PG_DATABASE_URI)

if team.workflow == "hierarchical":
teams = convert_hierarchical_team_to_dict(team, members)
team_leader = list(teams.keys())[0]
Expand All @@ -466,7 +464,7 @@ async def generator(
"main_task": formatted_messages,
}
else:
member_dict = convert_sequential_team_to_dict(team)
member_dict = convert_sequential_team_to_dict(members)
root = create_sequential_graph(member_dict, memory)
first_member = list(member_dict.values())[0]
state = {
Expand Down