fix(deepcopy): switch whether we have obj in the config

This commit is contained in:
Marco Perini 2024-05-17 10:36:39 +02:00
parent b4cfcb100d
commit d4d913c8a3
2 changed files with 12 additions and 4 deletions

View File

@ -2,7 +2,7 @@
OmniSearchGraph Module
"""
from copy import copy
from copy import copy, deepcopy
from .base_graph import BaseGraph
from ..nodes import (
@ -43,7 +43,11 @@ class OmniSearchGraph(AbstractGraph):
def __init__(self, prompt: str, config: dict):
self.max_results = config.get("max_results", 3)
self.copy_config = copy(config)
if all(isinstance(value, str) for value in config.values()):
self.copy_config = copy(config)
else:
self.copy_config = deepcopy(config)
super().__init__(prompt, config)

View File

@ -2,7 +2,7 @@
SearchGraph Module
"""
from copy import copy
from copy import copy, deepcopy
from .base_graph import BaseGraph
from ..nodes import (
@ -42,7 +42,11 @@ class SearchGraph(AbstractGraph):
def __init__(self, prompt: str, config: dict):
self.max_results = config.get("max_results", 3)
self.copy_config = copy(config)
if all(isinstance(value, str) for value in config.values()):
self.copy_config = copy(config)
else:
self.copy_config = deepcopy(config)
super().__init__(prompt, config)