Skip to content

Commit 66a29bc

Browse files
refactoring of the openai examples
Co-Authored-By: Matteo Vedovati <[email protected]>
1 parent 1fb711a commit 66a29bc

18 files changed

+29
-25
lines changed

examples/openai/csv_scraper_graph_multi_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
graph_config = {
2828
"llm": {
2929
"api_key": openai_key,
30-
"model": "gpt-3.5-turbo",
30+
"model": "gpt-4o",
3131
},
3232
}
3333

examples/openai/csv_scraper_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
graph_config = {
2929
"llm": {
3030
"api_key": openai_key,
31-
"model": "gpt-3.5-turbo",
31+
"model": "gpt-4o",
3232
},
3333
}
3434

examples/openai/custom_graph_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
graph_config = {
2020
"llm": {
2121
"api_key": openai_key,
22-
"model": "gpt-3.5-turbo",
22+
"model": "gpt-4o",
2323
},
2424
}
2525

examples/openai/deep_scraper_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
graph_config = {
1919
"llm": {
2020
"api_key": openai_key,
21-
"model": "gpt-4",
21+
"model": "gpt-4o",
2222
},
2323
"verbose": True,
2424
"max_depth": 1

examples/openai/json_scraper_multi_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
graph_config = {
1414
"llm": {
1515
"api_key": openai_key,
16-
"model": "gpt-3.5-turbo",
16+
"model": "gpt-4o",
1717
}
1818
}
1919

examples/openai/json_scraper_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
graph_config = {
2929
"llm": {
3030
"api_key": openai_key,
31-
"model": "gpt-3.5-turbo",
31+
"model": "gpt-4o",
3232
},
3333
}
3434

examples/openai/md_scraper_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
graph_config = {
2929
"llm": {
3030
"api_key": openai_key,
31-
"model": "gpt-3.5-turbo",
31+
"model": "gpt-4o",
3232
},
3333
}
3434

examples/openai/pdf_scraper_multi_openai.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
"""
44
import os
55
import json
6+
from typing import List
67
from dotenv import load_dotenv
7-
from scrapegraphai.graphs import PdfScraperMultiGraph
8-
98
from pydantic import BaseModel, Field
10-
from typing import List
9+
from scrapegraphai.graphs import PdfScraperMultiGraph
1110

1211
load_dotenv()
1312

@@ -20,7 +19,7 @@
2019
graph_config = {
2120
"llm": {
2221
"api_key": openai_key,
23-
"model": "gpt-3.5-turbo",
22+
"model": "gpt-4o",
2423
},
2524
"verbose": True,
2625
}

examples/openai/pdf_scraper_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
graph_config = {
1515
"llm": {
1616
"api_key": openai_key,
17-
"model": "gpt-3.5-turbo",
17+
"model": "gpt-4o",
1818
},
1919
"verbose": True,
2020
}

examples/openai/scrape_plain_text_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
graph_config = {
3131
"llm": {
3232
"api_key": openai_key,
33-
"model": "gpt-3.5-turbo",
33+
"model": "gpt-4o",
3434
},
3535
}
3636

examples/openai/script_generator_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
graph_config = {
1919
"llm": {
2020
"api_key": openai_key,
21-
"model": "gpt-3.5-turbo",
21+
"model": "gpt-4o",
2222
},
2323
"library": "beautifulsoup"
2424
}

examples/openai/search_graph_schema_openai.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@
33
"""
44

55
import os
6+
from typing import List
67
from dotenv import load_dotenv
7-
load_dotenv()
8-
8+
from pydantic import BaseModel, Field
99
from scrapegraphai.graphs import SearchGraph
1010
from scrapegraphai.utils import convert_to_csv, convert_to_json, prettify_exec_info
1111

12-
from pydantic import BaseModel, Field
13-
from typing import List
12+
load_dotenv()
1413

1514
# ************************************************
1615
# Define the output schema for the graph

examples/openai/search_link_graph_openai.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
"""
22
Basic example of scraping pipeline using SmartScraper
33
"""
4+
5+
import os
6+
from dotenv import load_dotenv
47
from scrapegraphai.graphs import SearchLinkGraph
58
from scrapegraphai.utils import prettify_exec_info
9+
10+
load_dotenv()
611
# ************************************************
712
# Define the configuration for the graph
813
# ************************************************
914

15+
openai_key = os.getenv("OPENAI_APIKEY")
16+
1017
graph_config = {
1118
"llm": {
12-
"api_key": "s",
13-
"model": "gpt-3.5-turbo",
19+
"api_key": openai_key,
20+
"model": "gpt-4o",
1421
},
1522
"verbose": True,
1623
"headless": False,

examples/openai/smart_scraper_schema_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Projects(BaseModel):
3030
graph_config = {
3131
"llm": {
3232
"api_key":openai_key,
33-
"model": "gpt-3.5-turbo",
33+
"model": "gpt-4o",
3434
},
3535
"verbose": True,
3636
"headless": False,

examples/openai/speech_graph_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
graph_config = {
2626
"llm": {
2727
"api_key": openai_key,
28-
"model": "gpt-3.5-turbo",
28+
"model": "gpt-4o",
2929
"temperature": 0.7,
3030
},
3131
"tts_model": {

examples/openai/xml_scraper_graph_multi_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
graph_config = {
3030
"llm": {
3131
"api_key":openai_key,
32-
"model": "gpt-3.5-turbo",
32+
"model": "gpt-4o",
3333
},
3434
"verbose": True,
3535
"headless": False,

examples/openai/xml_scraper_openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
graph_config = {
2929
"llm": {
3030
"api_key": openai_key,
31-
"model": "gpt-3.5-turbo",
31+
"model": "gpt-4o",
3232
},
3333
"verbose":False,
3434
}

scrapegraphai/graphs/search_graph.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def __init__(self, prompt: str, config: dict, schema: Optional[BaseModel] = None
5353
self.copy_config = copy(config)
5454
else:
5555
self.copy_config = deepcopy(config)
56-
5756
self.copy_schema = deepcopy(schema)
5857
self.considered_urls = [] # New attribute to store URLs
5958

0 commit comments

Comments
 (0)