Ct rag
base_rag_redis_pipeline_controller(prompt, query, config, redis_client, redis_url, k=6, chunk_size=8000, service='azure')
Executes a Retrieval-Augmented Generation (RAG) pipeline with a list of files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt
|
str
|
The system prompt for RAG. |
required |
query
|
str
|
The user query for retrieving relevant information. |
required |
config
|
AppConfig
|
The application configuration object with user, task, and analysis details. |
required |
redis_client
|
Redis
|
The Redis client instance. |
required |
redis_url
|
str
|
The Redis server URL. |
required |
k
|
int
|
The number of top results to retrieve. Defaults to 6. |
6
|
chunk_size
|
int
|
The maximum chunk size for embeddings. Defaults to 8000. The text-embedding-3-large max inputs are 8191 tokens |
8000
|
service
|
str
|
Service of the LLM. "azure" or "openai" |
'azure'
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The Redis key where the RAG results are stored. |
Raises:
Type | Description |
---|---|
Exception
|
If an error occurs during the pipeline execution. |
Source code in controller/ct_rag.py
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 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
save_rag_redis(config, rag_obj, redis_client)
Saves the data from a RAGRedis object into Redis using a single hash key.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
AppConfig
|
The application configuration object with user, task, and analysis details. |
required |
rag_obj
|
RAGRedis
|
The RAGRedis object containing the response and associated data. |
required |
redis_client
|
Redis
|
The Redis client instance. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The Redis key under which the data is saved. |
Raises:
Type | Description |
---|---|
Exception
|
If an error occurs during the save operation. |
Source code in controller/ct_rag.py
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 |
|