Skip to content

armgit / dspy

Public Imported from GitHub
0

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.py
index dab5c92d6..1e852fd54 100644
--- a/dsp/modules/aws_lm.py
+++ b/dsp/modules/aws_lm.py
@@ -6,9 +6,16 @@ from abc import abstractmethod
import logging
from typing import Any, Literal
import json
-import boto3
from 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 token
CHARS2TOKENS: int = 4
diff --git a/pyproject.toml b/pyproject.toml
index 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]