mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 16:18:30 +00:00
Fix linting and type-checking issues
- Fix whitespace in docstring blank lines (ruff W293) - Add null check before calling _validate_base_url to fix mypy type error - Ensure url_to_validate is not None before validation Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -1200,7 +1200,7 @@ class LLM(BaseLLM):
|
||||
# Validate base_url for Ollama connections
|
||||
if "ollama" in self.model.lower() and (self.base_url or self.api_base):
|
||||
url_to_validate = self.base_url or self.api_base
|
||||
if not self._validate_base_url(url_to_validate):
|
||||
if url_to_validate and not self._validate_base_url(url_to_validate):
|
||||
raise ValueError(
|
||||
f"Invalid Ollama base_url: '{url_to_validate}'. "
|
||||
"Please check that the URL format is correct and the IP address is valid. "
|
||||
@@ -1217,8 +1217,8 @@ class LLM(BaseLLM):
|
||||
bool: True if URL is valid, False otherwise
|
||||
"""
|
||||
try:
|
||||
from urllib.parse import urlparse
|
||||
import ipaddress
|
||||
from urllib.parse import urlparse
|
||||
|
||||
result = urlparse(url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user