Repository navigation
Expand file tree
/
Copy pathexceptions.py
More file actions
72 lines (63 loc) · 2.67 KB
/
Copy pathexceptions.py
File metadata and controls
72 lines (63 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# (H) Provider validation errors
GOOGLE_GLA_NO_KEY = (
"Gemini GLA provider requires api_key. "
"Set ORCHESTRATOR_API_KEY or CYPHER_API_KEY in .env file."
)
GOOGLE_VERTEX_NO_PROJECT = (
"Gemini Vertex provider requires project_id. "
"Set ORCHESTRATOR_PROJECT_ID or CYPHER_PROJECT_ID in .env file."
)
OPENAI_NO_KEY = (
"OpenAI provider requires api_key. "
"Set ORCHESTRATOR_API_KEY or CYPHER_API_KEY in .env file."
)
ANTHROPIC_NO_KEY = (
"Anthropic provider requires api_key. "
"Set ORCHESTRATOR_API_KEY or CYPHER_API_KEY in .env file."
)
AZURE_NO_KEY = "Azure OpenAI provider requires api_key. Set AZURE_API_KEY in .env file."
AZURE_NO_ENDPOINT = (
"Azure OpenAI provider requires endpoint. Set AZURE_OPENAI_ENDPOINT in .env file."
)
OLLAMA_NOT_RUNNING = (
"Ollama server not responding at {endpoint}. "
"Make sure Ollama is running: ollama serve"
)
UNKNOWN_PROVIDER = "Unknown provider '{provider}'. Available providers: {available}"
# (H) Dependency errors
SEMANTIC_EXTRA = "Semantic search requires 'semantic' extra: uv sync --extra semantic"
# (H) Configuration errors
PROVIDER_EMPTY = "Provider name cannot be empty in 'provider:model' format."
MODEL_ID_EMPTY = "Model ID cannot be empty."
MODEL_FORMAT_INVALID = (
"Model must be specified as 'provider:model' (e.g., openai:gpt-4o)."
)
BATCH_SIZE_POSITIVE = "batch_size must be a positive integer"
CONFIG = "{role} configuration error: {error}"
# (H) Graph loading errors
GRAPH_FILE_NOT_FOUND = "Graph file not found: {path}"
FAILED_TO_LOAD_DATA = "Failed to load data from file"
NODES_NOT_LOADED = "Nodes should be loaded"
RELATIONSHIPS_NOT_LOADED = "Relationships should be loaded"
DATA_NOT_LOADED = "Data should be loaded"
# (H) Parser errors
NO_LANGUAGES = "No Tree-sitter languages available."
# (H) LLM errors
LLM_INIT_CYPHER = "Failed to initialize CypherGenerator: {error}"
LLM_INVALID_QUERY = "LLM did not generate a valid query. Output: {output}"
LLM_DANGEROUS_QUERY = "LLM generated a destructive Cypher query (found '{keyword}'). Query rejected: {query}"
LLM_GENERATION_FAILED = "Cypher generation failed: {error}"
LLM_INIT_ORCHESTRATOR = "Failed to initialize RAG Orchestrator: {error}"
# (H) Graph service errors
BATCH_SIZE = "batch_size must be a positive integer"
CONN = "Not connected to Memgraph."
AUTH_INCOMPLETE = (
"Both username and password are required for authentication. "
"Either provide both or neither."
)
# (H) Access control errors (used with raise)
ACCESS_DENIED = "Access denied: Cannot access files outside the project root."
DOC_UNSUPPORTED_PROVIDER = "DocumentAnalyzer does not support the 'local' LLM provider."
# (H) Exception classes
class LLMGenerationError(Exception):
pass