diff --git a/pyproject.toml b/pyproject.toml index 4a1f3c54..db4ea30b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cai-framework" -version = "0.5.6" +version = "0.5.7" description = "Cybersecurity AI Framework" readme = "README.md" requires-python = ">=3.9" diff --git a/src/cai/agents/guardrails.py b/src/cai/agents/guardrails.py index b2941b60..9fabee4b 100644 --- a/src/cai/agents/guardrails.py +++ b/src/cai/agents/guardrails.py @@ -24,6 +24,9 @@ from openai import AsyncOpenAI import os import unicodedata +# Determine API key +api_key = os.getenv("ALIAS_API_KEY", os.getenv("OPENAI_API_KEY", "sk-alias-1234567890")) + class PromptInjectionCheck(BaseModel): """Result of prompt injection detection""" @@ -221,7 +224,7 @@ injection_detector_agent = Agent( output_type=PromptInjectionCheck, model=OpenAIChatCompletionsModel( model=os.getenv('CAI_MODEL', 'alias0'), - openai_client=AsyncOpenAI(), + openai_client=AsyncOpenAI(api_key=api_key), ) )