mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
update policies panel to pass enrichment options and show discovered competitors
This commit is contained in:
parent
46c592bb60
commit
3d86aa8d5c
1 changed files with 15 additions and 5 deletions
|
|
@ -228,7 +228,10 @@ const PoliciesPanel: React.FC<PoliciesPanelProps> = ({
|
|||
return JSON.parse(templateStr);
|
||||
};
|
||||
|
||||
const handleParameterConfirm = async (parameters: Record<string, string>) => {
|
||||
const handleParameterConfirm = async (
|
||||
parameters: Record<string, string>,
|
||||
enrichmentOptions?: { model?: string; competitors?: string[] }
|
||||
) => {
|
||||
if (!accessToken || !pendingTemplate) return;
|
||||
|
||||
setIsEnrichingTemplate(true);
|
||||
|
|
@ -237,14 +240,20 @@ const PoliciesPanel: React.FC<PoliciesPanelProps> = ({
|
|||
let enrichedTemplate = pendingTemplate;
|
||||
|
||||
if (pendingTemplate.llm_enrichment) {
|
||||
// Call backend to enrich template with LLM-discovered data
|
||||
// Call backend to enrich template with LLM-discovered data (or user-provided competitors)
|
||||
const enrichResult = await enrichPolicyTemplate(
|
||||
accessToken,
|
||||
pendingTemplate.id,
|
||||
parameters
|
||||
parameters,
|
||||
enrichmentOptions?.model,
|
||||
enrichmentOptions?.competitors
|
||||
);
|
||||
// The backend returns the enriched guardrailDefinitions
|
||||
enrichedTemplate = { ...pendingTemplate, guardrailDefinitions: enrichResult.guardrailDefinitions };
|
||||
// The backend returns the enriched guardrailDefinitions + discovered competitors
|
||||
enrichedTemplate = {
|
||||
...pendingTemplate,
|
||||
guardrailDefinitions: enrichResult.guardrailDefinitions,
|
||||
discoveredCompetitors: enrichResult.competitors || [],
|
||||
};
|
||||
}
|
||||
|
||||
// Substitute parameters in template
|
||||
|
|
@ -491,6 +500,7 @@ const PoliciesPanel: React.FC<PoliciesPanelProps> = ({
|
|||
onConfirm={handleParameterConfirm}
|
||||
onCancel={handleParameterCancel}
|
||||
isLoading={isEnrichingTemplate}
|
||||
accessToken={accessToken || ""}
|
||||
/>
|
||||
</TabPanel>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue