File size: 776 Bytes
6e50eae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import nest_asyncio
nest_asyncio.apply()
# if you plan on using text_to_speech and GPT4-Vision models be sure to use the
# correct APIKEY
OPENAI_API_KEY = "YOUR API KEY"
GOOGLE_API_KEY = "YOUR API KEY"

from scrapegraphai.graphs import SearchGraph

# Define the configuration for the graph
graph_config = {
    "llm": {
        "api_key": 'OPENAI_API_KEY',
        "model": "gpt-3.5-turbo",
        "temperature": 0,
    },
}

# Create the SearchGraph instance
search_graph = SearchGraph(
    prompt="List me all the attributes of 'cannabis strain'.",
    config=graph_config
)

result = search_graph.run()
import json

output = json.dumps(result, indent=2)

line_list = output.split("\n")  # Sort of line replacing "\n" with a new line

for line in line_list:
    print(line)