File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -239,6 +239,36 @@ The output for all 3 the cases will be a dictionary with the extracted informati
239
239
}
240
240
```
241
241
242
+ ### Case 7: Extract informations with LocalAI
243
+
244
+ For LocalAI, the OpenAI client can be used by specifing a "fake" ` OPENAI_API_KEY ` ( there is no need to specify a real OpenAI key ):
245
+
246
+ ``` python
247
+ from scrapegraphai.graphs import SmartScraperGraph
248
+
249
+ # Note: You can actually leave as-is
250
+ OPENAI_API_KEY = " YOUR_API_KEY"
251
+
252
+ graph_config = {
253
+ " llm" : {
254
+ " api_key" : OPENAI_API_KEY ,
255
+ " model" : " gpt-4" ,
256
+ " temperature" : 0 ,
257
+ " base_url" : " http://localhost:8080" ,
258
+ },
259
+ }
260
+
261
+ smart_scraper_graph = SmartScraperGraph(
262
+ prompt = " List me all the articles" ,
263
+ # also accepts a string with the already downloaded HTML code
264
+ source = " https://perinim.github.io/projects" ,
265
+ config = graph_config
266
+ )
267
+
268
+ result = smart_scraper_graph.run()
269
+ print (result)
270
+ ```
271
+
242
272
## 🤝 Contributing
243
273
244
274
Feel free to contribute and join our Discord server to discuss with us improvements and give us suggestions!
You can’t perform that action at this time.
0 commit comments