cyber_query_ai.rag

RAG system for the CyberQueryAI application.

Classes

RAGSystem(model, embedding_model, ...)

RAG (Retrieval-Augmented Generation) system for cybersecurity documentation.

ToolSuite(**data)

Suite of cybersecurity tools.

ToolsMetadata(**data)

Metadata for a cybersecurity tool.

class cyber_query_ai.rag.ToolsMetadata(**data)[source]

Metadata for a cybersecurity tool.

file: str
name: str
category: str
subcategory: str
description: str
tags: list[str]
use_cases: list[str]
property metadata_dict: dict

Return metadata as a dictionary.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cyber_query_ai.rag.ToolSuite(**data)[source]

Suite of cybersecurity tools.

tools: dict[str, ToolsMetadata]
classmethod from_json(filepath)[source]

Load tools metadata from a JSON file.

Return type:

ToolSuite

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cyber_query_ai.rag.RAGSystem(model, embedding_model, tools_json_filepath)[source]

RAG (Retrieval-Augmented Generation) system for cybersecurity documentation.

__init__(model, embedding_model, tools_json_filepath)[source]

Initialize the RAG system.

vector_store: InMemoryVectorStore | None
classmethod create(model, embedding_model, tools_json_filepath)[source]

Create and initialize the RAG system.

Return type:

RAGSystem

load_documents()[source]

Load all text documents from the rag_data directory with JSON metadata.

Return type:

list[Document]

create_vector_store()[source]

Create or return existing vector store.

Return type:

None

format_context(documents)[source]

Format retrieved documents into a context string with rich metadata.

Return type:

str

get_context_for_template(query)[source]

Get RAG context for a specific query.

Return type:

str

generate_rag_content(query)[source]

Generate RAG context.

Return type:

str