fix(llms/vllm): honor VLLM_BASE_URL instead of always using localhost (#6897)

This commit is contained in:
Kartik
2026-08-14 16:49:18 +05:30
committed by GitHub
parent 96d45b78c7
commit c883f52130
3 changed files with 57 additions and 3 deletions
+2 -1
View File
@@ -1,3 +1,4 @@
import os
from typing import Optional
from mem0.configs.llms.base import BaseLlmConfig
@@ -53,4 +54,4 @@ class VllmConfig(BaseLlmConfig):
)
# vLLM-specific parameters
self.vllm_base_url = vllm_base_url or "http://localhost:8000/v1"
self.vllm_base_url = vllm_base_url or os.getenv("VLLM_BASE_URL") or "http://localhost:8000/v1"
+1 -2
View File
@@ -37,8 +37,7 @@ class VllmLLM(LLMBase):
self.config.model = "Qwen/Qwen2.5-32B-Instruct"
self.config.api_key = self.config.api_key or os.getenv("VLLM_API_KEY") or "vllm-api-key"
base_url = self.config.vllm_base_url or os.getenv("VLLM_BASE_URL")
self.client = OpenAI(api_key=self.config.api_key, base_url=base_url)
self.client = OpenAI(api_key=self.config.api_key, base_url=self.config.vllm_base_url)
def _parse_response(self, response, tools):
"""