Skip to content
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

Deepseek support #472

Open
irtiq7 opened this issue Jan 24, 2025 · 2 comments
Open

Deepseek support #472

irtiq7 opened this issue Jan 24, 2025 · 2 comments

Comments

@irtiq7
Copy link
Contributor

irtiq7 commented Jan 24, 2025

Hey Devs,
let me start by saying that this repo is great. Good job on your work, and thanks for sharing it.

Could we include support of DeepSeek V3 API in ChatDev? If there is a solution out there then when can it be implemented?

Thanks!

@SekiyoKana
Copy link

SekiyoKana commented Jan 27, 2025

In fact, you can handle the compatibility yourself because the Deepseek official API provides OpenAI support. You only need to replace the two environment variables, BASE_URLand OPENAI_API_KEY, with the Deepseek API https://api.deepseek.com and your deepseek api_key, respectively. This will essentially connect you to the Deepseek model.
though some minor adjustments in the code are still required:

However, such modifications seem to render the ChatGPT model unusable, so this can only serve as a temporary solution.

typing.pt 54:

// add 'DEEPSEEK_CHAT ' to ModelType
class ModelType(Enum):
    GPT_3_5_TURBO = "gpt-3.5-turbo-16k-0613"
    GPT_3_5_TURBO_NEW = "gpt-3.5-turbo-16k"
    GPT_4 = "gpt-4"
    GPT_4_32k = "gpt-4-32k"
    GPT_4_TURBO = "gpt-4-turbo"
    GPT_4_TURBO_V = "gpt-4-turbo"
    GPT_4O = "gpt-4o"
    GPT_4O_MINI = "gpt-4o-mini"
    DEEPSEEK_CHAT = "deepseek-chat"

run.py 81:

// switch default model to 'DEEPSEEK_CHAT' and add 'DEEPSEEK_CHAT' into help
parser.add_argument('--model', type=str, default="DEEPSEEK_CHAT",
                    help="GPT Model, choose from {'GPT_3_5_TURBO', 'GPT_4', 'GPT_4_TURBO', 'GPT_4O', 'GPT_4O_MINI', 'DEEPSEEK_CHAT'}")

model_backend.py 68:

// use get_encoding if model is 'deepseek-chat'
if self.model_type.value == 'deepseek-chat':
            encoding = tiktoken.get_encoding('cl100k_base')
        else:
            encoding = tiktoken.encoding_for_model(self.model_type.value)

utils.py 80:

// same as model_backend.py
if value_for_tiktoken == 'deepseek-chat':
            encoding = tiktoken.get_encoding("cl100k_base")
        else:
            encoding = tiktoken.encoding_for_model(value_for_tiktoken)

finally, change all of the default model ModelType.GPT_3_5_TURBO to ModelType.DEEPSEEK_CHAT.

Looking forward to the official offering of a better integrated solution.

@irtiq7
Copy link
Contributor Author

irtiq7 commented Jan 29, 2025

That's great @SekiyoKana!!! I will try your method. I was wondering if you were able to download and run the Deepseek model locally?

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

2 participants