Skip to content

Route response

get_context(rag_redis_key=Path(..., description='Redis Key. e.g.: rag:user:8719:medical')) async

Fetches the context information associated with a Redis key.

Parameters:

Name Type Description Default
rag_redis_key str

Redis key for the analysis.

Path(..., description='Redis Key. e.g.: rag:user:8719:medical')

Returns:

Name Type Description
JSONResponse

Context details.

Source code in view/api/route_responses.py
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
@router_response.get("/response/context/{rag_redis_key}")
async def get_context(rag_redis_key: str = Path(..., description="Redis Key. e.g.: rag:user:8719:medical")):
    """
    Fetches the context information associated with a Redis key.

    Args:
        rag_redis_key (str): Redis key for the analysis.

    Returns:
        JSONResponse: Context details.
    """
    try:
        context = ct_response.context_controller(rag_redis_key)
        return JSONResponse(content=context)
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"An error occurred: {e}")

get_detail(rag_redis_key=Path(..., description='Redis Key. e.g.: rag:user:8719:medical')) async

Fetches the detailed response information associated with a Redis key.

Parameters:

Name Type Description Default
rag_redis_key str

Redis key for the analysis.

Path(..., description='Redis Key. e.g.: rag:user:8719:medical')

Returns:

Name Type Description
JSONResponse

Detailed response information.

Source code in view/api/route_responses.py
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
@router_response.get("/response/detail/{rag_redis_key}")
async def get_detail(rag_redis_key: str = Path(..., description="Redis Key. e.g.: rag:user:8719:medical")):
    """
    Fetches the detailed response information associated with a Redis key.

    Args:
        rag_redis_key (str): Redis key for the analysis.

    Returns:
        JSONResponse: Detailed response information.
    """
    try:
        detail = ct_response.detail_controller(rag_redis_key)
        return JSONResponse(content=detail)
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"An error occurred: {e}")

get_evaluation(rag_redis_key=Path(..., description='Redis Key. e.g.: rag:user:8719:medical')) async

Fetches the evaluation associated with a Redis key.

Parameters:

Name Type Description Default
rag_redis_key str

Redis key for the analysis.

Path(..., description='Redis Key. e.g.: rag:user:8719:medical')

Returns:

Name Type Description
JSONResponse

Evaluation details.

Source code in view/api/route_responses.py
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
@router_response.get("/response/evaluation/{rag_redis_key}")
async def get_evaluation(rag_redis_key: str = Path(..., description="Redis Key. e.g.: rag:user:8719:medical")):
    """
    Fetches the evaluation associated with a Redis key.

    Args:
        rag_redis_key (str): Redis key for the analysis.

    Returns:
        JSONResponse: Evaluation details.
    """
    try:
        evaluation = ct_response.evaluation_controller(rag_redis_key)
        return JSONResponse(content=evaluation)
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"An error occurred: {e}")

get_files(rag_redis_key=Path(..., description='Redis Key. e.g.: rag:user:8719:medical')) async

Fetches the file names associated with a Redis key.

Parameters:

Name Type Description Default
rag_redis_key str

Redis key for the analysis.

Path(..., description='Redis Key. e.g.: rag:user:8719:medical')

Returns:

Name Type Description
JSONResponse

File names.

Source code in view/api/route_responses.py
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
@router_response.get("/response/files/{rag_redis_key}")
async def get_files(rag_redis_key: str = Path(..., description="Redis Key. e.g.: rag:user:8719:medical")):
    """
    Fetches the file names associated with a Redis key.

    Args:
        rag_redis_key (str): Redis key for the analysis.

    Returns:
        JSONResponse: File names.
    """
    try:
        files = ct_response.file_names_controller(rag_redis_key)
        return JSONResponse(content=files)
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"An error occurred: {e}")

get_messages(rag_redis_key=Path(..., description='Redis Key. e.g.: rag:user:8719:medical')) async

Fetches the messages associated with a Redis key.

Parameters:

Name Type Description Default
rag_redis_key str

Redis key for the analysis.

Path(..., description='Redis Key. e.g.: rag:user:8719:medical')

Returns:

Name Type Description
JSONResponse

