Skip to content

Add LocalAI examples #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/LocalAI Examples/Graph_text.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 🥎 Graph from text

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 ):

```python
"""
Basic example of scraping pipeline using SmartScraper from text
"""
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)
```
8 changes: 8 additions & 0 deletions docs/LocalAI Examples/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Examples LocalAI",
"position": 12,
"link": {
"type": "generated-index",
"description": "List of tutorials for LocalAI"
}
}