大致按照这篇博客来做https://blog.csdn.net/qq_37457202/article/details/139903127?
from scrapegraphai.graphs import SmartScraperGraph
graph_config = {
"llm": {
"model": "ollama/llama3",
# "model": "qwen2",
# "model": "ollama/mistral",
"temperature": 1,
"format": "json", # Ollama 需要显式指定格式
"base_url": "http://localhost:11434", # 设置 Ollama URL
},
"embeddings": {
"model": "ollama/nomic-embed-text",
"base_url": "http://localhost:11434", # 设置 Ollama URL
},
"verbose": True,
}
smart_scraper_graph = SmartScraperGraph(
prompt="返回该网站所有文章的标题、日期、文章链接",
# 也接受已下载的 HTML 代码的字符串
#source=requests.get("https://ydlin.blog.csdn.net/").text,
source="https://ydlin.blog.csdn.net/",
config=graph_config
)
result = smart_scraper_graph.run()
print(result)
运行时出现了
```python
raise OllamaEndpointNotFoundError(
langchain_community.llms.ollama.OllamaEndpointNotFoundError: Ollama call failed with status code 404. Maybe your model is not found and you should pull the model with `ollama pull llama3`.
Ollama日志也有东西,没有error。该如何解决