Message details.

Source code in view/api/route_responses.py
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
@router_response.get("/response/messages/{rag_redis_key}")
async def get_messages(rag_redis_key: str = Path(..., description="Redis Key. e.g.: rag:user:8719:medical")):
    """
    Fetches the messages associated with a Redis key.

    Args:
        rag_redis_key (str): Redis key for the analysis.

    Returns:
        JSONResponse: Message details.
    """
    try:
        messages = ct_response.message_controller(rag_redis_key)
        return JSONResponse(content=messages)
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"An error occurred: {e}")

get_response(rag_redis_key=Path(..., description='Redis Key. e.g.: rag:user:8719:medical')) async

Fetches the response associated with a Redis key.

Parameters:

Name Type Description Default
rag_redis_key str

Redis key for the analysis.

Path(..., description='Redis Key. e.g.: rag:user:8719:medical')

Returns:

Name Type Description
JSONResponse

The analysis response content.

Source code in view/api/route_responses.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@router_response.get("/response/{rag_redis_key}")
async def get_response(rag_redis_key: str = Path(..., description="Redis Key. e.g.: rag:user:8719:medical")):
    """
    Fetches the response associated with a Redis key.

    Args:
        rag_redis_key (str): Redis key for the analysis.

    Returns:
        JSONResponse: The analysis response content.
    """
    try:
        response = ct_response.response_controller(rag_redis_key)
        if not response:
            raise HTTPException(status_code=404, detail="Response not found")
        return JSONResponse(content=response)
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"An error occurred: {e}")

get_responses_by_user(user=Path(..., description='User e.g.: user')) async

Fetches all responses associated with a user.

Parameters:

Name Type Description Default
user str

User identifier.

Path(..., description='User e.g.: user')

Returns:

Name Type Description
dict

A dictionary of responses for the user.

Source code in view/api/route_responses.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
@router_response.get("/response/per-user/{user}")
async def get_responses_by_user(user: str = Path(..., description="User e.g.: user")):
    """
    Fetches all responses associated with a user.

    Args:
        user (str): User identifier.

    Returns:
        dict: A dictionary of responses for the user.
    """
    try:
        response = ct_response.responses_by_user(user=user)
        return response
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"An error occurred: {e}")

get_usage(rag_redis_key=Path(..., description='Redis Key. e.g.: rag:user:8719:medical')) async

Fetches the token usage associated with a Redis key.

Parameters:

Name Type Description Default
rag_redis_key str

Redis key for the analysis.

Path(..., description='Redis Key. e.g.: rag:user:8719:medical')

Returns:

Name Type Description
JSONResponse

Token usage details.

Source code in view/api/route_responses.py
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
@router_response.get("/response/use/{rag_redis_key}")
async def get_usage(rag_redis_key: str = Path(..., description="Redis Key. e.g.: rag:user:8719:medical")):
    """
    Fetches the token usage associated with a Redis key.

    Args:
        rag_redis_key (str): Redis key for the analysis.

    Returns:
        JSONResponse: Token usage details.
    """
    try:
        usage = ct_response.usage_controller(rag_redis_key)
        return JSONResponse(content=usage)
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"An error occurred: {e}")

post_evaluation(rag_redis_key, evaluation_items) async

Submits an evaluation for a response.

Parameters:

Name Type Description Default
rag_redis_key str

Redis key for the analysis.

required
evaluation_items Evaluation

Evaluation data.

required

Returns:

Name Type Description
JSONResponse

The evaluation result.

Source code in view/api/route_responses.py
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
@router_response.post("/response/evaluation/{rag_redis_key}")
async def post_evaluation(rag_redis_key: str, evaluation_items: Evaluation):
    """
    Submits an evaluation for a response.

    Args:
        rag_redis_key (str): Redis key for the analysis.
        evaluation_items (Evaluation): Evaluation data.

    Returns:
        JSONResponse: The evaluation result.
    """
    try:
        evaluation = ct_response.evaluation_response(rag_redis_key, evaluation_items)
        return JSONResponse(content=evaluation)
    except Exception as e:
        raise HTTPException(status_code=500, detail=f"An error occurred: {e}")