Interactive
Interactive LLM interface for CodeMap.
RagUI
Interactive UI for the RAG process.
Source code in src/codemap/llm/rag/interactive.py
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 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
__init__
__init__() -> None
Initialize the RAG UI.
Source code in src/codemap/llm/rag/interactive.py
16 17 18 |
|
console
instance-attribute
console = Console()
format_ask_response
format_ask_response(response_text: str | None) -> Markdown
Formats the AI's response text using Rich Markdown.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
response_text
|
Optional[str]
|
The text response from the AI. |
required |
Returns:
Name | Type | Description |
---|---|---|
Markdown |
Markdown
|
A Rich Markdown object ready for printing. |
Source code in src/codemap/llm/rag/interactive.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
print_ask_result
print_ask_result(result: dict[str, Any]) -> None
Prints the structured result of the ask command using Rich.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
result
|
Dict[str, Any]
|
The structured result containing 'answer' and 'context'. |
required |
Source code in src/codemap/llm/rag/interactive.py
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 73 74 75 76 77 78 79 80 81 |
|
format_content_for_context
format_content_for_context(
context_items: list[dict[str, Any]],
) -> str
Format context items into a string suitable for inclusion in prompts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
context_items
|
list[dict[str, Any]]
|
List of context dictionaries with file_path, start_line, end_line, and content |
required |
Returns:
Type | Description |
---|---|
str
|
Formatted string with code snippets and file information |
Source code in src/codemap/llm/rag/interactive.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|