Skip to content

Commit

Permalink
Merge pull request #72 from BCG-X-Official/dev/1.0.7
Browse files Browse the repository at this point in the history
Dev/1.0.7
  • Loading branch information
seanggani authored Sep 12, 2024
2 parents 6a7ec55 + 20420f8 commit b554479
Show file tree
Hide file tree
Showing 12 changed files with 1,396 additions and 851 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Automated Red Teaming (ART) and testing toolkit
**ARTKIT** is a Python framework developed by `BCG X <https://www.bcg.com/x>`_ for automating prompt-based
testing and evaluation of Gen AI applications.

`Documentation <https://bcg-x-official.github.io/artkit/_generated/home.html>`_ | `User Guides <https://github.com/BCG-X-Official/artkit/tree/1.0.x/sphinx/source/user_guide>`_ | `Examples <https://github.com/BCG-X-Official/artkit/tree/1.0.x/sphinx/source/examples>`_
`Documentation <https://bcg-x-official.github.io/artkit/_generated/home.html>`_ | `User Guides <https://bcg-x-official.github.io/artkit/user_guide/index.html>`_ | `Examples <https://bcg-x-official.github.io/artkit/examples/index.html>`_

.. Begin-Badges
Expand Down
3 changes: 2 additions & 1 deletion condabuild/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ test:
- transformers {{ environ.get('ARTKIT_V_TRANSFORMERS', '') }}
- boto3 {{ environ.get('ARTKIT_V_BOTO3', '') }}
- moto {{ environ.get('ARTKIT_V_MOTO', '') }}
- google-cloud-aiplatform {{ environ.get('ARTKIT_V_GOOGLE_CLOUD_AIPLATFORM', '') }}
commands:
- conda list
- python -c "import artkit; import os; assert artkit.__version__ == os.environ['ARTKIT_BUILD_ARTKIT_VERSION']"
Expand All @@ -55,4 +56,4 @@ about:
libraries.
dev_url: https://github.com/BCG-X-Official/artkit
doc_url: https://bcg-x-official.github.io/artkit/
doc_source_url: https://github.com/BCG-X-Official/artkit/blob/develop/README.rst
doc_source_url: https://github.com/BCG-X-Official/artkit/tree/1.0.x/sphinx/source
2 changes: 2 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ dependencies:
- groq ~= 0.9
- anthropic ~= 0.26
- google-generativeai ~= 0.6
- google-cloud-aiplatform ~= 1.62.0

# The following are required for huggingface:
- aiohttp ~= 3.9
- pytorch ~= 2.3
Expand Down
81 changes: 44 additions & 37 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ dist-name = "artkit"
license = "Apache Software License v2.0"

requires = [
"matplotlib ~=3.6",
"pandas ~=2.1",
"gamma-pytools ~=3.0",
"fluxus ~=1.0",
"typing_inspect ~=0.7",
"matplotlib ~=3.6",
"pandas ~=2.1",
"gamma-pytools ~=3.0",
"fluxus ~=1.0",
"typing_inspect ~=0.7",
]

requires-python = ">=3.10,<4a"
Expand All @@ -40,6 +40,10 @@ google-generativeai = [
"google-generativeai ~= 0.6"
]

google-cloud-aiplatform = [
"google-cloud-aiplatform ~= 1.62"
]

