mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-08 22:21:35 +00:00
add onStatus callback to streaming enrichment
This commit is contained in:
parent
70cb86befa
commit
b0080202c8
1 changed files with 4 additions and 1 deletions
|
|
@ -5602,7 +5602,8 @@ export const enrichPolicyTemplateStream = async (
|
|||
guardrailDefinitions: any[];
|
||||
}) => void,
|
||||
onError?: (error: string) => void,
|
||||
options?: { instruction?: string; existingCompetitors?: string[] }
|
||||
options?: { instruction?: string; existingCompetitors?: string[] },
|
||||
onStatus?: (message: string) => void
|
||||
) => {
|
||||
const url = proxyBaseUrl
|
||||
? `${proxyBaseUrl}/policy/templates/enrich/stream`
|
||||
|
|
@ -5647,6 +5648,8 @@ export const enrichPolicyTemplateStream = async (
|
|||
const event = JSON.parse(line.slice(6));
|
||||
if (event.type === "competitor") {
|
||||
onCompetitor(event.name);
|
||||
} else if (event.type === "status") {
|
||||
onStatus?.(event.message);
|
||||
} else if (event.type === "done") {
|
||||
onDone(event);
|
||||
} else if (event.type === "error") {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue