-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Introduce filters in the chat completions #5710
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
Conversation
78b7785
to
446ae0f
Compare
446ae0f
to
d76dcc8
Compare
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.
LGTM
Err(MeilisearchHttpError::Milli { | ||
error: meilisearch_types::milli::Error::UserError(user_error), | ||
index_name: _, | ||
}) => Ok((rtxn, Err(user_error))), |
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.
This allows the LLM to get the error and correct the query, am I right?
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.
I have some question before merging the PR
let facets_distribution = index | ||
.facets_distribution(rtxn) | ||
.max_values_per_facet(max_values_per_facet) | ||
.candidates(universe) | ||
.facets(filterable_attributes) | ||
.execute()?; |
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.
is computing the facet count necessary ?
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.
It's important to have the most important ones first in description.
let mut output = String::new(); | ||
for (facet_name, entries) in facets_distribution { | ||
let _ = write!(&mut output, "{}: ", facet_name); | ||
let total_entries = entries.len(); | ||
for (i, (value, _count)) in entries.into_iter().enumerate() { | ||
let _ = if total_entries.saturating_sub(1) == i { | ||
write!(&mut output, "{value}.") | ||
} else { | ||
write!(&mut output, "{value}, ") | ||
}; | ||
} | ||
let _ = writeln!(&mut output); | ||
} |
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.
would it make sense to only retrieve the exhaustive list for facet string?
For facet number we may want to print the min and the max as we do in the facetStats
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.
For facet strings it could be too much for the LLM context.
And for the numbers, yes, you are absolutely right!
Hello, I'm a bot 🤖You are receiving this message because you declared that this PR make changes to the Meilisearch database. Thank you for contributing to Meilisearch ❤️ This PR makes forward-compatible changesForward-compatible changes are changes to the database such that databases created in an older version of Meilisearch are still valid in the new version of Meilisearch. They usually represent additive changes, like adding a new optional attribute or setting.
This PR makes breaking changesBreaking changes are changes to the database such that databases created in an older version of Meilisearch need changes to remain valid in the new version of Meilisearch. This typically happens when the way to store the data changed (change of database, new required key, etc). This can also happen due to breaking changes in the API of an experimental feature.
|
This PR adds filter support in the chat completions route. It is very basic and driven only by a small documentation of the filter syntax. I want to improve the support by adding a list of the filterable attributes and some example values.
To Do