mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-13 05:17:26 +00:00
removing unused code
This commit is contained in:
parent
830ecb4b28
commit
0f1a9d06db
2 changed files with 1 additions and 18 deletions
|
@ -4,18 +4,13 @@
|
|||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
import os
|
||||
from enum import Enum
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from llama_stack.schema_utils import json_schema_type
|
||||
|
||||
|
||||
class ShieldType(Enum):
|
||||
self_check = "self_check"
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class NVIDIASafetyConfig(BaseModel):
|
||||
"""
|
||||
|
@ -41,14 +36,6 @@ class NVIDIASafetyConfig(BaseModel):
|
|||
description="The url for accessing the guardrails service",
|
||||
)
|
||||
config_id: Optional[str] = Field(default="self-check", description="Config ID to use from the config store")
|
||||
config_store_path: Optional[str] = Field(default="/config-store", description="Path to config store")
|
||||
|
||||
@classmethod
|
||||
@field_validator("guard_type")
|
||||
def validate_guard_type(cls, v):
|
||||
if v not in [t.value for t in ShieldType]:
|
||||
raise ValueError(f"Unknown shield type: {v}")
|
||||
return v
|
||||
|
||||
@classmethod
|
||||
def sample_run_config(cls, **kwargs) -> Dict[str, Any]:
|
||||
|
|
|
@ -24,7 +24,6 @@ class NVIDIASafetyAdapter(Safety, ShieldsProtocolPrivate):
|
|||
def __init__(self, config: NVIDIASafetyConfig) -> None:
|
||||
print(f"Initializing NVIDIASafetyAdapter({config.guardrails_service_url})...")
|
||||
self.config = config
|
||||
self.registered_shields = []
|
||||
|
||||
async def initialize(self) -> None:
|
||||
pass
|
||||
|
@ -56,7 +55,6 @@ class NeMoGuardrails:
|
|||
temperature: float = 1.0,
|
||||
):
|
||||
self.config_id = config.config_id
|
||||
self.config_store_path = config.config_store_path
|
||||
self.model = model
|
||||
assert self.config_id is not None or self.config_store_path is not None, (
|
||||
"Must provide one of config id or config store path"
|
||||
|
@ -64,7 +62,6 @@ class NeMoGuardrails:
|
|||
if temperature <= 0:
|
||||
raise ValueError("Temperature must be greater than 0")
|
||||
|
||||
self.config = config
|
||||
self.temperature = temperature
|
||||
self.threshold = threshold
|
||||
self.guardrails_service_url = config.guardrails_service_url
|
||||
|
@ -89,7 +86,6 @@ class NeMoGuardrails:
|
|||
response = requests.post(
|
||||
url=f"{self.guardrails_service_url}/v1/guardrail/checks", headers=headers, json=request_data
|
||||
)
|
||||
print(response)
|
||||
response.raise_for_status()
|
||||
if "Content-Type" in response.headers and response.headers["Content-Type"].startswith("application/json"):
|
||||
response_json = response.json()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue