cyber_query_ai.server¶
Server for the CyberQueryAI application.
Classes
|
AI chatbot server application inheriting from TemplateServer. |
- class cyber_query_ai.server.CyberQueryAIServer(config=None)[source]¶
AI chatbot server application inheriting from TemplateServer.
- __init__(config=None)[source]¶
Initialise the CyberQueryAIServer by delegating to the template server.
- Parameters:
config (
CyberQueryAIConfig|None) – CyberQueryAI server configuration
- static parse_response(response_str)[source]¶
Parse the LLM response string into a dictionary.
- Parameters:
response_str (
str) – LLM response string- Return dict:
Parsed response dictionary
- Raises:
json.JSONDecodeError – If the response cannot be parsed as JSON
- Return type:
- static validate_keys(required_keys, response_dict)[source]¶
Validate that all required keys are present in the response dictionary.
- validate_config(config_data)[source]¶
Validate and parse the configuration data into a CyberQueryAIConfig.
- Parameters:
config_data (
dict) – Raw configuration data- Return CyberQueryAIConfig:
Validated CyberQueryAI server configuration
- Return type:
- async get_api_config(request)[source]¶
Get the API configuration including model configuration and version.
- Return type:
- async post_chat(request)[source]¶
Chat with the AI assistant using conversation history.
- Return type:
- async post_generate_code(request)[source]¶
Generate cybersecurity code based on user prompt.
- Return type: