Skip to content

Commit 88be914

Browse files
authored
Merge pull request #2 from mudler/localai
Add LocalAI examples
2 parents 3a5f768 + e52b30a commit 88be914

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

docs/LocalAI Examples/Graph_text.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# 🥎 Graph from text
2+
3+
For [LocalAI](https://localai.io), the OpenAI client can be used by specifing a "fake" `OPENAI_API_KEY` ( there is no need to specify a real OpenAI key ):
4+
5+
```python
6+
"""
7+
Basic example of scraping pipeline using SmartScraper from text
8+
"""
9+
from scrapegraphai.graphs import SmartScraperGraph
10+
11+
# Note: You can actually leave as-is
12+
OPENAI_API_KEY = "YOUR_API_KEY"
13+
14+
graph_config = {
15+
"llm": {
16+
"api_key": OPENAI_API_KEY,
17+
"model": "gpt-4",
18+
"temperature": 0,
19+
"base_url": "http://localhost:8080",
20+
},
21+
}
22+
23+
smart_scraper_graph = SmartScraperGraph(
24+
prompt="List me all the articles",
25+
# also accepts a string with the already downloaded HTML code
26+
source="https://perinim.github.io/projects",
27+
config=graph_config
28+
)
29+
30+
result = smart_scraper_graph.run()
31+
print(result)
32+
```

docs/LocalAI Examples/_category_.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Examples LocalAI",
3+
"position": 12,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "List of tutorials for LocalAI"
7+
}
8+
}

0 commit comments

Comments
 (0)