-
Notifications
You must be signed in to change notification settings - Fork 2
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
ET-4885 allow to prefix snippets #1107
Conversation
web-api/src/embedding.rs
Outdated
}; | ||
|
||
let sequence = if let Some(prefix) = prefix { | ||
Cow::Owned(format!("{prefix} {sequence}")) |
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 the concatenation using a space okay?
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.
removed
web-api/src/embedding.rs
Outdated
#[cfg_attr(test, serde(deny_unknown_fields))] | ||
pub(crate) struct Prefix { | ||
/// Prefix prepended to search queries when embedding them. | ||
pub(crate) query: Option<String>, |
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 am not sure if we care to distinguish between prefix not given and an empty prefix. The end result will be the same.
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.
If you by default separate the prefix with a white-space from the rest it makes a difference.
Through we removed the default space separator so I now changed it to empty string.
Allows specifying two prefixes:
embedding.prefix.query
prefix all queries with this before computing their embeddingembedding.prefix.snippet
prefix all snippets with this before computing their embeddingworks for both local and sagemaker setups
Env variables:
XAYN_WEB_API__EMBEDDING__PREFIX__QUERY
XAYN_WEB_API__EMBEDDING__PREFIX__SNIPPET