Skip to content

Commit

Permalink
fix: sources
Browse files Browse the repository at this point in the history
  • Loading branch information
revolunet committed Dec 30, 2024
1 parent 3d0869f commit 476f553
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions src/lib/albert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,31 @@ export const getPromptWithRagResults = ({
data: {
chunk: {
content: string;
metadata: { title: string; document_name: string };
metadata: {
title: string;
document_name: string;
collection_id: string;
};
};
}[];
};
}) => `Réponds à la question suivante au format markdown sans mettre de titre et en te basant sur le contexte fourni uniquement.
}) => {
return `Réponds à la question suivante en utilisant un format markdown bien lisible et en te basant sur le contexte fourni uniquement. Cite tes sources en conclusion
## Question: ${input}
## Question: ${input}
## Contexte
## Contexte
${results.data
.map(
(hit) => `${hit.chunk.metadata.title} ${hit.chunk.metadata.document_name}
${hit.chunk.content}
`
)
.join("\n")}
`;
${results.data
.map(
(hit) => `[${
(hit.chunk.metadata.title &&
hit.chunk.metadata.title.replace(/^#+/, "")) ||
hit.chunk.metadata.document_name
}](https://espace-membre.incubateur.net/doc/${
hit.chunk.metadata.collection_id
}/${hit.chunk.metadata.document_name})
${hit.chunk.content}\n\n`
)
.join("\n")}`;
};

0 comments on commit 476f553

Please sign in to comment.