Skip to content

Commit

Permalink
Merge pull request #6 from christo-olivier/feature/make-imports-easier
Browse files Browse the repository at this point in the history
Import and re-export objects in top level __init__.py
  • Loading branch information
christo-olivier authored Apr 8, 2024
2 parents adf379e + 0f96866 commit 2d7efe8
Show file tree
Hide file tree
Showing 6 changed files with 238 additions and 216 deletions.
426 changes: 220 additions & 206 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "modelsmith"
version = "0.2.3"
version = "0.3.0"
description = "Get Pydantic models and Python types as LLM responses from Google Vertex AI models."
authors = ["Christo Olivier <[email protected]>"]
maintainers = ["Christo Olivier <[email protected]>"]
Expand Down
11 changes: 10 additions & 1 deletion src/modelsmith/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
from .exceptions import ModelNotDerivedError, PatternNotFound
from .forge import Forge
from .language_model import LanguageModelWrapper
from .prompt import Prompt

__all__ = ["Forge"]
__all__ = [
"Forge",
"LanguageModelWrapper",
"Prompt",
"ModelNotDerivedError",
"PatternNotFound",
]
10 changes: 5 additions & 5 deletions src/modelsmith/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ def __str__(self) -> str:
return ", ".join(str(e) for e in self.exceptions)


class PatternNotFound(Exception):
class ModelNotDerivedError(Exception):
"""
Exception used when a pattern being searched for has not been found.
Exception raised when a pydantic model could not be created from the response of
the LLM.
"""

pass


class ModelNotDerivedError(Exception):
class PatternNotFound(Exception):
"""
Exception raised when a pydantic model could not be created from the response of
the LLM.
Exception used when a pattern being searched for has not been found.
"""

pass
3 changes: 1 addition & 2 deletions tests/test_forge.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from typing import Any

import pytest
from modelsmith.exceptions import ModelNotDerivedError
from modelsmith.forge import Forge
from modelsmith import Forge, ModelNotDerivedError
from vertexai.generative_models import GenerativeModel
from vertexai.language_models import ChatModel, TextGenerationModel

Expand Down
2 changes: 1 addition & 1 deletion tests/test_prompt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import inspect

from modelsmith.prompt import Prompt
from modelsmith import Prompt


def test_render_prompt_user_input() -> None:
Expand Down

0 comments on commit 2d7efe8

Please sign in to comment.