Skip to content

https://api.deepseek.com/v1/embeddings 这个接口还提供服务吗? #652

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

Open
pvlking opened this issue May 4, 2025 · 0 comments
Open

Comments

@pvlking
Copy link

pvlking commented May 4, 2025

接口调用返回404
Response Status: 404
Response Text: {"error_msg": "Not Found. Please check the configuration."}

还是调用的问题?执行代码如下:
class DeepSeekEmbeddingFunction(EmbeddingFunction):
def init(self):
self.api_url = "https://api.deepseek.com/v1/embeddings"
api_key = os.getenv("DEEPSEEK_API_KEY")
if not api_key:
raise ValueError("DEEPSEEK_API_KEY 未设置!")
self.headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}

def __call__(self, texts: List[str]) -> List[List[float]]:
    payload = {
        "input": texts,
        "model": "deepseek-embedding"  # 确认模型名称
    }
    print(f"Request URL: {self.api_url}")  # 打印 URL
    print(f"Headers: {self.headers}")      # 打印请求头
    print(f"Payload: {payload}")           # 打印请求体
    
    resp = requests.post(self.api_url, headers=self.headers, json=payload)
    print(f"Response Status: {resp.status_code}")  # 打印响应状态码
    print(f"Response Text: {resp.text}")            # 打印响应内容
    
    if resp.status_code != 200:
        raise RuntimeError(f"DeepSeek API 错误:{resp.status_code} - {resp.text}")
    data = resp.json()
    # 根据实际响应结构调整提取逻辑
    return [item["embedding"] for item in data["data"]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant