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

feat: add Amazon Bedrock support #6226

Merged
merged 44 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7462525
Add Bedrock
viveksilimkhan1 Nov 3, 2023
e3efb9f
Update supported models for Bedrock
viveksilimkhan1 Nov 7, 2023
a3f34ed
Fix supports and add extract response in Bedrock
viveksilimkhan1 Nov 7, 2023
5295bc9
Merge branch 'main' into add-bedrock
tstadel Nov 7, 2023
f8a910c
fix errors imports
tstadel Nov 7, 2023
1cd86c7
improve and refactor supports
tstadel Nov 7, 2023
3a343a7
fix install
tstadel Nov 7, 2023
be0e211
fix mypy
tstadel Nov 7, 2023
5c57455
fix pylint
tstadel Nov 7, 2023
7715cd7
fix existing tests
tstadel Nov 7, 2023
ce3e7d6
Added Anthropic Bedrock
viveksilimkhan1 Nov 7, 2023
5e4e306
fix tests
tstadel Nov 7, 2023
f97f7cd
Merge branch 'add-bedrock' of github.com:viveksilimkhan1/haystack int…
tstadel Nov 7, 2023
2447324
fix sagemaker tests
tstadel Nov 8, 2023
35269ac
add default prompt handler, constructor and supports tests
tstadel Nov 8, 2023
54e9f42
more tests
tstadel Nov 8, 2023
00f1c55
invoke refactoring
tstadel Nov 8, 2023
dc24acc
refactor model_kwargs
tstadel Nov 8, 2023
68960f7
fix mypy
tstadel Nov 8, 2023
49f0ce9
lstrip responses
tstadel Nov 8, 2023
662b10c
Add streaming support
viveksilimkhan1 Nov 9, 2023
31fff2b
bump boto3 version
tstadel Nov 9, 2023
45f3153
Merge branch 'add-bedrock' of github.com:viveksilimkhan1/haystack int…
tstadel Nov 9, 2023
5150136
add class docstrings, better exception names
tstadel Nov 13, 2023
fb3a076
fix layer name
tstadel Nov 14, 2023
0b1bcac
add tests for anthropic and cohere model adapters
tstadel Nov 14, 2023
23459da
update cohere params
tstadel Nov 14, 2023
7260ad2
update ai21 args and add tests
tstadel Nov 14, 2023
c5eadd9
support cohere command light model
tstadel Nov 14, 2023
f5f5915
add tital tests
tstadel Nov 14, 2023
6782243
better class names
tstadel Nov 14, 2023
614ae87
support meta llama 2 model
tstadel Nov 14, 2023
8a18e31
fix streaming support
tstadel Nov 14, 2023
ed0f4d0
more future-proof model adapter selection
tstadel Nov 14, 2023
4697d40
fix import
tstadel Nov 14, 2023
693e8bc
fix mypy
tstadel Nov 14, 2023
ec6b995
fix pylint for preview
tstadel Nov 14, 2023
2ec9f81
add tests for streaming
tstadel Nov 14, 2023
d10b91d
add release notes
tstadel Nov 14, 2023
c516d1d
Apply suggestions from code review
tstadel Nov 15, 2023
4a30206
fix format
tstadel Nov 15, 2023
9846fd1
fix tests after msg changes
tstadel Nov 15, 2023
4d70ce5
fix streaming for cohere
tstadel Nov 15, 2023
1997281
Merge branch 'main' into add-bedrock
tstadel Nov 15, 2023
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
5 changes: 1 addition & 4 deletions .github/workflows/linting_preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ jobs:
uses: tj-actions/changed-files@v40
with:
files: |
**/*.py
files_ignore: |
test/**
rest_api/test/**
haystack/preview/**/*.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misconfig tried to lint my changes and failed because of missing dependencies that are not available to in preview.


- uses: actions/setup-python@v4
with:
Expand Down
21 changes: 21 additions & 0 deletions haystack/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,27 @@ class HuggingFaceInferenceUnauthorizedError(HuggingFaceInferenceError):
"""Exception for issues that occur in the HuggingFace inference node due to unauthorized access"""


class AWSConfigurationError(NodeError):
"""Exception raised when AWS is not configured correctly"""

def __init__(self, message: Optional[str] = None, send_message_in_event: bool = False):
super().__init__(message=message, send_message_in_event=send_message_in_event)


class AmazonBedrockConfigurationError(NodeError):
"""Exception raised when AmazonBedrock node is not configured correctly"""

def __init__(self, message: Optional[str] = None, send_message_in_event: bool = False):
super().__init__(message=message, send_message_in_event=send_message_in_event)


class AmazonBedrockInferenceError(NodeError):
"""Exception for issues that occur in the Bedrock inference node"""

def __init__(self, message: Optional[str] = None, send_message_in_event: bool = False):
super().__init__(message=message, send_message_in_event=send_message_in_event)


class SageMakerInferenceError(NodeError):
"""Exception for issues that occur in the SageMaker inference node"""

Expand Down
1 change: 1 addition & 0 deletions haystack/nodes/prompt/invocation_layer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from haystack.nodes.prompt.invocation_layer.cohere import CohereInvocationLayer
from haystack.nodes.prompt.invocation_layer.hugging_face import HFLocalInvocationLayer
from haystack.nodes.prompt.invocation_layer.hugging_face_inference import HFInferenceEndpointInvocationLayer
from haystack.nodes.prompt.invocation_layer.amazon_bedrock import AmazonBedrockInvocationLayer
from haystack.nodes.prompt.invocation_layer.sagemaker_meta import SageMakerMetaInvocationLayer
from haystack.nodes.prompt.invocation_layer.sagemaker_hf_infer import SageMakerHFInferenceInvocationLayer
from haystack.nodes.prompt.invocation_layer.sagemaker_hf_text_gen import SageMakerHFTextGenerationInvocationLayer
Loading