DSPy: The framework for programming—not prompting—language models
Python
feat(bedrock-lm): Set boto3 as an optional dependency
Jamie Scharfb78b922e3ada
diff --git a/dsp/modules/aws_lm.py b/dsp/modules/aws_lm.pyindex dab5c92d6..1e852fd54 100644--- a/dsp/modules/aws_lm.py+++ b/dsp/modules/aws_lm.py@@ -6,9 +6,16 @@ from abc import abstractmethodimport loggingfrom typing import Any, Literalimport json-import boto3from dsp.modules.lm import LM+try:+ import boto3+except ImportError as e:+ raise ImportError(+ "You need to install boto3 and update AWS CLI with your AWS credentials."+ "Please use the command: pip install boto3"+ )+# Heuristic translating number of chars to tokens# ~4 chars = 1 tokenCHARS2TOKENS: int = 4diff --git a/pyproject.toml b/pyproject.tomlindex 0dc3b3c96..204db0515 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -29,7 +29,6 @@ dependencies = ["datasets~=2.14.6","requests~=2.31.0","optuna~=3.4.0",- "boto3~=1.34"][project.optional-dependencies]