crewplus 0.2.34__tar.gz → 0.2.36__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of crewplus might be problematic. Click here for more details.
- {crewplus-0.2.34 → crewplus-0.2.36}/PKG-INFO +1 -1
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/services/gemini_chat_model.py +16 -9
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/services/init_services.py +17 -2
- {crewplus-0.2.34 → crewplus-0.2.36}/pyproject.toml +1 -1
- {crewplus-0.2.34 → crewplus-0.2.36}/LICENSE +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/README.md +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/__init__.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/services/__init__.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/services/azure_chat_model.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/services/model_load_balancer.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/services/tracing_manager.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/utils/__init__.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/utils/schema_action.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/utils/schema_document_updater.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/vectorstores/milvus/__init__.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/vectorstores/milvus/milvus_schema_manager.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/vectorstores/milvus/schema_milvus.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/crewplus/vectorstores/milvus/vdb_service.py +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/docs/GeminiChatModel.md +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/docs/ModelLoadBalancer.md +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/docs/VDBService.md +0 -0
- {crewplus-0.2.34 → crewplus-0.2.36}/docs/index.md +0 -0
|
@@ -294,6 +294,7 @@ class GeminiChatModel(BaseChatModel):
|
|
|
294
294
|
if creds is None:
|
|
295
295
|
# Get service account file from env if not provided
|
|
296
296
|
sa_file = self.service_account_file or os.getenv("GCP_SERVICE_ACCOUNT_FILE")
|
|
297
|
+
self.logger.debug(f"Service account file: {sa_file}")
|
|
297
298
|
if sa_file:
|
|
298
299
|
try:
|
|
299
300
|
creds = service_account.Credentials.from_service_account_file(
|
|
@@ -307,15 +308,21 @@ class GeminiChatModel(BaseChatModel):
|
|
|
307
308
|
|
|
308
309
|
# If creds is still None, the client will use Application Default Credentials (ADC).
|
|
309
310
|
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
311
|
+
try:
|
|
312
|
+
self._client = genai.Client(
|
|
313
|
+
vertexai=True,
|
|
314
|
+
project=self.project_id,
|
|
315
|
+
location=self.location,
|
|
316
|
+
credentials=creds,
|
|
317
|
+
)
|
|
318
|
+
self.logger.info(
|
|
319
|
+
f"Initialized GeminiChatModel with model: {self.model_name} for Vertex AI "
|
|
320
|
+
f"(Project: {self.project_id}, Location: {self.location})"
|
|
321
|
+
)
|
|
322
|
+
except Exception as e:
|
|
323
|
+
error_msg = f"Failed to initialize GenAI Client for Vertex AI: {e}"
|
|
324
|
+
self.logger.error(error_msg, exc_info=True)
|
|
325
|
+
raise ValueError(error_msg)
|
|
319
326
|
|
|
320
327
|
def get_model_identifier(self) -> str:
|
|
321
328
|
"""Return a string identifying this model for tracing and logging."""
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import logging
|
|
3
|
+
from typing import Optional
|
|
2
4
|
from .model_load_balancer import ModelLoadBalancer
|
|
3
5
|
|
|
4
6
|
model_balancer = None
|
|
5
7
|
|
|
6
|
-
def init_load_balancer(
|
|
8
|
+
def init_load_balancer(
|
|
9
|
+
config_path: Optional[str] = None,
|
|
10
|
+
logger: Optional[logging.Logger] = None
|
|
11
|
+
):
|
|
7
12
|
"""
|
|
8
13
|
Initializes the global ModelLoadBalancer instance.
|
|
9
14
|
|
|
10
15
|
This function is idempotent. If the balancer is already initialized,
|
|
11
16
|
it does nothing. It follows a safe initialization pattern where the
|
|
12
17
|
global instance is only assigned after successful configuration loading.
|
|
18
|
+
|
|
19
|
+
Args:
|
|
20
|
+
config_path (Optional[str]): The path to the model configuration file.
|
|
21
|
+
If not provided, it's determined by the `MODEL_CONFIG_PATH`
|
|
22
|
+
environment variable, or defaults to "config/models_config.json".
|
|
23
|
+
logger (Optional[logging.Logger]): An optional logger instance to be
|
|
24
|
+
used by the model balancer.
|
|
13
25
|
"""
|
|
14
26
|
global model_balancer
|
|
15
27
|
if model_balancer is None:
|
|
@@ -20,7 +32,10 @@ def init_load_balancer(config_path: str = None):
|
|
|
20
32
|
)
|
|
21
33
|
try:
|
|
22
34
|
# 1. Create a local instance first.
|
|
23
|
-
balancer = ModelLoadBalancer(
|
|
35
|
+
balancer = ModelLoadBalancer(
|
|
36
|
+
config_path=final_config_path,
|
|
37
|
+
logger=logger
|
|
38
|
+
)
|
|
24
39
|
# 2. Attempt to load its configuration.
|
|
25
40
|
balancer.load_config()
|
|
26
41
|
# 3. Only assign to the global variable on full success.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|