huggingface = [
"aiohttp ~= 3.9",
"torch ~= 2.3",
Expand All @@ -48,12 +52,12 @@ huggingface = [
]

boto3 = [
"boto3 ~= 1.34",
"boto3 ~= 1.34",
"httpx ~= 0.27",
]

dev = [
"artkit[openai, groq, anthropic, google-generativeai, huggingface, boto3, moto]",
"artkit[openai, groq, anthropic, google-generativeai, huggingface, boto3, google-cloud-aiplatform]",
# We use dotenv in the tutorial notebooks
"python-dotenv ~= 1.0",

Expand Down Expand Up @@ -92,38 +96,40 @@ Repository = "https://github.com/BCG-X-Official/artkit"
no-binary.min = []

[build.matrix.min]
matplotlib = "~=3.6.3"
pandas = "~=2.1"
python = ">=3.10.14,<3.11a"
gamma-pytools = "~=3.0.0"
fluxus = "~=1.0.0"
typing_inspect = "~=0.7.1"
openai = "~=1.34.0"
anthropic = "~=0.28.0"
groq = "~=0.9.0"
google-generativeai = "~=0.6.0"
aiohttp = "~=3.9.0"
transformers = "~=4.41.0"
torch = "~=2.3.0"
boto3 = "~=1.34.0"
moto = "~=5.0.11"
matplotlib = "~=3.6.3"
pandas = "~=2.1"
python = ">=3.10.14,<3.11a"
gamma-pytools = "~=3.0.0"
fluxus = "~=1.0.0"
typing_inspect = "~=0.7.1"
openai = "~=1.34.0"
anthropic = "~=0.28.0"
groq = "~=0.9.0"
google-generativeai = "~=0.6.0"
aiohttp = "~=3.9.0"
transformers = "~=4.41.0"
torch = "~=2.3.0"
boto3 = "~=1.34.0"
moto = "~=5.0.11"
google-cloud-aiplatform = "~=1.62.0"

[build.matrix.max]
matplotlib = "~=3.8"
pandas = "~=2.2"
python = ">=3.12,<4a"
gamma-pytools = "~=3.0"
fluxus = "~=1.0"
typing_inspect = "~=0.9"
openai = "~=1.34"
anthropic = "~=0.28"
groq = "~=0.9"
google-generativeai = "~=0.6"
aiohttp = "~=3.9"
transformers = "~=4.41"
torch = "~=2.3"
boto3 = "~=1.34"
moto = "~=5.0"
matplotlib = "~=3.8"
pandas = "~=2.2"
python = ">=3.12,<4a"
gamma-pytools = "~=3.0"
fluxus = "~=1.0"
typing_inspect = "~=0.9"
openai = "~=1.34"
anthropic = "~=0.28"
groq = "~=0.9"
google-generativeai = "~=0.6"
aiohttp = "~=3.9"
transformers = "~=4.41"
torch = "~=2.3"
boto3 = "~=1.34"
moto = "~=5.0"
google-cloud-aiplatform = "~=1.62.0"

[tool.black]
required-version = '24.4.2'
Expand Down Expand Up @@ -164,5 +170,6 @@ module = [
"torch.*",
"transformers.*",
"typing_inspect.*",
"google-cloud-aiplatform.*",
]
ignore_missing_imports = true

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/artkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
remains synchronized with the latest codebase updates.
"""

__version__ = "1.0.6"
__version__ = "1.0.7"
1 change: 1 addition & 0 deletions src/artkit/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
from .model.llm.multi_turn import *
from .model.llm.openai import *
from .model.llm.util import *
from .model.llm.vertexai import *
from .model.vision import *
from .model.vision.base import VisionModel
from .model.vision.openai import *
Expand Down
2 changes: 1 addition & 1 deletion src/artkit/model/llm/gemini/_gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def get_model_params(self) -> Mapping[str, Any]:
def _make_client(self) -> GenerativeModel: # pragma: no cover

configure(api_key=self.get_api_key())
return GenerativeModel(self.model_id)
return GenerativeModel(self.model_id, system_instruction=self.system_prompt)

def _get_safety_settings(self) -> dict[str, str] | None:
"""
Expand Down
21 changes: 21 additions & 0 deletions src/artkit/model/llm/vertexai/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -----------------------------------------------------------------------------
# © 2024 Boston Consulting Group. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------------

"""
Base classes for Vertex AI LLM connection
"""

from ._vertexai import *
Loading

0 comments on commit b554479

Please sign in to comment.