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

Add deepseek r1 client for integration #327

Merged
merged 10 commits into from
Jan 29, 2025

Conversation

phi-jkim
Copy link
Contributor

What does this PR do?

This PR integrates deepseekR1 client into Adalflow by calling their API. It supports sync_call and not async_call at the moment.

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • [ x] Did you read the contributor guideline?
  • [ x] Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • [ x] Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@@ -42,6 +42,7 @@ class OptionalPackages(Enum):
# model sdk
GROQ = ("groq", "Please install groq with: pip install groq")
OPENAI = ("openai", "Please install openai with: pip install openai")
DEEPSEEK = ("openai", "Please install deepseek with: pip install openai")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete this as users will be directed to install openai package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted this from the lazy_import.py file

@@ -0,0 +1,299 @@
import os
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait for the next version on not rewrite everything as they only use openai package

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are instead inheriting the openai client after making some modifications!

@phi-jkim phi-jkim force-pushed the integrate-deepseek-r1-client branch from 78dee41 to 6306633 Compare January 29, 2025 05:26
@phi-jkim phi-jkim force-pushed the integrate-deepseek-r1-client branch from 6306633 to 4f5c6d6 Compare January 29, 2025 06:12
pattern = f"{system_start_tag}(.*?){system_end_tag}{user_start_tag}(.*?){user_end_tag}"

# new regex pattern to ignore special characters such as \n
pattern = (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original regex expression was not able to parse correctly. I fixed the regex pattern using \s to ignore escape characters.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty good!

@@ -0,0 +1,66 @@
from adalflow.components.model_client import DeepSeekClient
from adalflow.core.types import ModelType
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the next version, would like to directly show users using Generator with DeepSeekClient. as the client is not end-user facing, but more of developer facing.

Copy link
Member

@liyin2015 liyin2015 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, its really great.

@liyin2015 liyin2015 merged commit db14fd2 into SylphAI-Inc:main Jan 29, 2025
4 checks passed
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

Successfully merging this pull request may close these issues.

3 participants