diff --git a/pyproject.toml b/pyproject.toml index 1fc8d847f1..6d75b8ea56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -72,6 +72,7 @@ types-cachetools = "^6.0.0.20250525" limits = "^5.5.0" + [tool.poetry.group.dev.dependencies] ipython = "^8.26.0" mypy = "^1.16.0" diff --git a/src/parlant/adapters/nlp/litellm_service.py b/src/parlant/adapters/nlp/litellm_service.py index d71dfaf826..02763920d4 100644 --- a/src/parlant/adapters/nlp/litellm_service.py +++ b/src/parlant/adapters/nlp/litellm_service.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Maintainer: Chibuike Mba + from __future__ import annotations import time from typing import Any, Mapping @@ -120,6 +122,12 @@ async def _do_generate( k: v for k, v in hints.items() if k in self.supported_litellm_params } + + # The base URL for the LiteLLM provider API + litellm_provider_url = os.environ.get("LITELLM_PROVIDER_URL") + if litellm_provider_url: + litellm_api_arguments["api_base"] = litellm_provider_url + t_start = time.time() response = self._client.completion( diff --git a/src/parlant/bin/server.py b/src/parlant/bin/server.py index bef94574df..7f9a0e5dcf 100755 --- a/src/parlant/bin/server.py +++ b/src/parlant/bin/server.py @@ -1081,7 +1081,8 @@ def transform_and_exec_help(command: str) -> None: @click.option( "--litellm", is_flag=True, - help="""Run with LiteLLM. The following environment variables must be set: LITELLM_PROVIDER_MODEL_NAME, LITELLM_PROVIDER_API_KEY. + help="""Run with LiteLLM. The following environment variables must be set: LITELLM_PROVIDER_MODEL_NAME, LITELLM_PROVIDER_API_KEY. + You should also set LITELLM_PROVIDER_URL if you're using self hosted llm supported by LiteLLM. Check this link https://docs.litellm.ai/docs/providers for additional environment variables required for your provider, set them and install the extra package parlant[litellm].""", default=False,