-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Introduce the InferenceChatModel
for langchain
#206429
base: main
Are you sure you want to change the base?
Conversation
/ci |
/ci |
2 similar comments
/ci |
/ci |
04575f1
to
f2a2df5
Compare
/ci |
1 similar comment
/ci |
/ci |
/ci |
/ci |
/ci |
/ci |
/ci |
/ci |
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
|
Pinging @elastic/appex-ai-infra (Team:AI Infra) |
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.
Core changes LGTM (review only): Removing an eslint exception is usually good news!
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.
Looks good from GenAi side. Just one comment but it is a nit pick.
// https://github.com/elastic/kibana/blob/49df29609e10429809f3710d6b8b1d5efbc833a7/x-pack/platform/plugins/shared/actions/server/sub_action_framework/sub_action_connector.ts#L200-L202 | ||
// Status code: 400. Message: API Error: model_error - The response was filtered due to the prompt triggering Azure OpenAI's content management policy. Please modify your prompt and retry. | ||
// status_exception - Received an authentication error status code for request from inference entity id [openai-chat_completion-uuid] status [401]. Error message: [Incorrect API key provided] |
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.
Are these extra comments? Or can you clarify why the same text is repeated below.
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.
nice catch thanks, yeah those were copy pasted to create the consts in the test file, will remove the comments
Summary
Part of #206710
This PR introduces the
InferenceChatModel
class, which is a langchain chatModel utilizing the inference APIs (chatComplete
) under the hood.Creating instances of
InferenceChatModel
can either be done by manually importing the class from the new@kbn/inference-langchain
package, or by using the newcreateChatModel
API exposes from the inference plugin's start contract.The main upside of using this chatModel is that the unification and normalization layers are already being taken care of by the inference plugin, making sure that the underlying models are being used with the exact same capabilities. More details on the upsides and reasoning in the associated issue.
Usage
Usage is very straightforward
Important
This PR is only adding the implementation, and not wiring it anywhere or using it in any existing code. This is meant to be done in a later stage. Merging that implementation first will allow to have distinct PRs for the integration with search (playground) and security (assistant + other workflows), with proper testing