mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-06-23 21:00:30 +08:00
docs: update instructions to use with LocalAI
This commit is contained in:
parent
702e913193
commit
198420c505
30
README.md
30
README.md
@ -239,6 +239,36 @@ The output for all 3 the cases will be a dictionary with the extracted informati
|
||||
}
|
||||
```
|
||||
|
||||
### Case 7: Extract informations with LocalAI
|
||||
|
||||
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 ):
|
||||
|
||||
```python
|
||||
from scrapegraphai.graphs import SmartScraperGraph
|
||||
|
||||
# Note: You can actually leave as-is
|
||||
OPENAI_API_KEY = "YOUR_API_KEY"
|
||||
|
||||
graph_config = {
|
||||
"llm": {
|
||||
"api_key": OPENAI_API_KEY,
|
||||
"model": "gpt-4",
|
||||
"temperature": 0,
|
||||
"base_url": "http://localhost:8080",
|
||||
},
|
||||
}
|
||||
|
||||
smart_scraper_graph = SmartScraperGraph(
|
||||
prompt="List me all the articles",
|
||||
# also accepts a string with the already downloaded HTML code
|
||||
source="https://perinim.github.io/projects",
|
||||
config=graph_config
|
||||
)
|
||||
|
||||
result = smart_scraper_graph.run()
|
||||
print(result)
|
||||
```
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
Feel free to contribute and join our Discord server to discuss with us improvements and give us suggestions!
|
||||
|
||||
Loading…
Reference in New Issue
Block a user