mirror of
https://github.com/msoedov/agentic_security.git
synced 2026-07-07 20:27:49 +02:00
fix(fmt):
This commit is contained in:
+1
-2
@@ -1,5 +1,4 @@
|
|||||||
"""
|
"""Quality Assurance Testing Agent.
|
||||||
Quality Assurance Testing Agent
|
|
||||||
|
|
||||||
The goal of this agent is to perform quality assurance testing on a product or service.
|
The goal of this agent is to perform quality assurance testing on a product or service.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import Any
|
|
||||||
import httpx
|
import httpx
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
|
|
||||||
@@ -14,8 +14,7 @@ class LLMSpec(BaseModel):
|
|||||||
return parse_http_spec(http_spec)
|
return parse_http_spec(http_spec)
|
||||||
|
|
||||||
async def probe(self, prompt: str) -> httpx.Response:
|
async def probe(self, prompt: str) -> httpx.Response:
|
||||||
"""
|
"""Sends an HTTP request using the `httpx` library.
|
||||||
Sends an HTTP request using the `httpx` library.
|
|
||||||
|
|
||||||
Replaces a placeholder in the request body with a provided prompt and returns the response.
|
Replaces a placeholder in the request body with a provided prompt and returns the response.
|
||||||
|
|
||||||
@@ -42,8 +41,7 @@ class LLMSpec(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
def parse_http_spec(http_spec: str) -> LLMSpec:
|
def parse_http_spec(http_spec: str) -> LLMSpec:
|
||||||
"""
|
"""Parses an HTTP specification string into a LLMSpec object.
|
||||||
Parses an HTTP specification string into a LLMSpec object.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
http_spec (str): A string representing an HTTP specification.
|
http_spec (str): A string representing an HTTP specification.
|
||||||
@@ -79,7 +77,8 @@ def parse_http_spec(http_spec: str) -> LLMSpec:
|
|||||||
|
|
||||||
|
|
||||||
def escape_special_chars_for_json(prompt: str) -> str:
|
def escape_special_chars_for_json(prompt: str) -> str:
|
||||||
"""Escapes special characters in a string for safe inclusion in a JSON template.
|
"""Escapes special characters in a string for safe inclusion in a JSON
|
||||||
|
template.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
prompt (str): The input string to be escaped.
|
prompt (str): The input string to be escaped.
|
||||||
|
|||||||
@@ -296,8 +296,8 @@ def load_local_csv() -> ProbeDataset:
|
|||||||
|
|
||||||
|
|
||||||
def dataset_from_iterator(name: str, iterator) -> list:
|
def dataset_from_iterator(name: str, iterator) -> list:
|
||||||
"""
|
"""Convert an iterator into a list of prompts and create a ProbeDataset
|
||||||
Convert an iterator into a list of prompts and create a ProbeDataset object.
|
object.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
name (str): The name of the dataset.
|
name (str): The name of the dataset.
|
||||||
@@ -305,7 +305,6 @@ def dataset_from_iterator(name: str, iterator) -> list:
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
list: A list containing a single ProbeDataset object.
|
list: A list containing a single ProbeDataset object.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
prompts = list(iterator)
|
prompts = list(iterator)
|
||||||
tokens = count_words_in_list(prompts)
|
tokens = count_words_in_list(prompts)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from inline_snapshot import snapshot
|
from inline_snapshot import snapshot
|
||||||
from .data import prepare_prompts, ProbeDataset
|
|
||||||
|
from .data import ProbeDataset, prepare_prompts
|
||||||
|
|
||||||
|
|
||||||
class TestPreparePrompts:
|
class TestPreparePrompts:
|
||||||
|
|||||||
Reference in New Issue
Block a user