VinciGit00 / Scrapegraph-ai

Python scraper based on AI

Home Page:https://scrapegraphai.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

openai.AuthenticationError: Error code: 401

yuhua01 opened this issue · comments

hello, Why does the use of deepseek key cause the problem of 401? Can you help to solve it
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-f56bc***********************5568. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}

ok, please provide the code

好的,请提供代码好的,请提供代码
您好 这是我的代码
"""
Basic example of scraping pipeline using SmartScraper
"""

import os
from dotenv import load_dotenv
from scrapegraphai.graphs import SmartScraperGraph
from scrapegraphai.utils import prettify_exec_info

load_dotenv()

schema= """
{
"Projects": [
"Project #":
{
"title": "...",
"description": "...",
},
"Project #":
{
"title": "...",
"description": "...",
}
]
}
"""

deepseek_key = "sk-f56bc***********************5568"

graph_config = {
"llm": {
"model": "deepseek-chat",
"openai_api_key": deepseek_key,
"openai_api_base": 'https://api.deepseek.com/v1',
},
"verbose": True,
}

smart_scraper_graph = SmartScraperGraph(
prompt="List me all the projects with their description.",
# also accepts a string with the already downloaded HTML code
source="https://perinim.github.io/projects/",
schema=schema,
config=graph_config
)
print(smart_scraper_graph)
result = smart_scraper_graph.run()
print(result)

graph_exec_info = smart_scraper_graph.get_execution_info()
print(prettify_exec_info(graph_exec_info))

is deepseek enabled where you live?

Yes, I can use deepseek where I live, and it's ok for me to test it with other programs

please can you send me in private a deepseek key?

Ok, I have sent it to you in the email.

ok, the problem is that deepseek does not support embeddings, you should add another provider for the embeddings.
I tried the example with your apis keys and it works. Look at this example
https://github.com/VinciGit00/Scrapegraph-ai/blob/main/examples/deepseek/smart_scraper_deepseek.py

Hi, I tried this example but the original problem still exists, can you let me see your example and results via email

Have you installed ollama?

ollama has not been installed, maybe it is my agent in this place.
My question can be closed temporarily. Thank you very much for your help

you should install Ollama or using another provider on the embeddings