-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Obs AI Assistant] Include
search-*
when recalling documents (#173710)
Include `search-*` indices when recalling documents from the knowledge base. General approach: - use the current user, not the internal user. the latter will ~never have access to `search-*` - use `_field_caps` to look for sparse_vector field types - `ml.inference.` is a hard-coded prefix, so we can strip that and `_expanded.predicted_value` to get the original field name - only include documents that have the same model ID as we are using for our regular recalls - if the request fails for whatever reason (which is fine, users might not have access to `search-*`), just ignore it and log it with log level debug - we serialize the entire document - some other non-vectorized metadata can also be important for the LLM to make decisions - sort all documents (kb + `search-*`) by score and return the first 20 - count the amount of tokens, don't send over more than 4000 tokens to the LLM to keep response time down. drop the remaining documents on the floor and log it.
- Loading branch information
1 parent
31b7380
commit fc997b1
Showing
6 changed files
with
244 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.