-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add support for AWS Bedrock (Nova & Claude) #160
Conversation
Hi, thanks for the PR! Have you tested this yet? |
Yes I have switched my HA to use this version and it's working great. I'm feeding it 15-30 jpegs extracted from Blue Iris, using nova-pro.
|
|
||
return response_text | ||
|
||
async def _post(self, model, data) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provider implementations shouldn't overwrite the _post
method. If AWS requires special error handling those errors should be handled directly in Provider
.
_LOGGER.error(f"Found unknown model type `{call.model}` for AWS Bedrock call.") | ||
raise ServiceValidationError("Unknown model type specified. Only Nova and Claude are currently supported.") | ||
|
||
def _prepare_vision_data_nova(self, call) -> list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to handled in _prepare_vision_data
as well as the superclass (Provider
) looks like this:
async def vision_request(self, call) -> str:
data = self._prepare_vision_data(call)
return await self._make_request(data)
Therefore _prepare_vision_data_nova
would never be called.
else: | ||
_LOGGER.warning(f"Found unknown model type `{call.model}` for AWS Bedrock call. Will attempt `Nova`") | ||
|
||
def _prepare_text_data_nova(self, call) -> list: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also needs to be handled in _prepare_text_data
for the same reason as vision above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work so far! Just a couple of issues (see my comments). Does AWS really have different API guidelines for different models?
Also boto3
would need to be added to requirements in manifest.json
see the HA dev docs here.
Thanks again for your work!
I'll get it tackled. It'll be a couple days. |
@valentinfrlch I made the changes requested. Let me know if I misunderstood anything, my coding skills are quite rusty. |
Hello, your work is great, but I can't integrate DeepSeek. |
Can you be a bit more specific? DeepSeek seems to be available through the Marketplace only and you have to provision an instance? |
Please create a feature request. This is a pull request for something completely unrelated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me. Thanks again for your contribution! Somehow I don't have access to any models on AWS so I can't really test this... Will check again tomorrow.
You need to turn the model access on. |
During |
Of course the one thing I didn't test! Good catch. I'll fix it tonight. |
Should be fixed now. Sorry about that. |
Thank you! Everything works now. The models seem to be very accurate too, so a great addition! |
@valentinfrlch I'm going to refactor this. I must have had tunnel vision and missed a different way of invoking the models on Bedrock. Using the converse api it's a single API spec and we'll be able to support the majority of models available in AWS. |
No description provided.