feat(add network.retry):

This commit is contained in:
Alexander Myasoedov
2025-02-21 19:17:45 +02:00
parent bf14877ef4
commit c15ac38bec
3 changed files with 10 additions and 8 deletions
+3 -5
View File
@@ -1,13 +1,11 @@
from agentic_security.config import CfgMixin
from agentic_security.config import get_or_create_config
from agentic_security.core.app import set_secrets
class InMemorySecrets:
def __init__(self):
self.secrets = {}
self.config = CfgMixin()
self.config.get_or_create_config()
self.secrets = self.config.config.get("secrets", {})
config = get_or_create_config()
self.secrets = config.get_config_value("secrets", {})
set_secrets(self.secrets)
def set_secret(self, key: str, value: str):
+5 -1
View File
@@ -4,6 +4,8 @@ from enum import Enum
import httpx
from pydantic import BaseModel
from agentic_security.config import settings_var
class Modality(Enum):
TEXT = 0
@@ -90,7 +92,9 @@ class LLMSpec(BaseModel):
content = self.body.replace("<<PROMPT>>", escape_special_chars_for_json(prompt))
content = content.replace("<<BASE64_IMAGE>>", encoded_image)
content = content.replace("<<BASE64_AUDIO>>", encoded_audio)
async with httpx.AsyncClient() as client:
transport = httpx.AsyncHTTPTransport(retries=settings_var("network.retry", 3))
async with httpx.AsyncClient(transport=transport) as client:
response = await client.request(
method=self.method,
url=self.url,
+2 -2
View File
@@ -9,7 +9,7 @@ from rich.console import Console
from rich.table import Table
from tabulate import tabulate
from agentic_security.config import CfgMixin # Importing the configuration mixin
from agentic_security.config import SettingsMixin # Importing the configuration mixin
from agentic_security.models.schemas import Scan
from agentic_security.probe_data import REGISTRY
from agentic_security.routes.scan import streaming_response_generator
@@ -23,7 +23,7 @@ YELLOW = colorama.Fore.YELLOW
BLUE = colorama.Fore.BLUE
class AgenticSecurity(CfgMixin):
class AgenticSecurity(SettingsMixin):
@classmethod
async def async_scan(
cls,