Skip to content

Adding Converse method to BedrockRuntime client #1861

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

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

Conversation

victor-upmeet
Copy link
Contributor

Hi there

This PR implements the Converse method to the BedrockRuntime client. However, I am facing some issues with the generated code that makes the tests to fail.

In the static analysis, tests fail because constructors are not implemented on some classes, but these same classes are instanciated with arguments. There are also some failures due to wrong documentation types.

In the CI tests, I have a "Undefined index: role" error originating inside the ConverseResponse class in the generated code.

If I can do anything to help let met know, but as far as I understand, the issue seems to be cause by the code generator.

@stof
Copy link
Member

stof commented Apr 18, 2025

Looks like the CodeGenerator has an inconsistency in its handling of objects without properties.
However, having such object in the response does not make sense to me. Either the API definition of AWS is wrong, or we don't handle it properly.

@stof
Copy link
Member

stof commented Apr 18, 2025

The shape description uses document: true in https://github.com/aws/aws-sdk-php/blob/33f6d393834053b11a5fc10573a211d92e61c2db/src/data/bedrock-runtime/2023-09-30/api-2.json#L970-L974
this is probably not handled by the code generator

@stof
Copy link
Member

stof commented Apr 18, 2025

I discovered that DocumentSource uses union: true as well: https://github.com/aws/aws-sdk-php/blob/33f6d393834053b11a5fc10573a211d92e61c2db/src/data/bedrock-runtime/2023-09-30/api-2.json#L1013-L1021

This also seems something new in those API declarations.

@stof
Copy link
Member

stof commented Apr 18, 2025

I opened #1882 to track the support for document shapes in the code generator

"message":{
"content":[
{
"role":"user",
Copy link
Member

Choose a reason for hiding this comment

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

this `"role": "user" should be a key in the Message object, not in the ContentBlock object (this is why the tests are failing)

"content":[
{
"role":"user",
"content":{
Copy link
Member

Choose a reason for hiding this comment

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

This looks suspicious to me. https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Message.html says that content is an array of content blocks. Those content blocks don't have an additional content key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants