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

Inference plugin: Add Bedrock model adapter #191434

Merged
merged 18 commits into from
Aug 30, 2024

Conversation

pgayvallet
Copy link
Contributor

@pgayvallet pgayvallet commented Aug 27, 2024

Summary

Add the bedrock (well, bedrock-claude) model adapter for the inference plugin. Also had to perform minor changes on the associated connector to add support for new capabilities.

@pgayvallet pgayvallet added release_note:skip Skip the PR/issue when compiling release notes v8.16.0 Team:AI Infra AppEx AI Infrastructure Team labels Aug 27, 2024
@pgayvallet
Copy link
Contributor Author

/ci

@pgayvallet pgayvallet changed the title Inference plugin: Add Gemini model adapter Inference plugin: Add Bedrock model adapter Aug 28, 2024
@pgayvallet
Copy link
Contributor Author

/ci

@pgayvallet
Copy link
Contributor Author

/ci

@pgayvallet
Copy link
Contributor Author

/ci

@pgayvallet pgayvallet marked this pull request as ready for review August 29, 2024 06:53
@pgayvallet pgayvallet requested review from a team as code owners August 29, 2024 06:53
@elasticmachine
Copy link
Contributor

Pinging @elastic/appex-ai-infra (Team:AI Infra)

};
}
// ToolChoiceType.none is not supported by claude.
return undefined;
Copy link
Member

Choose a reason for hiding this comment

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

in this case, should we append something to the system message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I had it on my TODO and somehow forgot about it, I will add it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

case MessageRole.User:
return {
role: 'user' as const,
// content: message.content,
Copy link
Member

Choose a reason for hiding this comment

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

why commented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I initially used the content field for user message, then I decided to use rawContent (which gets mapped directly to content in the connector without transformations) for all type of messages.

I just forgot to delete the commented bits, thanks

// before all operations have completed.
let nextPromise = Promise.resolve();

async function handleNext(chunkBody: CompletionChunk) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this actually needs to be async (my bad). so we don't need the promise either?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

TBH I kept it from your implementation because I wasn't sure what it was doing, so if you confirm it's not needed I absolutely can get rid of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

toolCallId: chunkBody.content_block.id,
function: {
name: chunkBody.content_block.name,
// the API returns '{}' here, which can't be merged with the deltas...
Copy link
Member

Choose a reason for hiding this comment

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

hehe

}
error = createInferenceInternalError(message);
} catch (decodeError) {
error = createInferenceInternalError();
Copy link
Member

Choose a reason for hiding this comment

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

should we use createInferenceInternalError(decodeError.message)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

@dgieselaar dgieselaar left a comment

Choose a reason for hiding this comment

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

thanks!!

@pgayvallet pgayvallet enabled auto-merge (squash) August 30, 2024 07:35
@kibana-ci
Copy link
Collaborator

kibana-ci commented Aug 30, 2024

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #86 / InfraOps App Metrics UI Hosts View #With data #Single Host Flyout Tabs Overview Tab cpuUsage tile should show 48.3%
  • [job] [logs] FTR Configs #86 / InfraOps App Metrics UI Hosts View #With data #Single Host Flyout Tabs Overview Tab cpuUsage tile should show 48.3%

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@pgayvallet pgayvallet merged commit 3e0a431 into elastic:main Aug 30, 2024
28 of 29 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Aug 30, 2024
pgayvallet added a commit that referenced this pull request Sep 3, 2024
## Summary

Fix regression on `InvokeAIRaw` bedrock subaction introduced by
#191434
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:AI Infra AppEx AI Infrastructure Team v8.16.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants