mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
Merge pull request #21638 from BerriAI/fix/ai-policy-suggester-use-litellm-acompletion
fix(policy): use litellm.acompletion directly in AiPolicySuggester
This commit is contained in:
commit
d08c3a1d68
1 changed files with 2 additions and 6 deletions
|
|
@ -6,6 +6,7 @@ based on user-provided attack examples and descriptions.
|
|||
import json
|
||||
from typing import List, Optional
|
||||
|
||||
import litellm
|
||||
from litellm._logging import verbose_proxy_logger
|
||||
from litellm.constants import DEFAULT_COMPETITOR_DISCOVERY_MODEL
|
||||
|
||||
|
|
@ -56,17 +57,12 @@ class AiPolicySuggester:
|
|||
description: str,
|
||||
model: Optional[str] = None,
|
||||
) -> dict:
|
||||
from litellm.proxy.proxy_server import llm_router
|
||||
|
||||
if llm_router is None:
|
||||
raise ValueError("LLM router not initialized")
|
||||
|
||||
system_prompt = self._build_system_prompt(templates)
|
||||
user_prompt = self._build_user_prompt(attack_examples, description)
|
||||
model = model or DEFAULT_COMPETITOR_DISCOVERY_MODEL
|
||||
|
||||
try:
|
||||
response = await llm_router.acompletion(
|
||||
response = await litellm.acompletion(
|
||||
model=model,
|
||||
messages=[
|
||||
{"role": "system", "content": system_prompt},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue