Skip to content

Commit db53d34

Browse files
committed
[BUGFIX][Conversation][Initialization parameters in the output]
1 parent 5e35bda commit db53d34

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

swarms/structs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from swarms.structs.batched_grid_workflow import BatchedGridWorkflow
1010
from swarms.structs.concurrent_workflow import ConcurrentWorkflow
1111
from swarms.structs.conversation import Conversation
12-
from swarms.structs.social_algorithms import SocialAlgorithms
1312
from swarms.structs.council_as_judge import CouncilAsAJudge
1413
from swarms.structs.cron_job import CronJob
1514
from swarms.structs.graph_workflow import (
@@ -62,6 +61,7 @@
6261
from swarms.structs.round_robin import RoundRobinSwarm
6362
from swarms.structs.self_moa_seq import SelfMoASeq
6463
from swarms.structs.sequential_workflow import SequentialWorkflow
64+
from swarms.structs.social_algorithms import SocialAlgorithms
6565
from swarms.structs.spreadsheet_swarm import SpreadSheetSwarm
6666
from swarms.structs.stopping_conditions import (
6767
check_cancelled,

swarms/structs/conversation.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -562,14 +562,11 @@ def save_as_json(self, force: bool = True):
562562
)
563563
return
564564

565-
# Get the full data including metadata and conversation history
566-
data = self.get_init_params()
567-
568565
# Ensure we have a valid save path
569566
if not self.save_filepath:
570567
self.save_filepath = os.path.join(
571568
self.conversations_dir or os.getcwd(),
572-
f"conversation_{self.name}.json",
569+
f"conversation_{self.id}.json",
573570
)
574571

575572
# Create directory if it doesn't exist
@@ -579,7 +576,12 @@ def save_as_json(self, force: bool = True):
579576

580577
# Save with proper formatting
581578
with open(self.save_filepath, "w", encoding="utf-8") as f:
582-
json.dump(data, f, indent=4, default=str)
579+
json.dump(
580+
self.conversation_history,
581+
f,
582+
indent=4,
583+
default=str,
584+
)
583585

584586
logger.info(f"Conversation saved to {self.save_filepath}")
585587

0 commit comments

Comments
 (0)