🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
fix: Ollama and VLLM api key & url setting (#2316)
Wendong-Fan52132a475037
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlindex f96fa51d3..c063a7941 100644--- a/.github/ISSUE_TEMPLATE/bug_report.yml+++ b/.github/ISSUE_TEMPLATE/bug_report.yml@@ -26,7 +26,7 @@ body:attributes:label: What version of camel are you using?description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.- placeholder: E.g., 0.2.50+ placeholder: E.g., 0.2.51validations:required: truediff --git a/camel/__init__.py b/camel/__init__.pyindex 570c3adfc..cab70fefd 100644--- a/camel/__init__.py+++ b/camel/__init__.py@@ -14,7 +14,7 @@from camel.logger import disable_logging, enable_logging, set_log_level-__version__ = '0.2.50'+__version__ = '0.2.51'__all__ = ['__version__',diff --git a/camel/models/ollama_model.py b/camel/models/ollama_model.pyindex 02f9d2a6d..531155bee 100644--- a/camel/models/ollama_model.py+++ b/camel/models/ollama_model.py@@ -16,10 +16,13 @@ import subprocessfrom typing import Any, Dict, Optional, Unionfrom camel.configs import OLLAMA_API_PARAMS, OllamaConfig+from camel.logger import get_loggerfrom camel.models.openai_compatible_model import OpenAICompatibleModelfrom camel.types import ModelTypefrom camel.utils import BaseTokenCounter+logger = get_logger(__name__)+class OllamaModel(OpenAICompatibleModel):r"""Ollama service interface.@@ -60,20 +63,22 @@ class OllamaModel(OpenAICompatibleModel):) -> None:if model_config_dict is None:model_config_dict = OllamaConfig().as_dict()- url = url or os.environ.get("OLLAMA_BASE_URL")+ self._url = url or os.environ.get("OLLAMA_BASE_URL")timeout = timeout or float(os.environ.get("MODEL_TIMEOUT", 180))+ self._model_type = model_type++ if not self._url:+ self._start_server()+super().__init__(- model_type=model_type,+ model_type=self._model_type,model_config_dict=model_config_dict,- api_key=api_key,- url=url,+ api_key="Not_Used",+ url=self._url,token_counter=token_counter,timeout=timeout,)- if not self._url:- self._start_server()-def _start_server(self) -> None:r"""Starts the Ollama server in a subprocess."""try:@@ -83,12 +88,12 @@ class OllamaModel(OpenAICompatibleModel):stderr=subprocess.PIPE,)self._url = "http://localhost:11434/v1"- print(+ logger.info(f"Ollama server started on {self._url} "- f"for {self.model_type} model."+ f"for {self._model_type} model.")except Exception as e:- print(f"Failed to start Ollama server: {e}.")+ logger.error(f"Failed to start Ollama server: {e}.")def check_model_config(self):r"""Check whether the model configuration contains anydiff --git a/camel/models/vllm_model.py b/camel/models/vllm_model.pyindex b6e4ccccb..34bfdf030 100644--- a/camel/models/vllm_model.py+++ b/camel/models/vllm_model.py@@ -16,10 +16,13 @@ import subprocessfrom typing import Any, Dict, Optional, Unionfrom camel.configs import VLLM_API_PARAMS, VLLMConfig+from camel.logger import get_loggerfrom camel.models.openai_compatible_model import OpenAICompatibleModelfrom camel.types import ModelTypefrom camel.utils import BaseTokenCounter+logger = get_logger(__name__)+# flake8: noqa: E501class VLLMModel(OpenAICompatibleModel):@@ -62,18 +65,21 @@ class VLLMModel(OpenAICompatibleModel):) -> None:if model_config_dict is None:model_config_dict = VLLMConfig().as_dict()- url = url or os.environ.get("VLLM_BASE_URL")+ self._url = url or os.environ.get("VLLM_BASE_URL")timeout = timeout or float(os.environ.get("MODEL_TIMEOUT", 180))+ self._model_type = model_type++ if not self._url:+ self._start_server()+super().__init__(- model_type=model_type,+ model_type=self._model_type,model_config_dict=model_config_dict,- api_key=api_key,- url=url,+ api_key="Not_Used",+ url=self._url,token_counter=token_counter,timeout=timeout,)- if not self._url:- self._start_server()def _start_server(self) -> None:r"""Starts the vllm server in a subprocess."""@@ -84,12 +90,12 @@ class VLLMModel(OpenAICompatibleModel):stderr=subprocess.PIPE,)self._url = "http://localhost:8000/v1"- print(+ logger.info(f"vllm server started on {self._url} "- f"for {self.model_type} model."+ f"for {self._model_type} model.")except Exception as e:- print(f"Failed to start vllm server: {e}.")+ logger.error(f"Failed to start vllm server: {e}.")def check_model_config(self):r"""Check whether the model configuration contains anydiff --git a/docs/conf.py b/docs/conf.pyindex 5d64b9e41..f9ac25adf 100644--- a/docs/conf.py+++ b/docs/conf.py@@ -27,7 +27,7 @@ sys.path.insert(0, os.path.abspath('..'))project = 'CAMEL'copyright = '2024, CAMEL-AI.org'author = 'CAMEL-AI.org'-release = '0.2.50'+release = '0.2.51'html_favicon = ('https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'diff --git a/docs/key_modules/loaders.md b/docs/key_modules/loaders.mdindex 380a011e8..d4de37472 100644--- a/docs/key_modules/loaders.md+++ b/docs/key_modules/loaders.md@@ -340,14 +340,14 @@ response = jina_reader.read_content("https://docs.camel-ai.org/")print(response)``````markdown->>>Welcome to CAMEL’s documentation! — CAMEL 0.2.50 documentation+>>>Welcome to CAMEL’s documentation! — CAMEL 0.2.51 documentation===============[Skip to main content](https://docs.camel-ai.org/#main-content)Back to top Ctrl+K- [ CAMEL 0.2.50](https://docs.camel-ai.org/#)+ [ CAMEL 0.2.51](https://docs.camel-ai.org/#)Search Ctrl+Kdiff --git a/pyproject.toml b/pyproject.tomlindex a9a3d14a3..912ba62a5 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "camel-ai"-version = "0.2.50"+version = "0.2.51"description = "Communicative Agents for AI Society Study"authors = [{ name = "CAMEL-AI.org" }]requires-python = ">=3.10,<3.13"diff --git a/uv.lock b/uv.lockindex 906d092d6..ad69018b6 100644--- a/uv.lock+++ b/uv.lock@@ -539,7 +539,7 @@ wheels = [[[package]]name = "camel-ai"-version = "0.2.50"+version = "0.2.51"source = { editable = "." }dependencies = [{ name = "colorama" },