mirror of
https://github.com/msoedov/agentic_security.git
synced 2026-08-09 19:26:04 +02:00
fixed spacing issues
This commit is contained in:
@@ -44,7 +44,7 @@ class LLMSpec(BaseModel):
|
|||||||
has_audio: bool = False
|
has_audio: bool = False
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
# class method6
|
|
||||||
def from_string(cls, http_spec: str):
|
def from_string(cls, http_spec: str):
|
||||||
try:
|
try:
|
||||||
return parse_http_spec(http_spec)
|
return parse_http_spec(http_spec)
|
||||||
@@ -80,8 +80,6 @@ class LLMSpec(BaseModel):
|
|||||||
if self.has_audio and not encoded_audio:
|
if self.has_audio and not encoded_audio:
|
||||||
raise ValueError("Audio is required for this request.")
|
raise ValueError("Audio is required for this request.")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def probe(
|
async def probe(
|
||||||
self, prompt: str, encoded_image: str = "", encoded_audio: str = "", files={}
|
self, prompt: str, encoded_image: str = "", encoded_audio: str = "", files={}
|
||||||
) -> httpx.Response:
|
) -> httpx.Response:
|
||||||
@@ -163,16 +161,11 @@ def parse_http_spec(http_spec: str) -> LLMSpec:
|
|||||||
method, url = lines[0].split(" ")[0:2]
|
method, url = lines[0].split(" ")[0:2]
|
||||||
|
|
||||||
# Check url validity
|
# Check url validity
|
||||||
|
|
||||||
valid_url= urlparse(url)
|
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
|
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://'")
|
raise InvalidHTTPSpecError(f"Invalid URL: {url}. Ensure it starts with 'http://' or 'https://'")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Initialize headers and body
|
# Initialize headers and body
|
||||||
headers = {}
|
headers = {}
|
||||||
body = ""
|
body = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user