Skip to content

Views

LLMConfigViewSet

Bases: ModelViewSet

Source code in API/llm/views.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class LLMConfigViewSet(viewsets.ModelViewSet):
    permission_classes = [IsAuthenticated]
    serializer_class = LLMConfigRecordsSerializer
    """
    List all available llm config records
    """
    queryset = LLMConfigRecords.objects.all()

    @swagger_auto_schema(
        operation_summary="List LLM Model",
        operation_description="Obtain the list of available LLM models and their status, need to have a token",
        responses={200: LLMConfigRecordsSerializer(many=True)},
        tags=["llm"],
    )
    @csrf_exempt
    def list(self, request, *args, **kwargs):
        """Override the post method to add custom swagger documentation."""
        return super().list(request, *args, **kwargs)

serializer_class = LLMConfigRecordsSerializer class-attribute instance-attribute

List all available llm config records

list(request, *args, **kwargs)

Override the post method to add custom swagger documentation.

Source code in API/llm/views.py
22
23
24
25
26
27
28
29
30
31
@swagger_auto_schema(
    operation_summary="List LLM Model",
    operation_description="Obtain the list of available LLM models and their status, need to have a token",
    responses={200: LLMConfigRecordsSerializer(many=True)},
    tags=["llm"],
)
@csrf_exempt
def list(self, request, *args, **kwargs):
    """Override the post method to add custom swagger documentation."""
    return super().list(request, *args, **kwargs)