deepseek-ai / DeepSeek-V2

DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model
MIT License
3.68k stars 156 forks source link

怎么在langchain里面使用deepseek计算embedding? #67

Open ShuoAndy opened 4 months ago

ShuoAndy commented 4 months ago

我的代码如下

from langchain_openai import ChatOpenAI, OpenAIEmbeddings
llm = ChatOpenAI(
        model='deepseek-chat', 
        openai_api_key='xxx', 
        openai_api_base='https://api.deepseek.com/v1', 
        temperature=0.85, 
        max_tokens=4000
        )
embeddings = OpenAIEmbeddings(api_key="xxx", base_url="https://api.deepseek.com/v1")

在初始化 OpenAIEmbeddings 时似乎遇到了问题:openai.APIStatusError: Error code: 418 - {'error': 'Requested Resource Not Found', 'stage': 'WAF'} 我该怎么办?

songdo commented 4 months ago

遇到同样问题

temberature commented 4 months ago

Does your API support Embedding or Function Calling? We do not support these features at this moment, but they are in our development plans.

FAQ | DeepSeek API Docs https://platform.deepseek.com/api-docs/faq/

jiiuluo00001 commented 2 months ago

import os

API_SECRET_KEY = "sk-16fc8d4a022841619ed3bf3434ee2e4f" BASE_URL = "https://api.deepseek.com"

os.environ["OPENAI_API_KEY"] = API_SECRET_KEY os.environ["OPENAI_API_BASE"] = BASE_URL