diff --git a/agentic_security/http_spec.py b/agentic_security/http_spec.py index 8ce45a8..fafe68c 100644 --- a/agentic_security/http_spec.py +++ b/agentic_security/http_spec.py @@ -44,7 +44,7 @@ class LLMSpec(BaseModel): has_audio: bool = False @classmethod - # class method6 + def from_string(cls, http_spec: str): try: return parse_http_spec(http_spec) @@ -80,8 +80,6 @@ class LLMSpec(BaseModel): if self.has_audio and not encoded_audio: raise ValueError("Audio is required for this request.") - - async def probe( self, prompt: str, encoded_image: str = "", encoded_audio: str = "", files={} ) -> httpx.Response: @@ -163,16 +161,11 @@ def parse_http_spec(http_spec: str) -> LLMSpec: method, url = lines[0].split(" ")[0:2] # Check url validity - valid_url= urlparse(url) # if valid_url.scheme not in ("http", "https") or not valid_url.netloc: # if missing the correct formatting ://, urlparse.netloc will be empty raise InvalidHTTPSpecError(f"Invalid URL: {url}. Ensure it starts with 'http://' or 'https://'") - - - - # Initialize headers and body headers = {} body = ""