Skip to content

Commit

Permalink
add support for deepseek
Browse files Browse the repository at this point in the history
  • Loading branch information
haesleinhuepf committed Jan 25, 2025
1 parent 870dd11 commit b622664
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/git-bob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
GH_MODELS_API_KEY: "${{ secrets.GH_MODELS_API_KEY }}"
KISSKI_API_KEY: "${{ secrets.KISSKI_API_KEY }}"
BLABLADOR_API_KEY: "${{ secrets.BLABLADOR_API_KEY }}"
DEEPSEEK_API_KEY: "${{ secrets.DEEPSEEK_API_KEY }}"
GITHUB_API_KEY: "${{ secrets.GITHUB_TOKEN }}"
GITLAB_API_KEY: "${{ secrets.GITLAB_API_KEY }}"
GITHUB_RUN_ID: "${{ github.run_id }}"
Expand Down
1 change: 1 addition & 0 deletions .gitlab/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ respond:
GH_MODELS_API_KEY: "$GH_MODELS_API_KEY"
KISSKI_API_KEY: "$KISSKI_API_KEY"
BLABLADOR_API_KEY: "$BLABLADOR_API_KEY"
DEEPSEEK_API_KEY: "$DEEPSEEK_API_KEY"
GITLAB_API_KEY: "$GITLAB_API_TOKEN"
GITLAB_PIPELINE_ID: "$CI_PIPELINE_ID"
GIT_SERVER_URL: "https://gitlab.com/"
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ git_bob.prompt_handlers =
github_models = git_bob._endpoints:prompt_azure
kisski = git_bob._endpoints:prompt_kisski
blablador = git_bob._endpoints:prompt_blablador
deepseek = git_bob._endpoints:prompt_deepseek

git_bob.triggers =
review = git_bob._ai_github_utilities:review_pull_request
Expand Down
14 changes: 9 additions & 5 deletions src/git_bob/_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ def prompt_openai(message: str, model="gpt-4o-2024-08-06", image=None, max_accum
}]}]
original_message = message

if "kisski:" in model:
model = model.replace("kisski:", "")
if "blablador:" in model:
model = model.replace("blablador:", "")

# setup connection to the LLM
if base_url is not None and api_key is not None:
client = openai.OpenAI(base_url=base_url, api_key=api_key)
Expand Down Expand Up @@ -153,6 +148,15 @@ def prompt_blablador(message: str, model=None, image=None, max_accumulated_respo
return prompt_openai(message, model=model, image=image, max_accumulated_responses=max_accumulated_responses, max_response_tokens=max_response_tokens, base_url=base_url, api_key=api_key)


def prompt_deepseek(message: str, model="deepseek-chat", image=None, max_accumulated_responses=10, max_response_tokens=16384, base_url=None, api_key=None):
import os
if base_url is None:
base_url = "https://api.deepseek.com"
if api_key is None:
api_key = os.environ.get("DEEPSEEK_API_KEY")
model = model.replace("deepseek:", "")
return prompt_openai(message, model=model, image=image, max_accumulated_responses=max_accumulated_responses, max_response_tokens=max_response_tokens, base_url=base_url, api_key=api_key)


def prompt_googleai(request, model="gemini-1.5-pro-002", image=None):
"""Send a prompt to Google Gemini and return the response"""
Expand Down
3 changes: 2 additions & 1 deletion src/git_bob/_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ def clean_output(repository, text):
"GITLAB_API_KEY",
"TWINE_USERNAME",
"TWINE_PASSWORD",
"HF_TOKEN"]
"HF_TOKEN",
"DEEPSEEK_API_KEY",]

def save_and_clear_environment():
"""Clear all environment variables and store the entire env in a dictionary for restoration later"""
Expand Down

0 comments on commit b622664

Please sign in to comment.