fix(searchgraph): used shallow copy to serialize obj

This commit is contained in:
Marco Perini 2024-05-15 15:05:47 +02:00
parent 24d56af97c
commit 096b665c01
4 changed files with 6 additions and 5 deletions

2
.gitignore vendored
View File

@ -31,4 +31,6 @@ examples/graph_examples/ScrapeGraphAI_generated_graph
examples/**/result.csv examples/**/result.csv
examples/**/result.json examples/**/result.json
main.py main.py
*.python-version
*.lock

View File

@ -10,7 +10,6 @@ authors = [
{ name = "Lorenzo Padoan", email = "lorenzo.padoan977@gmail.com" } { name = "Lorenzo Padoan", email = "lorenzo.padoan977@gmail.com" }
] ]
dependencies = [ dependencies = [
# python = ">=3.9, <3.12"
"langchain==0.1.15", "langchain==0.1.15",
"langchain-openai==0.1.6", "langchain-openai==0.1.6",
"langchain-google-genai==1.0.3", "langchain-google-genai==1.0.3",

View File

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

View File

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