Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass aws_region_name to get_aws_service_client() in SageMakerLLM #12000

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
)
from llama_index.llms.sagemaker_endpoint.utils import BaseIOHandler, IOHandler

import warnings

DEFAULT_IO_HANDLER = IOHandler()
LLAMA_MESSAGES_TO_PROMPT = messages_to_prompt
LLAMA_COMPLETION_TO_PROMPT = completion_to_prompt
Expand Down Expand Up @@ -130,7 +132,7 @@ def __init__(
aws_access_key_id: Optional[str] = None,
aws_secret_access_key: Optional[str] = None,
aws_session_token: Optional[str] = None,
region_name: Optional[str] = None,
aws_region_name: Optional[str] = None,
logan-markewich marked this conversation as resolved.
Show resolved Hide resolved
max_retries: Optional[int] = 3,
timeout: Optional[float] = 60.0,
temperature: Optional[float] = 0.5,
Expand All @@ -156,10 +158,21 @@ def __init__(
model_kwargs["temperature"] = temperature
content_handler = content_handler
self._completion_to_prompt = completion_to_prompt

region_name = kwargs.pop('region_name', None)
if region_name is not None:
warnings.warn(
"Kwarg `region_name` is deprecated and will be removed in a future version. "
"Please use `aws_region_name` instead.",
DeprecationWarning
)
if not aws_region_name:
aws_region_name = region_name

self._client = get_aws_service_client(
service_name="sagemaker-runtime",
profile_name=profile_name,
region_name=region_name,
region_name=aws_region_name,
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
aws_session_token=aws_session_token,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exclude = ["**/BUILD"]
license = "MIT"
name = "llama-index-llms-sagemaker-endpoint"
readme = "README.md"
version = "0.1.3"
version = "0.1.4"

[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
Expand Down
Loading