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: update aws_bedrock #1194

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

feat: update aws_bedrock #1194

wants to merge 7 commits into from

Conversation

Asher-hss
Copy link
Collaborator

@Asher-hss Asher-hss commented Nov 19, 2024

Description

#1174

Motivation and Context

#1174

  • I have raised an issue to propose this change (required for new features and bug fixes)

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds core functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (update in the documentation)
  • Example (update in the folder of example)

Implemented Tasks

  • Subtask 1
  • Subtask 2
  • Subtask 3

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

  • I have read the CONTRIBUTION guide. (required)
  • My change requires a change to the documentation.
  • I have updated the tests accordingly. (required for a bug fix or a new feature)
  • I have updated the documentation accordingly.

@Asher-hss Asher-hss self-assigned this Nov 20, 2024
@Asher-hss Asher-hss marked this pull request as draft November 20, 2024 06:52
@Asher-hss Asher-hss marked this pull request as ready for review November 25, 2024 00:11
@Wendong-Fan Wendong-Fan added the Model Related to backend models label Nov 27, 2024
@Wendong-Fan Wendong-Fan added this to the Sprint 17 milestone Nov 27, 2024
@Wendong-Fan Wendong-Fan changed the title update aws_bedrock feat: update aws_bedrock Nov 30, 2024
@Wendong-Fan Wendong-Fan requested a review from koch3092 November 30, 2024 20:00
@anjieyang
Copy link
Contributor

Hi Shengsong, thanks for your contributing. Please update the Camel license in the code.

Copy link
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

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

Thanks @Asher-hss ! Could you take a look at https://github.com/aws-samples/bedrock-access-gateway and verify whether we can use it to do a more simple integration? This would be more easier for us to maintain it if it works

tool_choice (Union[dict[str, str], str], optional): The tool choice.
"""

max_tokens: Optional[int] = 400
Copy link
Member

Choose a reason for hiding this comment

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

400 token is quiet limited, could we set this to None?

Comment on lines +24 to +28
maxTokens (int, optional): The maximum number of tokens.
temperatue (float, optional): Controls the randomness of the output.
top_p (float, optional): Use nucleus sampling.
top_k (int, optional): Use top-k sampling.
tool_choice (Union[dict[str, str], str], optional): The tool choice.
Copy link
Member

Choose a reason for hiding this comment

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

any reference link to AWS bedrock parameters? It seems the supported parameters are quite limited

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InferenceConfiguration.html
Hi wendong,this is the reference link about aws bedrock parameters

@Asher-hss
Copy link
Collaborator Author

谢谢@Asher-hss!您能否查看https://github.com/aws-samples/bedrock-access-gateway并验证我们是否可以使用它进行更简单的集成?如果它有效,我们将更容易维护它

I think we're good to go, interacting through OpenAI's client, which will be more beneficial for future maintenance.

Copy link
Collaborator

@koch3092 koch3092 left a comment

Choose a reason for hiding this comment

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

Hi @Asher-hss , left some comments below

Comment on lines +44 to +45
api_key (Optional[str], optional): This parameter is not used.
url (Optional[str], optional): This parameter is not used.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
api_key (Optional[str], optional): This parameter is not used.
url (Optional[str], optional): This parameter is not used.
api_key (str, optional): This parameter is not used.
url (str, optional): This parameter is not used.

Corrected parameter type descriptions, and the purpose of these two parameters.

api_key: Optional[str] = None,
url: Optional[str] = None,
token_counter: Optional[BaseTokenCounter] = None,
region_name: Optional[str] = "eu-west-2",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
region_name: Optional[str] = "eu-west-2",
region_name: Optional[str] = "eu-west-2",
**kwargs: Any,

How about adding **kwargs, which can add some customizable items to boto3.client initialization

service_name='bedrock-runtime',
region_name=region_name,
aws_access_key_id=access_key_id,
aws_secret_access_key=secret_access_key,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
aws_secret_access_key=secret_access_key,
aws_secret_access_key=secret_access_key,
**kwargs,


model = ModelFactory.create(
model_platform=ModelPlatformType.AWS_BEDROCK,
model_type="meta.llama3-70b-instruct-v1:0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add values in camel.types.enums.ModelType

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Model Related to backend models
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants