diff --git a/.github/workflows/git-bob.yml b/.github/workflows/git-bob.yml index e3e00de..024046b 100644 --- a/.github/workflows/git-bob.yml +++ b/.github/workflows/git-bob.yml @@ -61,6 +61,8 @@ jobs: GITLAB_API_KEY: "${{ secrets.GITLAB_API_KEY }}" E_INFRA_CZ_API_KEY: "${{ secrets.E_INFRA_CZ_API_KEY }}" SCADS_API_KEY: "${{ secrets.SCADS_API_KEY }}" + CUSTOM_LLM_SERVER: "${{ secrets.CUSTOM_LLM_SERVER }}" + CUSTOM_API_KEY: "${{ secrets.CUSTOM_API_KEY }}" GITHUB_RUN_ID: "${{ github.run_id }}" TWINE_USERNAME: "${{ secrets.TWINE_USERNAME }}" TWINE_PASSWORD: "${{ secrets.TWINE_PASSWORD }}" diff --git a/.gitlab/.gitlab-ci.yml b/.gitlab/.gitlab-ci.yml index 10955f3..6cf749f 100644 --- a/.gitlab/.gitlab-ci.yml +++ b/.gitlab/.gitlab-ci.yml @@ -41,6 +41,8 @@ respond: KISSKI_API_KEY: "$KISSKI_API_KEY" BLABLADOR_API_KEY: "$BLABLADOR_API_KEY" DEEPSEEK_API_KEY: "$DEEPSEEK_API_KEY" + CUSTOM_LLM_SERVER: "$CUSTOM_LLM_SERVER" + CUSTOM_API_KEY: "$CUSTOM_API_KEY" GITLAB_API_KEY: "$GITLAB_API_TOKEN" E_INFRA_CZ_API_KEY: "$E_INFRA_CZ_API_KEY" GITLAB_PIPELINE_ID: "$CI_PIPELINE_ID" diff --git a/setup.cfg b/setup.cfg index f99008f..ff6dd99 100644 --- a/setup.cfg +++ b/setup.cfg @@ -69,6 +69,7 @@ git_bob.prompt_handlers = deepseek = git_bob._endpoints:prompt_deepseek e-infra_cz = git_bob._endpoints:prompt_e_infra_cz scads = git_bob._endpoints:prompt_scads + custom = git_bob._endpoints:prompt_custom git_bob.triggers = review = git_bob._ai_github_utilities:review_pull_request diff --git a/src/git_bob/__init__.py b/src/git_bob/__init__.py index 7f90313..2d255e0 100644 --- a/src/git_bob/__init__.py +++ b/src/git_bob/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.27.2" +__version__ = "0.27.3" __all__ = ( ) diff --git a/src/git_bob/_endpoints.py b/src/git_bob/_endpoints.py index 974bae7..48ca745 100644 --- a/src/git_bob/_endpoints.py +++ b/src/git_bob/_endpoints.py @@ -153,6 +153,16 @@ def prompt_scads(message: str, model="openai/gpt-oss-120b", image=None, max_accu 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_custom(message: str, model=None, image=None, max_accumulated_responses=10, max_response_tokens=128000, base_url=None, api_key=None): + import os + if base_url is None: + base_url = os.environ.get('CUSTOM_LLM_SERVER') + if api_key is None: + api_key = os.environ.get("CUSTOM_API_KEY") + model = model.replace("custom:", "") + print("model", "_" + model[1:]) + 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_kisski(message: str, model=None, image=None, max_accumulated_responses=10, max_response_tokens=16384, base_url=None, api_key=None): import os diff --git a/src/git_bob/_utilities.py b/src/git_bob/_utilities.py index 1f3e4f4..446c728 100644 --- a/src/git_bob/_utilities.py +++ b/src/git_bob/_utilities.py @@ -552,7 +552,9 @@ def clean_output(repository, text): "TWINE_PASSWORD", "HF_TOKEN", "DEEPSEEK_API_KEY", - "CODECOV_TOKEN"] + "CODECOV_TOKEN", + "CUSTOM_API_KEY", + "CUSTOM_LLM_SERVER"] def save_and_clear_environment(): """Clear all environment variables and store the entire env in a dictionary for restoration later"""