Skip to content

Commit f2260ce

Browse files
authored
Merge pull request #446 from ScrapeGraphAI/pre/beta
Pre/beta
2 parents 40bb024 + 62f5165 commit f2260ce

File tree

8 files changed

+44
-84
lines changed

8 files changed

+44
-84
lines changed

examples/anthropic/search_graph_schema_haiku.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
load_dotenv()
88

99
from scrapegraphai.graphs import SearchGraph
10-
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
1110

1211
from pydantic import BaseModel, Field
1312
from typing import List
@@ -45,14 +44,3 @@ class Dishes(BaseModel):
4544

4645
result = search_graph.run()
4746
print(result)
48-
49-
# ************************************************
50-
# Get graph execution info
51-
# ************************************************
52-
53-
graph_exec_info = search_graph.get_execution_info()
54-
print(prettify_exec_info(graph_exec_info))
55-
56-
# Save to json and csv
57-
convert_to_csv(result, "result")
58-
convert_to_json(result, "result")

examples/bedrock/search_graph_bedrock.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
from dotenv import load_dotenv
66
from scrapegraphai.graphs import SearchGraph
7-
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
87

98
load_dotenv()
109

@@ -33,14 +32,3 @@
3332

3433
result = search_graph.run()
3534
print(result)
36-
37-
# ************************************************
38-
# Get graph execution info
39-
# ************************************************
40-
41-
graph_exec_info = search_graph.get_execution_info()
42-
print(prettify_exec_info(graph_exec_info))
43-
44-
# Save to json and csv
45-
convert_to_csv(result, "result")
46-
convert_to_json(result, "result")

examples/deepseek/search_graph_deepseek.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
from dotenv import load_dotenv
77
from scrapegraphai.graphs import SearchGraph
8-
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
98
load_dotenv()
109

1110
# ************************************************
@@ -40,14 +39,3 @@
4039

4140
result = search_graph.run()
4241
print(result)
43-
44-
# ************************************************
45-
# Get graph execution info
46-
# ************************************************
47-
48-
graph_exec_info = search_graph.get_execution_info()
49-
print(prettify_exec_info(graph_exec_info))
50-
51-
# Save to json and csv
52-
convert_to_csv(result, "result")
53-
convert_to_json(result, "result")

examples/ernie/search_graph_ernie.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
from dotenv import load_dotenv
77
from scrapegraphai.graphs import SearchGraph
8-
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
8+
99
load_dotenv()
1010

1111
# ************************************************
@@ -34,14 +34,3 @@
3434

3535
result = search_graph.run()
3636
print(result)
37-
38-
# ************************************************
39-
# Get graph execution info
40-
# ************************************************
41-
42-
graph_exec_info = search_graph.get_execution_info()
43-
print(prettify_exec_info(graph_exec_info))
44-
45-
# Save to json and csv
46-
convert_to_csv(result, "result")
47-
convert_to_json(result, "result")
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"""
2+
Example of Search Graph
3+
"""
4+
5+
import os
6+
from dotenv import load_dotenv
7+
from scrapegraphai.graphs import SearchGraph
8+
from pydantic import BaseModel, Field
9+
from typing import List
10+
load_dotenv()
11+
12+
# ************************************************
13+
# Define the configuration for the graph
14+
# ************************************************
15+
class CeoName(BaseModel):
16+
ceo_name: str = Field(description="The name and surname of the ceo")
17+
18+
class Ceos(BaseModel):
19+
names: List[CeoName]
20+
21+
openai_key = os.getenv("OPENAI_APIKEY")
22+
23+
graph_config = {
24+
"llm": {
25+
"api_key": openai_key,
26+
"model": "gpt-4o",
27+
},
28+
"max_results": 2,
29+
"verbose": True,
30+
}
31+
32+
# ************************************************
33+
# Create the SearchGraph instance and run it
34+
# ************************************************
35+
36+
search_graph = SearchGraph(
37+
prompt=f"Who is the ceo of Appke?",
38+
schema = Ceos,
39+
config=graph_config,
40+
)
41+
42+
result = search_graph.run()
43+
print(result)

examples/fireworks/search_graph_fireworks.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
from dotenv import load_dotenv
77
from scrapegraphai.graphs import SearchGraph
8-
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
98

109
load_dotenv()
1110

@@ -43,14 +42,3 @@
4342

4443
result = search_graph.run()
4544
print(result)
46-
47-
# ************************************************
48-
# Get graph execution info
49-
# ************************************************
50-
51-
graph_exec_info = search_graph.get_execution_info()
52-
print(prettify_exec_info(graph_exec_info))
53-
54-
# Save to json and csv
55-
convert_to_csv(result, "result")
56-
convert_to_json(result, "result")

examples/oneapi/search_graph_oneapi.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"""
44

55
from scrapegraphai.graphs import SearchGraph
6-
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
76

87
# ************************************************
98
# Define the configuration for the graph
@@ -29,14 +28,3 @@
2928

3029
result = search_graph.run()
3130
print(result)
32-
33-
# ************************************************
34-
# Get graph execution info
35-
# ************************************************
36-
37-
graph_exec_info = search_graph.get_execution_info()
38-
print(prettify_exec_info(graph_exec_info))
39-
40-
# Save to json and csv
41-
convert_to_csv(result, "result")
42-
convert_to_json(result, "result")

examples/openai/search_graph_openai.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import os
66
from dotenv import load_dotenv
77
from scrapegraphai.graphs import SearchGraph
8-
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
98
load_dotenv()
109

1110
# ************************************************
@@ -34,14 +33,3 @@
3433

3534
result = search_graph.run()
3635
print(result)
37-
38-
# ************************************************
39-
# Get graph execution info
40-
# ************************************************
41-
42-
graph_exec_info = search_graph.get_execution_info()
43-
print(prettify_exec_info(graph_exec_info))
44-
45-
# Save to json and csv
46-
convert_to_csv(result, "result")
47-
convert_to_json(result, "result")

0 commit comments

Comments
 (0)