mirror of
https://github.com/elastic/kibana.git
synced 2025-04-22 17:04:01 -04:00
## Summary Part of https://github.com/elastic/kibana/issues/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 new `createChatModel` 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 ```ts const chatModel = await inferenceStart.getChatModel({ request, connectorId: myInferenceConnectorId, chatModelOptions: { temperature: 0.2, }, }); // just use it as another langchain chatModel, e.g. const response = await chatModel.stream('What is Kibana?'); for await (const chunk of response) { // do something with the chunk } ``` ### 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 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
---|---|---|
.. | ||
codeql | ||
ISSUE_TEMPLATE | ||
updatecli/values.d | ||
workflows | ||
CODEOWNERS | ||
ISSUE_TEMPLATE.md | ||
paths-labeller.yml | ||
PULL_REQUEST_TEMPLATE.md | ||
relabel.yml | ||
stale.yml |