mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
📚 feat: Add Source Citations for File Search in Agents (#8652)
* feat: Source Citations for file_search in Agents * Fix: Added citation limits and relevance score to app service. Removed duplicate tests * ✨ feat: implement Role-level toggle to optionally disable file Source Citation in Agents * 🐛 fix: update mock for librechat-data-provider to include PermissionTypes and SystemRoles --------- Co-authored-by: “Praneeth <praneeth.goparaju@slalom.com>
This commit is contained in:
parent
a955097faf
commit
52e59e40be
36 changed files with 1890 additions and 190 deletions
|
|
@ -60,13 +60,14 @@ const deleteVectors = async (req, file) => {
|
|||
* have a `path` property that points to the location of the uploaded file.
|
||||
* @param {string} params.file_id - The file ID.
|
||||
* @param {string} [params.entity_id] - The entity ID for shared resources.
|
||||
* @param {Object} [params.storageMetadata] - Storage metadata for dual storage pattern.
|
||||
*
|
||||
* @returns {Promise<{ filepath: string, bytes: number }>}
|
||||
* A promise that resolves to an object containing:
|
||||
* - filepath: The path where the file is saved.
|
||||
* - bytes: The size of the file in bytes.
|
||||
*/
|
||||
async function uploadVectors({ req, file, file_id, entity_id }) {
|
||||
async function uploadVectors({ req, file, file_id, entity_id, storageMetadata }) {
|
||||
if (!process.env.RAG_API_URL) {
|
||||
throw new Error('RAG_API_URL not defined');
|
||||
}
|
||||
|
|
@ -80,6 +81,11 @@ async function uploadVectors({ req, file, file_id, entity_id }) {
|
|||
formData.append('entity_id', entity_id);
|
||||
}
|
||||
|
||||
// Include storage metadata for RAG API to store with embeddings
|
||||
if (storageMetadata) {
|
||||
formData.append('storage_metadata', JSON.stringify(storageMetadata));
|
||||
}
|
||||
|
||||
const formHeaders = formData.getHeaders();
|
||||
|
||||
const response = await axios.post(`${process.env.RAG_API_URL}/embed`, formData, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue