Skip to content

Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.

featuer/error-message-pipelex-init (#58)

Thomas Hebrard8a1ce3cc7e2f
diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml
index 4ea9194cd..5d37b724e 100644
--- a/.github/workflows/cla.yml
+++ b/.github/workflows/cla.yml
@@ -25,7 +25,7 @@ jobs:
path-to-signatures: "signatures/version1/cla.json"
path-to-document: "https://github.com/Pipelex/pipelex/blob/main/CLA.md"
branch: main
- allowlist: lchoquel,thomashebrard,antoinepipelex,bot*
+ allowlist: lchoquel,thomashebrard,bot*
remote-organization-name: Pipelex
remote-repository-name: cla-signatures
signed-commit-message: "$contributorName has signed the CLA in $owner/$repo#$pullRequestNo"
diff --git a/pipelex/cogt/llm/llm_models/llm_model_library.py b/pipelex/cogt/llm/llm_models/llm_model_library.py
index d0d15d42c..ebb0573cd 100644
--- a/pipelex/cogt/llm/llm_models/llm_model_library.py
+++ b/pipelex/cogt/llm/llm_models/llm_model_library.py
@@ -64,6 +64,8 @@ class LLMModelLibrary(LLMModelProviderAbstract, RootModel[LLMModelLibraryRoot]):
@classmethod
def load_llm_model_library_dict(cls) -> LLMModelLibraryDict:
libraries_path = LibraryConfig.exported_llm_integrations_path
+ if not os.path.exists(libraries_path):
+ raise LLMModelLibraryError(f"LLM model library path `{libraries_path}` not found. Please run `pipelex init-libraries` to create it.")
llm_library: LLMModelLibraryDict = {}
for library_file_name in sorted(os.listdir(libraries_path)):
library_path = os.path.join(libraries_path, library_file_name)
diff --git a/pipelex/libraries/library_manager.py b/pipelex/libraries/library_manager.py
index 18af02daa..25afeea45 100644
--- a/pipelex/libraries/library_manager.py
+++ b/pipelex/libraries/library_manager.py
@@ -1,3 +1,4 @@
+import os
from pathlib import Path
from typing import Any, ClassVar, Dict, List, Optional, Type
@@ -25,6 +26,10 @@ from pipelex.tools.typing.pydantic_utils import format_pydantic_validation_error
from pipelex.types import StrEnum
+class LLMDeckNotFoundError(LibraryError):
+ pass
+
+
class LibraryComponent(StrEnum):
CONCEPT = "concept"
PIPE = "pipe"
@@ -74,8 +79,12 @@ class LibraryManager:
def load_deck(self) -> LLMDeck:
llm_deck_paths = LibraryConfig.get_llm_deck_paths()
full_llm_deck_dict: Dict[str, Any] = {}
+ if not llm_deck_paths:
+ raise LLMDeckNotFoundError("No LLM deck paths found. Please run `pipelex init-libraries` to create it.")
for llm_deck_path in llm_deck_paths:
+ if not os.path.exists(llm_deck_path):
+ raise LLMDeckNotFoundError(f"LLM deck path `{llm_deck_path}` not found. Please run `pipelex init-libraries` to create it.")
llm_deck_dict = load_toml_from_path(path=llm_deck_path)
log.debug(f"Loaded LLM deck from {llm_deck_path}")
log.verbose(llm_deck_dict)
@@ -88,7 +97,6 @@ class LibraryManager:
log.debug("LibraryManager loading combo libraries")
# Find all .toml files in the directories and their subdirectories
toml_file_paths: List[Path] = []
-
for libraries_path in library_paths:
# Use the existing utility function specifically for TOML files
found_file_paths = find_files_in_dir(
diff --git a/pipelex/pipelex.py b/pipelex/pipelex.py
index 6e28e4161..8e990bf39 100644
--- a/pipelex/pipelex.py
+++ b/pipelex/pipelex.py
@@ -199,6 +199,7 @@ class Pipelex:
self.library_manager.load_libraries()
if self.library_manager.llm_deck is None:
raise PipelexSetupError("LLM deck is not loaded")
+
self.pipelex_hub.set_llm_deck_provider(llm_deck_provider=self.library_manager.llm_deck)
self.library_manager.validate_libraries()
except ValidationError as exc: