Skip to content

Commit e60a996

Browse files
Merge pull request #840 from haesleinhuepf/custom-endpoints
enable custom endpoints
2 parents b90175c + 42e7ffd commit e60a996

6 files changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/git-bob.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ jobs:
6161
GITLAB_API_KEY: "${{ secrets.GITLAB_API_KEY }}"
6262
E_INFRA_CZ_API_KEY: "${{ secrets.E_INFRA_CZ_API_KEY }}"
6363
SCADS_API_KEY: "${{ secrets.SCADS_API_KEY }}"
64+
CUSTOM_LLM_SERVER: "${{ secrets.CUSTOM_LLM_SERVER }}"
65+
CUSTOM_API_KEY: "${{ secrets.CUSTOM_API_KEY }}"
6466
GITHUB_RUN_ID: "${{ github.run_id }}"
6567
TWINE_USERNAME: "${{ secrets.TWINE_USERNAME }}"
6668
TWINE_PASSWORD: "${{ secrets.TWINE_PASSWORD }}"

.gitlab/.gitlab-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ respond:
4141
KISSKI_API_KEY: "$KISSKI_API_KEY"
4242
BLABLADOR_API_KEY: "$BLABLADOR_API_KEY"
4343
DEEPSEEK_API_KEY: "$DEEPSEEK_API_KEY"
44+
CUSTOM_LLM_SERVER: "$CUSTOM_LLM_SERVER"
45+
CUSTOM_API_KEY: "$CUSTOM_API_KEY"
4446
GITLAB_API_KEY: "$GITLAB_API_TOKEN"
4547
E_INFRA_CZ_API_KEY: "$E_INFRA_CZ_API_KEY"
4648
GITLAB_PIPELINE_ID: "$CI_PIPELINE_ID"

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ git_bob.prompt_handlers =
6969
deepseek = git_bob._endpoints:prompt_deepseek
7070
e-infra_cz = git_bob._endpoints:prompt_e_infra_cz
7171
scads = git_bob._endpoints:prompt_scads
72+
custom = git_bob._endpoints:prompt_custom
7273

7374
git_bob.triggers =
7475
review = git_bob._ai_github_utilities:review_pull_request

src/git_bob/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.27.2"
1+
__version__ = "0.27.3"
22

33
__all__ = (
44
)

src/git_bob/_endpoints.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,16 @@ def prompt_scads(message: str, model="openai/gpt-oss-120b", image=None, max_accu
153153
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)
154154

155155

156+
def prompt_custom(message: str, model=None, image=None, max_accumulated_responses=10, max_response_tokens=128000, base_url=None, api_key=None):
157+
import os
158+
if base_url is None:
159+
base_url = os.environ.get('CUSTOM_LLM_SERVER')
160+
if api_key is None:
161+
api_key = os.environ.get("CUSTOM_API_KEY")
162+
model = model.replace("custom:", "")
163+
print("model", "_" + model[1:])
164+
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)
165+
156166

157167
def prompt_kisski(message: str, model=None, image=None, max_accumulated_responses=10, max_response_tokens=16384, base_url=None, api_key=None):
158168
import os

src/git_bob/_utilities.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,9 @@ def clean_output(repository, text):
552552
"TWINE_PASSWORD",
553553
"HF_TOKEN",
554554
"DEEPSEEK_API_KEY",
555-
"CODECOV_TOKEN"]
555+
"CODECOV_TOKEN",
556+
"CUSTOM_API_KEY",
557+
"CUSTOM_LLM_SERVER"]
556558

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

0 commit comments

Comments
 (0)